<br><font size=2 face="sans-serif">Laci,</font>
<br>
<br><font size=2 face="sans-serif">I agree that OsiSolverInterface::addRows
is the fastest way but that does mean knowing in advance how many rows
will be added and guessing number of elements or using a complicated structure
holding CoinPackedVectors and bounds. &nbsp;I put in CoinBuild as it means
user has to change one line of code and add two more trivial lines and
you get same speed as addRows minus probably 1 %.</font>
<br>
<br><font size=2 face="sans-serif">John</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>ladanyi@watson.ibm.com</b>
</font>
<br><font size=1 face="sans-serif">Sent by: coin-discuss-bounces@list.coin-or.org</font>
<p><font size=1 face="sans-serif">02/04/2005 01:50 PM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
Discussions about open source software for Operations Research &nbsp; &nbsp;
&nbsp; &nbsp;</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">Discussions about open source
software for Operations Research &lt;coin-discuss@list.coin-or.org&gt;</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top><font size=1 face="sans-serif">coin-lpsolver@list.coin-or.org</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">Re: [Coin-discuss] Re: [Coin-lpsolver]
Problem creation performance</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>This is is a reasonable solution, but I'm not sure
it's necessary. Maybe just<br>
the documentation should be clearer that adding rows/cols one-by-one is
not<br>
the brightest thing to do; one should use the addRows/addCols methods<br>
instead. This CoinBuild class is just a vehicle to make this clear to the<br>
user, right? (Which might be a good enough reason for its existence...)<br>
<br>
--Laci<br>
<br>
On Fri, 4 Feb 2005, John J Forrest wrote:<br>
<br>
&gt; Apologies for double posting but it is more general than Clp.<br>
&gt; <br>
&gt; Francois mentioned that there was a large overhead to using addColumn
<br>
&gt; (i.e. adding one at a time) in Clp. &nbsp;As Clp is using CoinPackedMatrix
this <br>
&gt; probably also applies to other codes using CoinPackedMatrix, including
<br>
&gt; some implementations of Osi. &nbsp;I had realized there was an overhead
to <br>
&gt; addRow but had not realized it is worse for addColumn.<br>
&gt; <br>
&gt; My solution is to add a new class to Coin - CoinBuild. &nbsp;The user
<br>
&gt; instantiates an empty CoinBuild object and then performs addRow (or
<br>
&gt; addColumn but not a mixture) in the same was as addRow (or addColumn)
for <br>
&gt; an OsiSolverInterface model. &nbsp;This stores the information in
a linked <br>
&gt; list. &nbsp;Then the user uses model.addRows(object) to get the information
to <br>
&gt; its final destination. &nbsp;There is addRows/addColumns in Clp and
<br>
&gt; addRows/addCols in OsiSolverInterface.<br>
&gt; <br>
&gt; Doing this reduced the time for adding 10,000 rows from 0.53 seconds
to <br>
&gt; 0.04 and for adding 10,000 columns from 5.71 seconds to 0.03.<br>
&gt; <br>
&gt; (Francois - see Clp/Samples/addColumns.cpp for sample code).<br>
&gt; <br>
&gt; The reason for posting this to Coin-discuss was to tell people it
was <br>
&gt; available and to ask if other people had noticed the performance hit.
Also <br>
&gt; to see if my solution is adequate.<br>
&gt; <br>
&gt; John Forrest<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; François Galea &lt;Francois.Galea@prism.uvsq.fr&gt; <br>
&gt; Sent by: coin-lpsolver-bounces@list.coin-or.org<br>
&gt; 02/04/2005 03:15 AM<br>
&gt; <br>
&gt; To<br>
&gt; coin-lpsolver@list.coin-or.org<br>
&gt; cc<br>
&gt; <br>
&gt; Subject<br>
&gt; [Coin-lpsolver] Problem creation performance<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; Hi !<br>
&gt; <br>
&gt; I have a question concerning the Clp library API.<br>
&gt; <br>
&gt; I need to generate different LPs (my previous question about QPs has
no <br>
&gt; relation with this problem), whose size is about 2500 rows, 2500 columns
<br>
&gt; and 250000 non-zeros. The model is such that it's easier for me to
<br>
&gt; create an empty problem object using the ClpSimplex() constructor
:<br>
&gt; <br>
&gt; ClpSimplex * simplex = new ClpSimplex();<br>
&gt; <br>
&gt; then I populate it column-wise, by first performing a series of calls
<br>
&gt; like this:<br>
&gt; <br>
&gt; simplex-&gt;addRows( rcnt, lb, ub, rowstarts, NULL, NULL );<br>
&gt; <br>
&gt; then I add the columns by a series of this kind of calls :<br>
&gt; <br>
&gt; simplex-&gt;addColumns( 1, &amp;lb, &amp;ub, &amp;objcoef, colstarts,
ind, val );<br>
&gt; <br>
&gt; This leads to a major problem, that the creation of the problem is
much <br>
&gt; slower than its resolution. Maybe Clp is more performant when creating
<br>
&gt; simplex objects row-wise than column-wise, but I really need to create
<br>
&gt; my problem objects this way.<br>
&gt; <br>
&gt; Most of the examples I found in the Clp documentation create ClpSimplex
<br>
&gt; objects by reading MPS files, and the only one I found that creates
an <br>
&gt; object from scratch provides the whole simplex matrix at once, which
is <br>
&gt; okay when you can easily find the size of the problem before creating
<br>
&gt; the object, but it not okay for me.<br>
&gt; <br>
&gt; Could I get a link to a more complete documentation than the one I
found <br>
&gt; in the Clp website, which only mentions the addRows and addColumns
<br>
&gt; methods once ? Or can anybody tell me why I get such a low model <br>
&gt; creation speed, and how to make things faster ?<br>
&gt; <br>
&gt; Thanks for the help,<br>
&gt; <br>
&gt; François Galea<br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; Coin-lpsolver mailing list<br>
&gt; Coin-lpsolver@list.coin-or.org<br>
&gt; http://list.coin-or.org/mailman/listinfo/coin-lpsolver<br>
&gt; <br>
&gt; <br>
<br>
<br>
_______________________________________________<br>
Coin-discuss mailing list<br>
Coin-discuss@list.coin-or.org<br>
http://list.coin-or.org/mailman/listinfo/coin-discuss<br>
</tt></font>
<br>