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.

Please see https://overconstrained.io for links to current Cassowary projects and resources, including source code for different implementations of Cassowary.

(Last real update of this page 12 February 2003; last minor update in 2018 to fix some links, add a pointer to overconstrained.io, and note that the distribution linked here is old.)

News

July 2011: The Cassowary constraint solver is now used as the layout engine in the Macintosh Lion OS! Here is some documentation from Apple:

Release notes, focussing on the difference between the old and new layout engines

Programming guide, more of a from scratch approach

Video from the developer conference

February 2014: Cassowary is being used in Grid Style Sheets, a replacement for CSS layout.

July 2014: Cassowary is one of the solvers available in implementations of the Babelsberg object constraint language. Papers on Babelsberg are available via Alan Borning's publications page, and also on the publications page from the Software Architecture Group at Hasso Plattner Institute, Potsdam, Germany.

Distribution

The code linked below on this page is no longer maintained -- again, please see https://overconstrained.io for links to current Cassowary projects and resources, including source code for different implementations of Cassowary.

Latest version here is v0.60. The original implementation in OTI Smalltalk is in the public domain; the ports to other languages are now licensed under the Lesser/Library GPL.

A technical report is included in the distribution that describes the algorithm, interface, and implementation of the Cassowary solver. Additionally, the distribution contains toy sample applications written in Smalltalk, C++, Java, and Python, and a more complex example Java applet, the "Constraint Drawing Application".

You must use a reasonably-well-conforming C++ compiler to build the C++ implementation of Cassowary. Consider using the freely-available GNU C++ compiler.

Contains all implementations and examples, README, the technical report referenced below, the NEWS file listing all user-visible changes, the ANNOUNCE file, LICENSE, COPYING.LGPL and more.

For the finite domain subsolver in Cassowary v0.50 and later, you need the Graph Template Library (GTL) built and installed before configuring Cassowary. Cassowary was tested against GTL-0.3.1, but may work against later versions.

Retrieve distributions via ftp.

As of 18 November 2005, the Cassowary source (CVS) is hosted at Cassowary project at SourceForge.net

Authors

Papers

Alan Borning, Kim Marriott, Peter Stuckey, and Yi Xiao, Solving Linear Arithmetic Constraints for User Interface Applications, Proceedings of the 1997 ACM Symposium on User Interface Software and Technology, October 1997, pages 87-96.

Greg J. Badros and Alan Borning, "The Cassowary Linear Arithmetic Constraint Solving Algorithm: Interface and Implementation", Technical Report UW-CSE-98-06-04, June 1998 (pdf)



Greg J. Badros, Alan Borning, and Peter J. Stuckey, "The Cassowary Linear Arithmetic Constraint Solving Algorithm," ACM Transactions on Computer Human Interaction, Vol. 8 No. 4, December 2001, pages 267-306. (pdf)

Papers on other solvers



The technical report is derived from the UIST paper, but is intended to be self-contained. It includes material on Cassowary from the UIST paper, plus a description of the Java, C++, and Smalltalk implementations and their interfaces, along with additional details, corrections, and clarifications.





Online Demos

The Bounded Quadrilateral Demo written in JavaScript

Applications Using Cassowary

See Scwm, the Scheme Constraints Window Manager.

Prototype version of Amaya web browser supporting our constraint cascading style sheets

Greg J. Badros / U Washington Computer Science and Engineering / gjb@cs.washington.edu