[Clp] Bug in ClpModel::gutsOfCopy (stable branch)
Sebastian Theophil
stheophil at think-cell.com
Tue Dec 22 04:29:29 EST 2009
Hi,
there seems to be a bug in ClpModel::gutsOfCopy in the stable branch:
in lines 780 and following (i.e. if trueCopy && maximumRows_<0) there is
the following code:
if (rhs.rowActivity_) {
rowActivity_= ClpCopyOfArray(rhs.rowActivity_, numberRows_);
columnActivity_=
ClpCopyOfArray(rhs.columnActivity_,numberColumns_);
dual_= ClpCopyOfArray(rhs.dual_, numberRows_);
reducedCost_= ClpCopyOfArray(rhs.reducedCost_, numberColumns_);
} else {
rowActivity_=NULL;
columnActivity_=NULL;
dual_=NULL;
reducedCost_=NULL;
}
which seems wrong because rhs.reducedCost_ and rhs.columnActivity_ can
be non zero if rhs has > 0 columns but zero rows:
ClpSimplex solver;
double afLower[] = { 0.0, 0.0 };
double afUpper[] = { 1.0, 1.0 };
double afObj[] = { 1.0, 0.0 };
solver.addColumns( 2, afLower, afUpper, afObj, NULL );
ClpSimplex solver2 = solver;
solver has a valid columnActivity_ array, solver2 does not. Unless
further columns are added to solver2, solving solver2 should cause a
crash.
>From what I see, ClpModel::gutsOfCopy should either not do any checks at
all and just ClpCopyOfArray every array, or it should enforce strict
consistency checks like
if(numberRows_>0) {
rowActivity_ = copy_and_assert_not_null(rhs.rowActivity_,
numberRows_)
...
}
if(numberColumns_>0) {
...
}
Regards,
Sebastian
--
Sebastian Theophil . stheophil at think-cell.com
Software Engineer
think-cell Software GmbH . Chausseestr. 8/E . 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