[Osi-tickets] [COIN-OR Open Solver Interface] #62: OsiCpx getObjCoefficients does not work if column added

COIN-OR Open Solver Interface coin-trac at coin-or.org
Mon Jun 2 13:36:54 EDT 2008


#62: OsiCpx getObjCoefficients does not work if column added
---------------------+------------------------------------------------------
 Reporter:  mgalati  |       Owner:  mjs 
     Type:  defect   |      Status:  new 
 Priority:  major    |   Milestone:      
Component:  OsiCpx   |     Version:  0.96
 Keywords:           |  
---------------------+------------------------------------------------------
 It looks like the problem is related to the actual OsiCpx implementation.

 Notice, if obj_ is non null, it does not get the new objective vector.
 That means, if a column is added, it does not get the new information.
 This is obviously not good.

 {{{
 //------------------------------------------------------------------
 const double * OsiCpxSolverInterface::getObjCoefficients() const
 {
   debugMessage("OsiCpxSolverInterface::getObjCoefficients()\n");

   if ( obj_==NULL )
     {
       int ncols = CPXgetnumcols( env_, getMutableLpPtr() );
       if( ncols > 0 )
         {
           obj_ = new double[ncols];
           int err = CPXgetobj( env_, getMutableLpPtr(), obj_, 0, ncols-1
 );
           checkCPXerror( err, "CPXgetobj", "getObjCoefficients" );
         }
     }
   return obj_;
 }
 }}}


 There seems to be a bigger problem at hand here.

 I start out with 5 columns in an OsiCpx object.

 If I use the base class Osi::getObjValue( ) after adding a column, I get
 the correct number of columns, but junk back from getObjCoefficients( )
 and getColSolution( )

 {{{
 > MVG inside OsiSolverInterface nc = 6
 > OsiCpxSolverInterface::getObjCoefficients()
 > OsiCpxSolverInterface::getColSolution()
 > OsiCpxSolverInterface::getDblParam(4)
 > objOffset = 0
 > MVG getObjValue i:0, retVal: -0, objCo: -15 colSol: 0
 > MVG getObjValue i:1, retVal: -2.44186, objCo: -15 colSol: 0.162791
 > MVG getObjValue i:2, retVal: -10.1163, objCo: -15 colSol: 0.511628
 > MVG getObjValue i:3, retVal: -12.5581, objCo: -15 colSol: 0.162791
 > MVG getObjValue i:4, retVal: -12.5581, objCo: -15 colSol: 0
 > MVG getObjValue i:5, retVal: -12.5581, objCo: 1.56391e-311 colSol:
 7.20064e-313
 > OsiCpxSolverInterface::getNumCols()
 > MVG inside OsiSolverInterface nc = 6
 }}}

-- 
Ticket URL: <https://projects.coin-or.org/Osi/ticket/62>
COIN-OR Open Solver Interface <http://projects.coin-or.org/Osi>
An API for a variety of LP and MIP solvers (and more).



More information about the Osi-tickets mailing list