[Coin-discuss] adding constraints incrementally to OsiSolverInterface

Kish Shen kish.shen at crosscoreop.com
Wed Jul 12 00:04:05 EDT 2006


Hi,

Is there any way to improve the speed of adding constraints incrementally to a 
program in a OsiSolverInterface?

In our interface to COIN/Osi, we allow users to add constraints one by one to 
modify the problem. I use a CoinBuild to create the row representing the 
constraint, and then use OsiSOlverInterface's addCols() to add the row to the 
problem. 

We also allow the user to specify constraints before they create the COIN/Osi
problem. In this case, the constraints are loaded into the OsiSolverInterface 
with loadProblem() [with essentially the column-wise representation used by 
CPLEX and Xpress, the initial targets of our interface].

Our interface has to allow the user to add constraints incrementally, because 
this provides the most flexibility for our users.

I compared the loading times of adding all the constraints at the start when 
setting up the OsiSolverInterface with that of setting up the 
OsiSolverInterface, and then adding the constraints one by one. For two 
examples, one much larger than the other, here are the load times in seconds:

                                  Load at start           Incremental
small (780 rows)                     0.03                         0.11
big  (40215 rows)                    1.49                      299

the cost for loading many rows incrementally is thus very expensive. I assume 
this is because the problem has to be repeatedly copied and expanded?
[I am using OsiClpSolverInterface for this test]

For Xpress and CPLEX, the cost for loading the whole problem at the start is 
similar to for COIN/Osi, but the incremental is much better. For the big 
problem, the load times are 1.6s (load at start) and 3.8 (incremental).

Is there anyway I can make the incremental adding of rows more efficient for 
OsiSolverInterface? 

Thanks in advance for any help/information!

Cheers,

Kish Shen




More information about the Coin-discuss mailing list