rust-or / rust-lp-modeler

Lp modeler written in Rust
MIT License
96 stars 29 forks source link

lp_sum creates a linked list instead of a balanced tree #65

Closed lovasoa closed 3 years ago

lovasoa commented 3 years ago

lp_sum returns a deeply imbalanced expression tree of the form AddExpr(a, AddExpr(b, AddExpr(c, AddExpr(d)))), which then causes stack overflows when being processed by simplify (see https://github.com/jcavat/rust-lp-modeler/issues/37).

lp_sum could return a balanced tree of depth log2(n) (instead of n), which would be less likely to cause stack overflows during processing.