<br><font size=2 face="sans-serif">Jan,</font>
<br>
<br><font size=2 face="sans-serif">I think the trouble is that OsiClp trusts
the current solution as well as the basis. In Primal it will use
the current solution and basis, which will explain the behavior in Primal.
In Dual, I am not sure what the problem is. Presolve
may make a small difference, but should not make a major difference. Clp
itself has more flexibility.</font>
<br>
<br><font size=2 face="sans-serif">Is it OK with you to use getColSolution(0
and setColSolution()?</font>
<br>
<br><font size=2 face="sans-serif">John Forrest</font>
<br>
<br>
<br>
<table width=100%>
<tr>
<td><img src=cid:_1_0AB602100AB5FE2800555F78852574F3>
<td width=100%>
<table width=100%>
<tr valign=top>
<td width=100%><font size=2 face="sans-serif"><b>[Osi] OsiClp WarmStarts</b></font></table>
<br>
<table width=100%>
<tr>
<td><font size=2 color=#e26200 face="sans-serif"><b>Goossens Jan-Willem
</b></font>
<td><font size=2 color=#8f8f8f face="sans-serif">to:</font>
<td><font size=2 face="sans-serif">osi@list.coin-or.org</font>
<td>
<div align=right><font size=1 face="sans-serif">10/31/2008 06:48 AM</font></div></table>
<br>
<table width=100%>
<tr>
<td>
<table width=100%>
<tr>
<td><font size=2 color=#8f8f8f face="sans-serif">Sent by:</font>
<td width=100%><font size=2 color=#e26200 face="sans-serif"><b>osi-bounces@list.coin-or.org</b></font></table>
<br>
<td>
<div align=right></div></table>
<br></table>
<br>
<br>
<hr>
<br>
<br>
<br><font size=2 color=#004080 face="sans-serif">Hi,</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 color=#004080 face="sans-serif">I have some questions
about WarmStarts using OsiClp. </font>
<br><font size=2 color=#004080 face="sans-serif">I'm solving pure LPs and
I tried to recreate my real problem using miplib 3.0s "p0548"
(See </font><a href=http://www.caam.rice.edu/~bixby/miplib/miplib3.html><font size=2 color=blue face="sans-serif"><u>http://www.caam.rice.edu/~bixby/miplib/miplib3.html</u></font></a><font size=2 color=#004080 face="sans-serif">)</font>
<br><font size=2 color=#004080 face="sans-serif">See below for code and
output.</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 color=#004080 face="sans-serif">Basically, I (1) solve
the problem, store a warm start, (2) change the objective and resolve,
and (3) restore original objecte, load warmstart and resolve.</font>
<br><font size=2 color=#004080 face="sans-serif">I was expecting the step
(3) to take zero iterations. However, this is not (always) the case: In
this test problem, </font>
<br><font size=2 color=#004080 face="sans-serif">Test run 1) if I do NOT
set hints concerning DoDualIn*, then indeed (3) takes zero iterations.</font>
<br><font size=2 color=#004080 face="sans-serif">Test run 2) but if I set
HintTry for these to false (so use primal), then (3) reoptimises (see end
of email)</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 color=#004080 face="sans-serif">In my real instances the
(3) resolve takes a *lot* of iterations.</font>
<br><font size=2 color=#004080 face="sans-serif">Note that this test problem
doesn’t completely represent my real problem: the real instances show
this behaviour even <i>without</i> the DoDual = false settings, but the
resulting iterations are the same.</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 color=#004080 face="sans-serif">What could be the cause
for these reoptimizations?</font>
<br><font size=2 color=#004080 face="sans-serif">A) different algorithm
after warmstart compared to solve warmstart was based on?</font>
<br><font size=2 color=#004080 face="sans-serif">B) presolve chooses to
remove different rows/columns in resolve?</font>
<br><font size=2 color=#004080 face="sans-serif">C) something else?</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 color=#004080 face="sans-serif">Or is this simply not
what the warmstarts are for?</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 color=#004080 face="sans-serif">Any help would be appreciated.</font>
<br><font size=2 color=#004080 face="sans-serif">Regards,</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 color=#004080 face="sans-serif">Jan-Wilem Goossens</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 color=#004080 face="sans-serif">————————————————————--</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 color=#004080 face="sans-serif">Here is the test problem</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 face="Courier New"> OsiClpSolverInterface
model;</font>
<br><font size=2 face="Courier New"> </font>
<br><font size=2 face="Courier New"> model.setHintParam(OsiHintParam::OsiDoDualInInitial,
</font><font size=2 color=blue face="Courier New">false</font><font size=2 face="Courier New">);
</font><font size=2 color=#008000 face="Courier New">// comment out</font>
<br><font size=2 face="Courier New"> model.setHintParam(OsiHintParam::OsiDoDualInResolve,
</font><font size=2 color=blue face="Courier New">false</font><font size=2 face="Courier New">);
</font><font size=2 color=#008000 face="Courier New">// comment out</font>
<br><font size=2 face="Courier New"> model.setHintParam(OsiHintParam::OsiDoPresolveInInitial);</font>
<br><font size=2 face="Courier New"> model.setHintParam(OsiHintParam::OsiDoPresolveInResolve);</font>
<br><font size=2 face="Courier New"> </font>
<br><font size=2 face="Courier New"> </font><font size=2 color=blue face="Courier New">int</font><font size=2 face="Courier New">
status = model.readMps(</font><font size=2 color=#a11f12 face="Courier New">"p0548.mps"</font><font size=2 face="Courier New">,
</font><font size=2 color=blue face="Courier New">true</font><font size=2 face="Courier New">,
</font><font size=2 color=blue face="Courier New">false</font><font size=2 face="Courier New">);</font>
<br><font size=2 face="Courier New"> </font><font size=2 color=blue face="Courier New">int</font><font size=2 face="Courier New">
n = model.getNumCols();</font>
<br><font size=2 face="Courier New"> </font><font size=2 color=blue face="Courier New">for</font><font size=2 face="Courier New">
(</font><font size=2 color=blue face="Courier New">int</font><font size=2 face="Courier New">
i = 0; i < n; i++) model.setContinuous(i); </font><font size=2 color=#008000 face="Courier New">//
change to LP</font>
<br><font size=2 face="Courier New"> </font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#008000 face="Courier New">//
(1) do initial solve of original problem, and store warm start info</font>
<br><font size=2 face="Courier New"> model.initialSolve();</font>
<br><font size=2 face="Courier New"> CoinWarmStart
*warmStart = model.getWarmStart();</font>
<br><font size=2 face="Courier New"> </font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#008000 face="Courier New">//
(2) change the objective function and resolve</font>
<br><font size=2 face="Courier New"> </font><font size=2 color=blue face="Courier New">const</font><font size=2 face="Courier New">
</font><font size=2 color=blue face="Courier New">double</font><font size=2 face="Courier New">
* objCoefs = model.getObjCoefficients();</font>
<br><font size=2 face="Courier New"> </font><font size=2 color=blue face="Courier New">double</font><font size=2 face="Courier New">
* oldCoefs = </font><font size=2 color=blue face="Courier New">new</font><font size=2 face="Courier New">
</font><font size=2 color=blue face="Courier New">double</font><font size=2 face="Courier New">[n];</font>
<br><font size=2 face="Courier New"> </font><font size=2 color=blue face="Courier New">for</font><font size=2 face="Courier New">
(</font><font size=2 color=blue face="Courier New">int</font><font size=2 face="Courier New">
i = 0; i < n; i++) oldCoefs[i] = objCoefs[i];</font>
<br><font size=2 face="Courier New"> </font><font size=2 color=blue face="Courier New">for</font><font size=2 face="Courier New">
(</font><font size=2 color=blue face="Courier New">int</font><font size=2 face="Courier New">
i = 0; i < n; i++) model.setObjCoeff(i,1.0);</font>
<br><font size=2 face="Courier New"> </font>
<br><font size=2 face="Courier New"> model.resolve();</font>
<br><font size=2 face="Courier New"> </font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#008000 face="Courier New">//
(3) restore the original problem, and load warm start</font>
<br><font size=2 face="Courier New"> model.setObjective(oldCoefs);</font>
<br><font size=2 face="Courier New"> model.setWarmStart(warmStart);</font>
<br><font size=2 face="Courier New"> model.resolve();</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 color=#004080 face="sans-serif">OUTPUT:</font>
<br><font size=2 color=#004080 face="sans-serif"><b>Test run 1, with commented
out:</b></font>
<br><font size=2 face="Courier New"> // model.setHintParam(OsiHintParam::OsiDoDualInInitial,
</font><font size=2 color=blue face="Courier New">false</font><font size=2 face="Courier New">);
</font><font size=2 color=#008000 face="Courier New">// comment out</font>
<br><font size=2 face="Courier New"> // model.setHintParam(OsiHintParam::OsiDoDualInResolve,
</font><font size=2 color=blue face="Courier New">false</font><font size=2 face="Courier New">);
</font><font size=2 color=#008000 face="Courier New">// comment out</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#008000 face="Courier New">//
(1) do initial solve of original problem, and store warm start info</font>
<br><font size=2 color=#004080 face="sans-serif">Coin0506I Presolve 163
(-13) rows, 543 (-5) columns and 1561 (-150) elements</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 0 Obj 0
Primal inf 38.8018 (12)</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 95 Obj
315.255</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0000I Optimal - objective
value 315.255</font>
<br><font size=2 color=#004080 face="sans-serif">Coin0511I After Postsolve,
objective 315.255, infeasibilities - dual 0 (0), primal 0 (0)</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 0 Obj 315.255</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 0 Obj 315.255</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0000I Optimal - objective
value 315.255</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#008000 face="Courier New">//
(2) change the objective function and resolve</font>
<br><font size=2 color=#004080 face="sans-serif">Coin0506I Presolve 165
(-11) rows, 543 (-5) columns and 1579 (-132) elements</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 0 Obj 59.3381
Primal inf 0.314674 (1) Dual inf 161381 (290)</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 103 Obj
16.571 Primal inf 8.57907 (29)</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 165 Obj
26.1669</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0000I Optimal - objective
value 26.1669</font>
<br><font size=2 color=#004080 face="sans-serif">Coin0511I After Postsolve,
objective 26.1669, infeasibilities - dual 0 (0), primal 0 (0)</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#008000 face="Courier New">//
(3) restore the original problem, and load warm start</font>
<br><font size=2 color=#004080 face="sans-serif">Coin0506I Presolve 163
(-13) rows, 543 (-5) columns and 1561 (-150) elements</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 0 Obj 366.255
Primal inf 30.9296 (2) Dual inf 304.123 (2)</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0000I Optimal - objective
value 315.255</font>
<br><font size=2 color=#004080 face="sans-serif">Coin0511I After Postsolve,
objective 315.255, infeasibilities - dual 0 (0), primal 0 (0)</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 color=#004080 face="sans-serif"><b>Test run 2, with:</b></font>
<br><font size=2 face="Courier New"> model.setHintParam(OsiHintParam::OsiDoDualInInitial,
</font><font size=2 color=blue face="Courier New">false</font><font size=2 face="Courier New">);
</font>
<br><font size=2 face="Courier New"> model.setHintParam(OsiHintParam::OsiDoDualInResolve,
</font><font size=2 color=blue face="Courier New">false</font><font size=2 face="Courier New">);
</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#008000 face="Courier New">//
(1) do initial solve of original problem, and store warm start info</font>
<br><font size=2 color=#004080 face="sans-serif">Coin0506I Presolve 163
(-13) rows, 543 (-5) columns and 1561 (-150) elements</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0028I Crash put 44
variables in basis, 0 dual infeasibilities</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 0 Obj 0
Primal inf 38.8018 (12) Dual inf 5.62868e+012 (120)</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 132 Obj
20103.2 Primal inf 1.08159 (1) Dual inf 1.10445e+011 (193)</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 289 Obj
345.667 Dual inf 627.385 (26)</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 316 Obj
315.255</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0000I Optimal - objective
value 315.255</font>
<br><font size=2 color=#004080 face="sans-serif">Coin0511I After Postsolve,
objective 315.255, infeasibilities - dual 0 (0), primal 0 (0)</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 0 Obj 315.255</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 0 Obj 315.255</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0000I Optimal - objective
value 315.255</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#008000 face="Courier New">//
(2) change the objective function and resolve</font>
<br><font size=2 color=#004080 face="sans-serif">Coin0506I Presolve 165
(-11) rows, 543 (-5) columns and 1579 (-132) elements</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 0 Obj 69.5868
Dual inf 38838.5 (125)</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0006I 94 Obj
26.1669</font>
<br><font size=2 color=#004080 face="sans-serif">Clp0000I Optimal - objective
value 26.1669</font>
<br><font size=2 color=#004080 face="sans-serif">Coin0511I After Postsolve,
objective 26.1669, infeasibilities - dual 0 (0), primal 0 (0)</font>
<br><font size=2 color=#004080 face="sans-serif">Coin0506I Presolve 163
(-13) rows, 543 (-5) columns and 1561 (-150) elements</font>
<br><font size=2 color=#004080 face="sans-serif"> </font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#008000 face="Courier New">//
(3) restore the original problem, and load warm start</font>
<br><font size=2 color=#004080 face="sans-serif"><b>Clp0006I 0 Obj
1817.67 Dual inf 3514.68 (6)</b></font>
<br><font size=2 color=#004080 face="sans-serif"><b>Clp0029I End of values
pass after 37 iterations</b></font>
<br><font size=2 color=#004080 face="sans-serif"><b>Clp0006I 37 Obj
1817.67 Dual inf 3515.85 (5)</b></font>
<br><font size=2 color=#004080 face="sans-serif"><b>Clp0006I 170 Obj
336.741 Dual inf 20.3286 (24)</b></font>
<br><font size=2 color=#004080 face="sans-serif"><b>Clp0006I 202 Obj
315.255</b></font>
<br><font size=2 color=#004080 face="sans-serif"><b>Clp0000I Optimal -
objective value 315.255</b></font>
<br><font size=2 color=#004080 face="sans-serif"><b>Coin0511I After Postsolve,
objective 315.255, infeasibilities - dual 0 (0), primal 0 (0)</b></font>
<br><font size=2 color=#004080 face="sans-serif"> </font><tt><font size=2>_______________________________________________<br>
Osi mailing list<br>
Osi@list.coin-or.org<br>
http://list.coin-or.org/mailman/listinfo/osi<br>
</font></tt>
<br>