[Coin-lpsolver] primal/dual tolerance

John J Forrest jjforre at us.ibm.com
Mon Nov 22 09:50:57 EST 2004




Matt,

I was unable to reproduce the error but I would guess it is a tolerance
issue.  Osi does not provide for reporting the situation where the scaled
problem is optimal but when the scaling factors are taken off the problem
is slightly infeasible.  Clp allows that and sets the primary status to say
optimal and a secondary status value of 2.  This could be what is
happening.  What happens if you switch off scaling?

John


                                                                           
             Matthew Galati                                                
             <magh at lehigh.edu>                                             
             Sent by:                                                   To 
             coin-lpsolver-adm                                             
             in at www-124.southb         coin-lpsolver at www-124.southbury.usf 
             ury.usf.ibm.com           .ibm.com                            
                                                                        cc 
                                                                           
             11/21/2004 02:47                                              
             PM                                                            
                                                                           
                                                                           
                                                                   Subject 
                                       [Coin-lpsolver] primal/dual         
                                       tolerance                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hi CLP,

Is this a bug, or just a tolerance issue?

Solving the initial LP relaxation for dsbmip (from MIPLIB), using
default CLP, the LP solution violates three constraints at 1.0e-5.

row 462, lhs: -0.0000143764, LB: 0.0000000000
ind: 582, el: -1.0000000000, sol: 0.0000143764, sum: -0.0000143764
ind: 1107, el: -1.0000000000, sol: 0.0000000000, sum: -0.0000143764
ind: 1108, el: -1.0000000000, sol: 0.0000000000, sum: -0.0000143764
ind: 1736, el: 16560.0000000000, sol: 0.0000000000, sum: -0.0000143764

row 491, lhs: -0.0000143764, LB: 0.0000000000
ind: 666, el: -1.0000000000, sol: 0.0000000000, sum: 0.0000000000
ind: 826, el: -1.0000000000, sol: 0.0000143764, sum: -0.0000143764
ind: 1195, el: -1.0000000000, sol: 0.0000000000, sum: -0.0000143764
ind: 1196, el: -1.0000000000, sol: 0.0000000000, sum: -0.0000143764
ind: 1772, el: 16560.0000000000, sol: 0.0000000000, sum: -0.0000143764

row 555, lhs: -0.0000143764, LB: 0.0000000000
ind: 750, el: -1.0000000000, sol: 0.0000000000, sum: 0.0000000000
ind: 902, el: -1.0000000000, sol: 0.0000143764, sum: -0.0000143764
ind: 1283, el: -1.0000000000, sol: 0.0000000000, sum: -0.0000143764
ind: 1284, el: -1.0000000000, sol: 0.0000000000, sum: -0.0000143764
ind: 1836, el: 16560.0000000000, sol: 0.0000000000, sum: -0.0000143764

If I set the primal/dual tolerance to 1.0e-10, it satisfies all
constraints at 1.0e-5.

The code I used is below:

---------------------------------------------------------------------------------------

int main(int argc, char ** argv){
  OsiClpSolverInterface si;
  si.readMps("dsbmip.mps");
  si.messageHandler()->setLogLevel(20);
  /*si.setDblParam(OsiPrimalTolerance, 1.0e-10);
    si.setDblParam(OsiDualTolerance, 1.0e-10);*/

  //si.resolve();
  si.initialSolve();
  const double * sol = si.getColSolution();

  const CoinPackedMatrix * rowA  = si.getMatrixByRow();
  const double           * rowLB = si.getRowLower();
  const double           * rowUB = si.getRowUpper();
  double                 * lhs = new double[si.getNumRows()];

  rowA->times(sol, lhs);
  for(int r = 0; r < si.getNumRows(); r++){
    if((lhs[r] + 1.0e-5) < rowLB[r]){
      printf( "\nrow %d, lhs: %12.10f, LB: %12.10f", r, lhs[r], rowLB[r] );

      //check by hand
      const CoinShallowPackedVector & row = rowA->getVector(r);
      const int    * ind = row.getIndices();
      const double * els = row.getElements();
      double sum = 0.0;
      for(int j = 0; j < row.getNumElements(); j++){
        sum += sol[ind[j]] * els[j];
        if((fabs(els[j]) > 1.0e-20) || (fabs(sol[ind[j]]) > 1.0e-20))
          printf("\nind: %d, el: %12.10f, sol: %12.10f, sum: %12.10f",
                 ind[j], els[j], sol[ind[j]], sum);
      }

    }
    if((lhs[r] - 1.0e-5) > rowUB[r]){
      printf( "\nrow %d, lhs: %12.10f, UB: %12.10f", r, lhs[r], rowUB[r] );
    }
  }
}

---------------------------------------------------------------------------------------

[magala at ordlnx2 TEST]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --disable-libunwind-exceptions --with-system-zlib
--enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)


Thanks.

--
Matthew Galati


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






More information about the Clp mailing list