I am working on a C++ app where I am supposed to align some objects within a canvas based on several constraints. The number of constraints can go as high as 500-1000.
I am using Cassowary Rhea c++ implementation for solving the constraints. The final solved results are good. But I am struggling with the performance. So for 9 objects, i.e 36 variables and around 350 - 450 constraints, my app takes more than 15-20 seconds to solve. For similar set of constraints Apple's AutoLayout takes just 1 second to do the layout. But my usage of Rhea implementation takes way more than 10-15 seconds.
Has it something do to with the way we assign the priorities and weight to the non required constraints? Currently I am not using any edit and stay constraints. I just add all the constraints with some strengths and weights. And then solve it finally.
I am using all four possible strengths.(Required, strong, medium and weak). Further I am using symbolic weights in various strength levels as follows:
Strong: 100, 50
Medium: 50, 49, 45, 42
Weak: 25, 30
It would be great if someone can provide me some insight on this. A similar example implementation would be a great help.
Thanks.