<html><body>
<p>Sebastian,<br>
<br>
Thanks.  As there is some intelligence in Coin or ClpCopyOfArray the simplest is always do the copy.  I have modified in stable/1.11 - does that fix problem?<br>
<br>
John<br>
<br>
<img width="16" height="16" src="cid:1__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt="Inactive hide details for &quot;Sebastian Theophil&quot; ---12/22/2009 04:33:23 AM---Hi, there seems to be a bug in ClpModel::gutsOfCopy "><font color="#424282">&quot;Sebastian Theophil&quot; ---12/22/2009 04:33:23 AM---Hi, there seems to be a bug in ClpModel::gutsOfCopy in the stable branch:</font><br>
<br>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2" color="#5F5F5F">From:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">&quot;Sebastian Theophil&quot; &lt;stheophil@think-cell.com&gt;</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2" color="#5F5F5F">To:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">&lt;clp@list.coin-or.org&gt;</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2" color="#5F5F5F">Cc:</font></td><td width="100%" valign="middle"><img width="1" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">John J Forrest/Watson/IBM@IBMUS</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2" color="#5F5F5F">Date:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">12/22/2009 04:33 AM</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2" color="#5F5F5F">Subject:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">[Clp] Bug in ClpModel::gutsOfCopy (stable branch)</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2" color="#5F5F5F">Sent by:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBFC07DFA4C42E8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">clp-bounces@list.coin-or.org</font></td></tr>
</table>
<hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br>
<br>
<br>
<tt>Hi,<br>
<br>
there seems to be a bug in ClpModel::gutsOfCopy in the stable branch:<br>
<br>
in lines 780 and following (i.e. if trueCopy &amp;&amp; maximumRows_&lt;0) there is<br>
the following code:<br>
<br>
 &nbsp;if (rhs.rowActivity_) {<br>
                 rowActivity_= ClpCopyOfArray(rhs.rowActivity_, numberRows_);<br>
                 columnActivity_=<br>
ClpCopyOfArray(rhs.columnActivity_,numberColumns_);<br>
                 dual_= ClpCopyOfArray(rhs.dual_, numberRows_);<br>
                 reducedCost_= ClpCopyOfArray(rhs.reducedCost_, numberColumns_);<br>
 &nbsp;} else {<br>
                 rowActivity_=NULL;<br>
                 columnActivity_=NULL;<br>
                 dual_=NULL;<br>
                 reducedCost_=NULL;<br>
 &nbsp;}<br>
<br>
which seems wrong because rhs.reducedCost_ and rhs.columnActivity_ can<br>
be non zero if rhs has &gt; 0 columns but zero rows:<br>
<br>
                 ClpSimplex solver;<br>
<br>
                 double afLower[] = { 0.0, 0.0 };<br>
                 double afUpper[] = { 1.0, 1.0 };<br>
                 double afObj[] = { 1.0, 0.0 };<br>
                 solver.addColumns( 2, afLower, afUpper, afObj, NULL );<br>
<br>
                 ClpSimplex solver2 = solver;<br>
<br>
solver has a valid columnActivity_ array, solver2 does not. Unless<br>
further columns are added to solver2, solving solver2 should cause a<br>
crash.<br>
<br>
&gt;From what I see, ClpModel::gutsOfCopy should either not do any checks at<br>
all and just ClpCopyOfArray every array, or it should enforce strict<br>
consistency checks like<br>
<br>
                 if(numberRows_&gt;0) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowActivity_ = copy_and_assert_not_null(rhs.rowActivity_,<br>
numberRows_)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br>
 &nbsp; &nbsp; &nbsp;}<br>
                 if(numberColumns_&gt;0) {<br>
                                  ...<br>
                 }<br>
<br>
Regards,<br>
Sebastian<br>
<br>
--<br>
Sebastian Theophil . stheophil@think-cell.com<br>
Software Engineer<br>
 <br>
think-cell Software GmbH . Chausseestr. 8/E . 10115 Berlin, Germany <br>
</tt><tt><a href="http://www.think-cell.com">http://www.think-cell.com</a></tt><tt>&nbsp;. phone +49 30 666473-10 . toll-free (US) +1 800 891 8091<br>
Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl . Amtsgericht Berlin-Charlottenburg, HRB 85229<br>
<br>
<br>
_______________________________________________<br>
Clp mailing list<br>
Clp@list.coin-or.org<br>
</tt><tt><a href="http://list.coin-or.org/mailman/listinfo/clp">http://list.coin-or.org/mailman/listinfo/clp</a></tt><tt><br>
</tt><br>
<br>
</body></html>