Cassowary (software)

Cassowary is an incremental constraint solving toolkit that efficiently solves systems of linear equalities and inequalities. Constraints may be either requirements or preferences. Client code specifies the constraints to be maintained, and the solver updates the constrained variables to have values that satisfy the constraints.

Cassowary was developed by Greg Badros, Alan Borning and Peter J. Stuckey, and was optimized for user interface applications.[1] Badros used Cassowary amongst others for implementing Constraint Cascading Style Sheets (CCSS), an extension to Cascading Style Sheets (CSS). CCSS adds support for layout constraints. These allow designers to describe the layout of a web page in a more flexible manner. Cassowary is used to solve these constraints and calculate the final layout.

Smalltalk, C++ and Java versions are available in the main distribution. Furthermore, there are bindings for GNU Guile, Python, and STk.

Other people have ported the solver to JavaScript,[2] Dart, Squeak, Python and the .NET framework (Cassowary.net).

Applications

References

  1. The Cassowary linear arithmetic constraint solving algorithm, Authors: Greg J. Badros, Alan Borning & Peter J. Stuckey
  2. https://github.com/slightlyoff/cassowary.js/
  3. "Grid Style Sheets development history".
  4. "About CCSS".
  5. Casuarius provides Python bindings to a C++ implementation of the Cassowary algorithm.
  6. casuarius on GitHub
  7. Kiwi, a replacement for Casuarius/Cassowary. The new solver removes that bottleneck. It still uses the same Cassowary algorithm, but it's a from-scratch implementation of the algorithm based on the Cassowary paper, not the existing Cassowary source code. While the Cassowary algorithm is good, the existing C++ implementation has lots of inefficiencies. The new solver is anywhere between 12x and 500x faster depending on the problem (40x typical) and uses around 5x less memory. And as I typically do, I chose to write the Python bindings by hand in C++ rather than use Cython. The resulting code is faster, and we now have one less external dependency.
  8. kiwi on GitHub
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.