martindevans / Cassowary.net

An incremental constraint solver for .NET
http://jozilla.net/Software/CassowaryNet
GNU Lesser General Public License v2.1
3 stars 5 forks source link

Fixed https://github.com/martindevans/Cassowary.net/issues/2 #3

Closed bazilshep closed 4 years ago

bazilshep commented 4 years ago

Fixed https://github.com/martindevans/Cassowary.net/issues/2

All tests pass.

It should be this way according to the original paper. Not sure why this wasn't like this already. Did the old .net framework version do this implicitly?

https://constraints.cs.washington.edu/solvers/cassowary-tochi.pdf Page 34:

A.2.2 Linear Expressions. Instances of the class ClLinearExpression hold a linear expression and are used in building and representing constraints and in representing the tableau. A linear expression holds a dictionary of variables and coefficients (the keys are variables and the values are the corresponding coefficients). Only variables with nonzero coefficients are included in the dictionary; if a variable is not in this dictionary its coefficient is assumed to be zero.

martindevans commented 4 years ago

Thanks for this PR! I've requested a small change in the review, but it's nothing major so if you don't want to do that I'll merge it in a few days :)

Not sure why this wasn't like this already. Did the old .net framework version do this implicitly?

Not as far as I know - It looks like this is simple a bug in the original implementation,

martindevans commented 4 years ago

Thanks very much :)