[Coin-lpsolver] Reoptimizing LP after adding constraints

Luís Henrique Sacchi sacchi at densis.fee.unicamp.br
Wed Apr 5 15:10:38 EDT 2006


I am a newcomer OSI/CLP user and I have a doubt about adding constraints to an already solved LP.  I have mixed two sample codes:  One of them I found at François Margot homepage and the other one is the COIN/Examples/Osi/build.cpp file.

I intend to solve a simple LP problem, add a new constraint that cut off the optimal solution and ask the solver to reoptimize the problem using dual simplex algorithm, since the current basic solution is infeasible after applying the new constraint.

         

If I try to solve the problem:

 

Min z =  -x1 -x2 

s.t.

x1 <= 2

x2 <= 2

x1, x2 >= 0

 

I get the following expected tableau, printed by the printOptTab() function:

 

   x1    x2  |    s1    s2  |

 1.00  0.00  |  1.00  0.00  |  2.00

 0.00  1.00  |  0.00  1.00  |  2.00

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

 0.00  0.00  | -1.00 -1.00  | -4.00

 

 

When I add the third constraint:

3x1 + x2 <= 3,

the optimal tableau printed is:

 

Optimal Tableau:

   x1    x2  |    s1    s2    s3  |

 1.00  0.00  |  1.00  0.00  0.00  |  0.33

 0.00  1.00  |  0.00  1.00  0.00  |  2.00

 0.00  0.00  | -3.00 -1.00  1.00  |  0.00

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

-0.00 -0.00  |  0.00 -0.67 -0.33  | -2.33

 

Whereas the expected output is

 

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

Optimal Tableau:

   x1    x2  |    s1    s2    s3  |

 0.00  0.00  |  1.00  0.33 -0.33  |  1.67

 0.00  1.00  |  0.00  1.00  0.00  |  2.00

 1.00  0.00  |  0.00 -0.33  0.33  |  0.33

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

 0.00 -0.00  |  0.00 -0.67 -0.33  | -2.33

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

 

Is something wrong in this kind of coding? 

 

/************************************/

/*     -INF  <= 3x1 + x2 <= 3       */

/************************************/ 

    si->disableFactorization();

    CoinPackedVector row2;

    row2.insert(0,3.0);

    row2.insert(1, 1.0);

    si->addRow(row2,-1.0*si->getInfinity(),3);

    si->writeLp("example2");

    si->enableFactorization();

    si->resolve();

 

Is it forbidden to reoptimize the LP problem after adding new constraints? I suppose not since dual reoptimization is a must in Branch&Cut approaches.

 

And finally, I have another doubt. After solving a LP problem can I change a coefficient cost of the objective function and reoptimize the problem using primal reoptimization?

 

I attached the whole project for better analysis.

 

Thank you in advance,

 

 

Luis H Sacchi

 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/clp/attachments/20060405/2fec98a4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proj.zip
Type: application/x-zip-compressed
Size: 2430 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/clp/attachments/20060405/2fec98a4/attachment.bin>


More information about the Clp mailing list