[Coin-discuss] Re: [Coin-lpsolver] Problem creation performance

Jean-Sebastien Roy js at jeannot.org
Fri Feb 4 14:59:59 EST 2005


As alternative, I've often used a hash-table ((int,int) -> double, with 
0 values not stored) to  store & modify the coefficient matrix, put all 
the elements in an array and sort them before using the Coin 
loadProblem() function to instantiate the problem.

It's quite easy to code (I did it in C, it should be much easier in 
C++), enables reasonnably fast input and update of the coefficient 
matrix, and fast instantiation (the sort usually doesn't take much time).

Regards,

js

John J Forrest wrote:
> 
> Apologies for double posting but it is more general than Clp.
> 
> Francois mentioned that there was a large overhead to using addColumn 
> (i.e. adding one at a time) in Clp.  As Clp is using CoinPackedMatrix 
> this probably also applies to other codes using CoinPackedMatrix, 
> including some implementations of Osi.  I had realized there was an 
> overhead to addRow but had not realized it is worse for addColumn.
> 
> My solution is to add a new class to Coin - CoinBuild.  The user 
> instantiates an empty CoinBuild object and then performs addRow (or 
> addColumn but not a mixture) in the same was as addRow (or addColumn) 
> for an OsiSolverInterface model.  This stores the information in a 
> linked list.  Then the user uses model.addRows(object) to get the 
> information to its final destination.  There is addRows/addColumns in 
> Clp and addRows/addCols in OsiSolverInterface.
> 
> Doing this reduced the time for adding 10,000 rows from 0.53 seconds to 
> 0.04 and for adding 10,000 columns from 5.71 seconds to 0.03.
> 
> (Francois - see Clp/Samples/addColumns.cpp for sample code).
> 
> The reason for posting this to Coin-discuss was to tell people it was 
> available and to ask if other people had noticed the performance hit. 
>  Also to see if my solution is adequate.
> 
> John Forrest



More information about the Coin-discuss mailing list