Hacker News new | past | comments | ask | show | jobs | submit login

(I worked on autolayout at Apple)

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.

@ridiculous_fish: Hi, I just found that you are worked on autolayout, I have a little question about autolayout. There is a simple view as follow, a subView with some Constraints, they are all UILayoutPriorityRequired,when superview frame change, system will break the subView's height Constraint(300), but the top||bottom Constraint(30). they are all UILayoutPriorityRequired, why the system did things like this, and how does AutoLayout work (what's the calculate order? superView->subView->subviews'subview?),and where can I find the docs about this? :)

|-----------------------------| | | | | 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)

shit, I use characters draw the constraints, but the Comment removed the \n characters, Add the "\n" by yourself:\n |-----------------------------|\n | | |\n | 30 |\n | | |\n |-60-[subView(height:300)]-60-|\n | | |\n | 30 |\n | | |\n |-----------------------------|\n

That's interesting! Is it using Lagrangian duality to do any sort of shadow pricing for incremental changes? I guess I should probably read the paper by now.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact