<br><font size=2 face="sans-serif">Totally my stupidity - is it better
now. &nbsp;</font>
<br>
<br><font size=2 face="sans-serif">I have added your patches (they broke
CBC but I fixed that)</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>François Galea &lt;francois.galea@prism.uvsq.fr&gt;</b>
</font>
<br><font size=1 face="sans-serif">Sent by: coin-lpsolver-bounces@list.coin-or.org</font>
<p><font size=1 face="sans-serif">06/30/2005 07:01 AM</font>
<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">coin-lpsolver@list.coin-or.org</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">[Coin-lpsolver] ClpSolve
problem</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>Hello,<br>
<br>
I have met several segmentation fault errors, when I use the <br>
ClpSimplex::initialSolve( ClpSolve &amp; ) method for starting a new solve.<br>
<br>
The example attached program doesn't work, if I choose to switch <br>
presolve off. If I switch it on, everything works (provided the Clp <br>
sources have been patched with the patch I sent before, otherwise the <br>
names changes won't work). Some other pieces of code I've got crash even
<br>
if I set presolve on.<br>
<br>
I haven't understood enough the internals of ClpSimplex and ClpModel to
<br>
be sure about what is wrong.<br>
<br>
Could somebody tell me what's wrong ?<br>
<br>
Thanks,<br>
<br>
François<br>
<br>
<br>
-- <br>
François Galea<br>
Equipe OPALE - Laboratoire PRiSM<br>
Université de Versailles-Saint Quentin en Yvelines<br>
45 av Etats-Unis F-78035 Versailles CEDEX<br>
Tél. : +33 1 39 25 40 50<br>
<br>
#include &lt;cstdio&gt;<br>
<br>
#include &quot;ClpSimplex.hpp&quot;<br>
#include &quot;CoinBuild.hpp&quot;<br>
<br>
int main( int argc, char * argv[] )<br>
{<br>
 &nbsp;const static struct { double a, b, c, d; } p [] =<br>
 &nbsp;{<br>
 &nbsp; &nbsp;{ 5.0, 0.0, 7.0, 3.0 },<br>
 &nbsp; &nbsp;{ 8.0, 0.0, 7.0, 6.0 },<br>
 &nbsp; &nbsp;{ 0.0, 10.0, 3.0, 9.0 },<br>
 &nbsp; &nbsp;{ 1.0, 8.0, 5.0, 9.0 },<br>
 &nbsp; &nbsp;{ 2.0, 0.0, 0.0, 7.0 },<br>
 &nbsp; &nbsp;{ 0.0, 4.0, 5.0, 0.0 },<br>
 &nbsp; &nbsp;{ 0.0, 1.0, 6.0, 2.0 },<br>
 &nbsp; &nbsp;{ 2.0, 0.0, 8.0, 3.0 }<br>
 &nbsp;};<br>
 &nbsp;const static char * columnNames [2] = { &quot;x&quot;, &quot;y&quot;
};<br>
 &nbsp;double k, obj;<br>
 &nbsp;char buf[ 10 ];<br>
 &nbsp;char * rowname = buf;<br>
 &nbsp;double val[ 2 ];<br>
 &nbsp;int ind[ 2 ];<br>
 &nbsp;unsigned int i;<br>
 &nbsp;const double * sol;<br>
 &nbsp;ClpSimplex lp;<br>
 &nbsp;CoinBuild * buildObject;<br>
 &nbsp;ClpSolve * solveOptions;<br>
<br>
 &nbsp;lp.setStrParam( ClpProbName, &quot;foo&quot; );<br>
<br>
 &nbsp;buildObject = new CoinBuild( 1 );<br>
 &nbsp;buildObject-&gt;addCol( 0, NULL, NULL, 0.0, +COIN_DBL_MAX, 4 );<br>
 &nbsp;buildObject-&gt;addCol( 0, NULL, NULL, 0.0, +COIN_DBL_MAX, 3 );<br>
 &nbsp;lp.addColumns( *buildObject );<br>
 &nbsp;delete buildObject;<br>
 &nbsp;lp.copyColumnNames( columnNames, 0, 2 );<br>
<br>
 &nbsp;buildObject = new CoinBuild( 0 );<br>
 &nbsp;ind[ 0 ] = 0;<br>
 &nbsp;ind[ 1 ] = 1;<br>
 &nbsp;for( i = 0; i &lt; (sizeof( p ) / sizeof( p[0] )); i++ )<br>
 &nbsp;{<br>
 &nbsp; &nbsp;k = p[i].a * p[i].d - p[i].c * p[i].b;<br>
 &nbsp; &nbsp;val[0] = (p[i].d-p[i].b)/k;<br>
 &nbsp; &nbsp;val[1] = (p[i].a-p[i].c)/k;<br>
 &nbsp; &nbsp;<br>
 &nbsp; &nbsp;if( ((1.0-val[0]*4.0)/val[1]) &gt; 5.0 )<br>
 &nbsp; &nbsp; &nbsp;buildObject-&gt;addRow( 2, ind, val, 0.0, 1.0 );<br>
 &nbsp; &nbsp;else<br>
 &nbsp; &nbsp; &nbsp;buildObject-&gt;addRow( 2, ind, val, 1.0, +COIN_DBL_MAX
);<br>
 &nbsp;}<br>
 &nbsp;lp.setOptimizationDirection( -1.0 );<br>
 &nbsp;lp.addRows( *buildObject );<br>
 &nbsp;for( i = 0; i &lt; (sizeof( p ) / sizeof( p[0] )); i++ )<br>
 &nbsp;{<br>
 &nbsp; &nbsp;sprintf( buf, &quot;c%d&quot;, i );<br>
 &nbsp; &nbsp;lp.copyRowNames( &amp;rowname, i, i+1 );<br>
 &nbsp;}<br>
 &nbsp;delete buildObject;<br>
<br>
 &nbsp;solveOptions = new ClpSolve();<br>
 &nbsp;solveOptions-&gt;setSolveType( ClpSolve::useDual );<br>
 &nbsp;solveOptions-&gt;setPresolveType( ClpSolve::presolveOff, 0 );<br>
 &nbsp;// solveOptions-&gt;setPresolveType( ClpSolve::presolveOn, 5 );<br>
 &nbsp;lp.setLogLevel( 1 );<br>
 &nbsp;lp.initialSolve( *solveOptions );<br>
 &nbsp;delete solveOptions;<br>
<br>
 &nbsp;lp.writeMps( &quot;foo.mps&quot; );<br>
<br>
 &nbsp;obj = -lp.rawObjectiveValue();<br>
 &nbsp;sol = lp.getColSolution();<br>
<br>
 &nbsp;printf( &quot;obj = %f\nx = %f\ny = %f\n&quot;, obj, sol[ 0 ], sol[
1 ] );<br>
<br>
 &nbsp;return 0;<br>
}<br>
_______________________________________________<br>
Coin-lpsolver mailing list<br>
Coin-lpsolver@list.coin-or.org<br>
http://list.coin-or.org/mailman/listinfo/coin-lpsolver<br>
</tt></font>
<br>