[Clp] Proposed Patch for ClpModel::gutsOfCopy

John J Forrest jjforre at us.ibm.com
Mon Oct 26 07:49:58 EDT 2009


Sebastian,

If columnActivity_ is NULL then numberColumns_ should have been zero.  I
should probably look into it further.

However your fix will do no harm - thanks.

John Forrest


                                                                                                   
  From:       "Sebastian Theophil" <stheophil at think-cell.com>                                      
                                                                                                   
  To:         <clp at list.coin-or.org>                                                               
                                                                                                   
  Date:       10/23/2009 08:55 AM                                                                  
                                                                                                   
  Subject:    [Clp] Proposed Patch for ClpModel::gutsOfCopy                                        
                                                                                                   
  Sent by:    clp-bounces at list.coin-or.org                                                         
                                                                                                   





Hi,


I have encountered what I believe to be a bug in ClpModel::gutsOfCopy.
In the latest trunk, lines 779-797 are

      if (rhs.rowActivity_) {
		 rowActivity_=new double[numberRows_];
		 columnActivity_=new double[numberColumns_];
		 dual_=new double[numberRows_];
		 reducedCost_=new double[numberColumns_];
		 ClpDisjointCopyN ( rhs.rowActivity_, numberRows_ ,
		 		 		    rowActivity_);
		 ClpDisjointCopyN ( rhs.columnActivity_, numberColumns_ ,
		 		 		    columnActivity_);
		 ClpDisjointCopyN ( rhs.dual_, numberRows_ ,
		 		 		    dual_);
		 ClpDisjointCopyN ( rhs.reducedCost_, numberColumns_ ,
		 		 		    reducedCost_);
      } else {
		 rowActivity_=NULL;
		 columnActivity_=NULL;
		 dual_=NULL;
		 reducedCost_=NULL;
      }

After creating a OsiClpSolverInterface and adding a few constraints I
have created an object in which rowActivity_ and dual_ are set, but
columnActivity_ and reducedCost_ are not and the above code crashes. The
model is not solved yet, maybe that's why the problem occurs.

If I change the above lines to

		 rowActivity_= ClpCopyOfArray(rhs.rowActivity_, numberRows_);
		 columnActivity_= ClpCopyOfArray(rhs.columnActivity_,
numberColumns_);
		 dual_= ClpCopyOfArray(rhs.dual_, numberRows_);
		 reducedCost_= ClpCopyOfArray(rhs.reducedCost_,
numberColumns_);

Everything works fine.

Regards
Sebastian

--
Sebastian Theophil . stheophil at think-cell.com
Software Engineer

think-cell Software GmbH . Invalidenstr. 34 . 10115 Berlin, Germany
http://www.think-cell.com . phone +49-30-666473-10 . toll-free (US)
+1-800-891-8091
Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl . Amtsgericht
Berlin-Charlottenburg, HRB 85229


_______________________________________________
Clp mailing list
Clp at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/clp

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/clp/attachments/20091026/27d2e9ac/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/clp/attachments/20091026/27d2e9ac/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/clp/attachments/20091026/27d2e9ac/attachment-0001.gif>


More information about the Clp mailing list