[Clp] Bug in ClpModel::gutsOfCopy (stable branch)

John J Forrest jjforre at us.ibm.com
Tue Dec 22 05:05:31 EST 2009


Sebastian,

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?

John


                                                                                                       
  From:       "Sebastian Theophil" <stheophil at think-cell.com>                                          
                                                                                                       
  To:         <clp at list.coin-or.org>                                                                   
                                                                                                       
  Cc:         John J Forrest/Watson/IBM at IBMUS                                                          
                                                                                                       
  Date:       12/22/2009 04:33 AM                                                                      
                                                                                                       
  Subject:    [Clp] Bug in ClpModel::gutsOfCopy (stable branch)                                        
                                                                                                       
  Sent by:    clp-bounces at list.coin-or.org                                                             
                                                                                                       





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


_______________________________________________
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/20091222/99258744/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/20091222/99258744/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/20091222/99258744/attachment-0001.gif>


More information about the Clp mailing list