-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to tell the Solver to prefer smaller or larger solutions? #164
Comments
Have you tried suggesting values, or using weak constraints to give high bounds to the values? |
Well, I don't know what values to suggest or what concrete bounds to add as weak constraints. The valid range for |
I'm not entirely sure how suggest value works. I don't believe Cassowary has any way of suggesting how values are iterated upon, that's more how finite domain constraint solvers work. Cassowary (perhaps all linear constraint solvers? I'm not an expert) is more "any solution that fits the constraint space is considered 'correct'", which makes it perfect for layouts et al. It will try to break the least number of constraints possible, with the exception of producing an error if any Hope that helps! Maybe the maintainers can give some more pointed, technical insight. I too am curious if this is feasible in any deterministic way. |
If you want a value to trend a certain way, give it a stronger weight. You can use 'float' values for a weight instead of string constants. The string constants are converted to floats internally, they just represent three orders of magnitude between one another. |
Consider this example:
The output shows that the order in which constraints are added affects the solution:
I'd like the solver to always prefer the largest or smallest possible solution, if possible. I'm guessing this may be difficult or impossible with a linear constraint solver, but I wanted to make sure there's no way to get around this aspect of the constraint solving system.
To be clear, in the real world the code will add a complicated set of constraints to the solver, so I don't actually know what the min and max values are, like in this example.
The text was updated successfully, but these errors were encountered: