Behind the Scenes with Auto Layout - How to Solve Constraints with the Cassowary Algorithm
summary
Shows how Auto Layout turns constraints into linear equations and solves them with the Cassowary algorithm, demonstrating an incremental solver that updates a cached tableau instead of recalculating from scratch. Converts inequalities with slack variables, uses marker variables to remove constraints, and pivots to reach a basic feasible solution then an optimum (example reduces the middle distance to 5). Explains why independent views scale linearly and why constraint priorities add measurable cost, with concrete steps and numbers.
AI-written summary · about
chapters (20)
- 0:00Intro
- 2:29From developer to user
- 3:29Your input
- 4:11The Render Loop
- 5:24Auto Layout Engine
- 8:22WWDC 2018
- 9:47PlanGrid Papers
- 11:24Cassowary paper 97
- 12:22Incremental, optimized
- 13:38Linear Programming
- 14:06Constraint solving LP problem
- 14:31Let's solve constraints!
- 17:48Augmented Simplex Form
- 18:23Converting to equalities
- 21:31Basic feasible solved form
- 22:36Basic feasible solution
- 23:26Simplex Optimization
- 27:10Adding constraints
- 28:26Removing constraints
- 29:26Constraint priorities








