[Coin-lpsolver] primal/dual tolerance

John J Forrest jjforre at us.ibm.com
Mon Nov 22 10:47:17 EST 2004




Matt,

Scaling has to be turned off with a hint to Osi so

si.setHintParam(OsiDoScale,false,OsiHintTry);

John


                                                                           
             magh at lehigh.edu                                               
             Sent by:                                                      
             coin-lpsolver-adm                                          To 
             in at www-124.southb                                             
             ury.usf.ibm.com           coin-lpsolver at www-124.southbury.usf 
                                       .ibm.com                            
                                                                        cc 
             11/22/2004 10:31                                              
             AM                                                            
                                                                           
                                                                           
                                                                           
                                                                   Subject 
                                       Re: [Coin-lpsolver] primal/dual     
                                       tolerance                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hi John,

Yes that does look like the case.

printf("\nCLP problem status: %d, second status: %d\n",
              si.getModelPtr()->problemStatus(),
              si.getModelPtr()->secondaryStatus());
CLP problem status: 0, second status: 2

2 - scaled problem optimal - unscaled problem has primal infeasibilities

I tried turning off scaling - but got the same results:
si.getModelPtr()->scaling(0);

Is that the right way to turn if off?

I compiled Clp with OptLevel=-O.

My machine info:

[magala at ordlnx2 TEST]$ uname -a
Linux 2.6.5-1.358smp #1 SMP Sat May 8 09:25:36 EDT 2004 i686 i686 i386
GNU/Linux

[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,
Matt



>
>
>
>
> 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
>
>
>
> _______________________________________________
> Coin-lpsolver mailing list
> Coin-lpsolver at www-124.ibm.com
> http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-lpsolver
>




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
_______________________________________________
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