[Coin-discuss] adding constraints incrementally to OsiSolverInterface

John J Forrest jjforre at us.ibm.com
Wed Jul 12 09:25:28 EDT 2006


Kish,

Yes.  Use a CoinModel object (or faster but less flexible a CoinBuild
object) to do addRow and then use that to add to OsiSolverInterface object.
There is an example in ../Clp/examples/addRows.cpp which is for Clp but the
same functionality is available in OsiSolverInterface

John Forrest


                                                                           
             Kish Shen                                                     
             <kish.shen at crossc                                             
             oreop.com>                                                 To 
             Sent by:                  coin-discuss at list.coin-or.org       
             coin-discuss-boun                                          cc 
             ces at list.coin-or.                                             
             org                                                   Subject 
                                       [Coin-discuss] adding constraints   
                                       incrementally to                    
             07/12/06 12:04 AM         OsiSolverInterface                  
                                                                           
                                                                           
             Please respond to                                             
             Discussions about                                             
                open source                                                
               software for                                                
                Operations                                                 
                 Research                                                  
             <coin-discuss at lis                                             
              t.coin-or.org>                                               
                                                                           
                                                                           




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

_______________________________________________
Coin-discuss mailing list
Coin-discuss at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/coin-discuss





More information about the Coin-discuss mailing list