Cassowary – A Constraint Solving Toolkit
constraints.cs.washington.edu
constraints.cs.washington.edu
Kiwi is an implementation of the algorithm based on the seminal Cassowary paper. It is not a refactoring of the original C++ solver. Kiwi has been designed from the ground up to be lightweight and fast. Kiwi ranges from 10x to 500x faster than the original Cassowary solver with typical use cases gaining a 40x improvement. Memory savings are consistently > 5x.
https://github.com/AbletonAG/aqt-cassowary
Edit: Anyone interested in modern implementations and participating in the community of library implementers and users can check this website: http://overconstrained.io/ :-)
Is there a reason why cassowary took the constraint solver approach other than the fact that it is called constraint-based layout?
Cassowary is LP - it's just the Simplex method. Constraints become equalities and inequalities in the tableau, and the objective function is constructed from non-required ("best effort") constraints.
The novel contribution from Cassowary is its incrementalism technique. It can add, remove, and edit constraints without having to re-solve the whole LP problem over again. So it's well suited for interactive applications.
An example is dragging. You establish a constraint that sets the position of the dragged object, and then modify that constraint during the drag. Cassowary can re-use the old computation to solve the new one very efficiently.
|-----------------------------| | | | | 30 | | | | |-60-[subView(height:300)]-60-| | | | | 30 | | | | |-----------------------------| (maybe this case is not much suitable,because I should remove or change some constraints, I just want to use this case to explain the question)
In any case, I think the title is a bit vague and should more complete stated; such as:
Cassowary - an incremental constraint solving toolkit for linear equation systems.