[Coin-discuss] OsiSolverInterface use and in particular OsiClpSolverInterface

JP Fasano jpfasano at us.ibm.com
Mon Dec 16 07:38:59 EST 2002





Vivian,

>In particular the third one seems to be supported by the implementation of

>at least Cpx, Glpk but not by the Clp (the probleme seems that before
>calling loadProblem the ClpModel class seems not to be initialized leading

>to a casscade of memory access violations.
This sounds to me like Clp provides for this interface but it fails to work
correctly.

>I will be glad if we could read somewhere the list of methodes to set or
>modify a problem that should be supported by all the interfaces to be able

>to write cross solver code (because for the moment it's nearly impossible
>we need to test the code for each solver, debug it and even write solver
>specific code).
I would suggest that the Osi UnitTest program (COIN\Osi\Test\unitTest.cpp)
is the place to read what works.
The solver interfaces are supposed to be passing this test.
I believe that Clp passes this test, so I would say that the test program
is lacking.
(Clp passed last time I ran the test about a week or two ago).
Can you enhance this test to so it captures the sequence that is causing
Clp to fail?
That way it will exactly be known what is failing and a trouble spot will
be captured in the testing process for future use.

JP Fasano
jpfasano at us.ibm.com
(914)945-1324  (tie line 862-1324)
COIN www.coin-or.org


                                                                                                                                                     
                      Vivian De Smedt <vivian at vdesmedt.com>                                                                                          
                      Sent by:                                     To:       coin-discuss at www-124.southbury.usf.ibm.com                              
                      coin-discuss-admin at www-124.southbury.        cc:                                                                               
                      usf.ibm.com                                  Subject:  [Coin-discuss] OsiSolverInterface use and in particular                 
                                                                    OsiClpSolverInterface                                                            
                                                                                                                                                     
                      12/15/2002 12:53 PM                                                                                                            
                      Please respond to coin-discuss                                                                                                 
                                                                                                                                                     
                                                                                                                                                     



Dear Osi,

There is many ways to specify an lp/mip problem through the
OsiSolverInterface:
You can
  - use one of the many guts of loadProblem,
  - use readMps api,
  - add variables using addCol then constraints using addRow,
  - call addRow then call setObjCoeff, setColLower, setColUpper
  - call addRow then call setObjCoeff, setColBounds
  - ...

Some are supported by the OsiSolverInterface interface of some solvers some

not.

In particular the third one seems to be supported by the implementation of
at least Cpx, Glpk but not by the Clp (the probleme seems that before
calling loadProblem the ClpModel class seems not to be initialized leading
to a casscade of memory access violations.

I temporaly solve the problem by initalizing the instance with a code like:

             double dEmpty = 0;
             int iEmpty = 0;
             s->loadProblem(0, 0, &iEmpty, &iEmpty, &dEmpty, &dEmpty,
&dEmpty, &dEmpty,
&dEmpty, &dEmpty);

I will be glad if we could read somewhere the list of methodes to set or
modify a problem that should be supported by all the interfaces to be able
to write cross solver code (because for the moment it's nearly impossible
we need to test the code for each solver, debug it and even write solver
specific code).

Vivian De Smedt.

PS:

maybe in ClpModel.cpp could we replace

double * resizeDouble(double * array , int size, int newSize, double fill)
{
   if (array&&size!=newSize) {
     int i;
     double * newArray = new double[newSize];
     memcpy(newArray,array,min(newSize,size)*sizeof(double));
     delete [] array;
     array = newArray;
     for (i=size;i<newSize;i++)
       array[i]=fill;
   }
   return array;
}

by:

double * resizeDouble(double * array , int size, int newSize, double fill)
{
   if (size!=newSize) {
     int i;
     double * newArray = new double[newSize];
     memcpy(newArray,array,min(newSize,size)*sizeof(double));
     delete [] array;
     array = newArray;
     for (i=size;i<newSize;i++)
       array[i]=fill;
   }
   return array;
}

to allows deferencing the result of an array that were resized.

_______________________________________________
Coin-discuss mailing list
Coin-discuss at www-124.ibm.com
http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-discuss






More information about the Coin-discuss mailing list