Re: [sage-support] Re: add_constraint becomes slow in presence of many constraints

2014-04-29 Thread Stephen Hartke
Adding row constraints one at a time is slow because of the internal data structures that simplex solvers use. In large LPs/IPs, the constraint matrix is almost always sparse, and so allocating an entire dense matrix doesn't make sense. Instead, a packed sparse matrix is used. Because of the

[sage-support] Re: add_constraint becomes slow in presence of many constraints

2014-04-28 Thread Nathann Cohen
Helloo !!! I think this is right. Allocating copying such a huge matrix repeatedly would be terrible. Perhaps we should introduce an API function to add_constraints, which takes a list of lists, or a matrix? If a solver doesn't support such a thing, we could fall back on

[sage-support] Re: add_constraint becomes slow in presence of many constraints

2014-04-21 Thread john_perry_usm
And I guess it does not like to never know how many constraints there will be, and I fear that it does a lot of useless copies when you add a constraint (perhaps it copies the whole matrix just to add one line ?). I think this is right. Allocating copying such a huge matrix repeatedly