And there are known way of solving these things, e.g. simplex methods or Cassowary constraint solver (CCS)[2] will work.
In fact flexbox layout is a particular case of LP task and also can be solved by CCS efficiently.
[1] https://en.wikipedia.org/wiki/Linear_programming [2] https://en.wikipedia.org/wiki/Cassowary_(software)
And there are known way of solving these things, e.g. simplex methods or Cassowary constraint solver (CCS)[2] will work.
In fact flexbox layout is a particular case of LP task and also can be solved by CCS efficiently.
[1] https://en.wikipedia.org/wiki/Linear_programming [2] https://en.wikipedia.org/wiki/Cassowary_(software)