[Clp] Proposed Patch for ClpModel::gutsOfCopy

Sebastian Theophil stheophil at think-cell.com
Fri Oct 23 08:51:35 EDT 2009


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





More information about the Clp mailing list