<div dir="ltr"><div dir="ltr"><div><div><div><div><div>Hi,<br><br></div>My mistake, I 
switched the values in the first mail, -4114185.3 is actually the 
optimal solution according to Cplex using barrier solver.<br></div><br><div><i>Barrier - Optimal:  Objective = -4.1141853374e+06<br>
Solution time =    0.27 sec.  Iterations = 23</i><br><br></div>It&#39;s also the same according to Gurobi (using barrier solver too)<br><i>Barrier solved model in 19 iterations and 0.13 seconds<br>Optimal objective -4.11418533e+06</i><br>

<br></div></div><div>And so -182704.15 is the &quot;wrong&quot; optimal value.<br></div><div><br></div>According to your comment I tried to go directlty with the barrier method.<br>I
 didn&#39;t find the documentation really clear about the setAlgo() or 
setSolveType() methods, so I directly called OsiClpSolverInterface-&gt;getModelPtr()-&gt;barrier().<br>
<br></div><div>That worked quite well at the beginning, but later I 
ended up with the message &quot;primal off to infinity&quot; and no solution on 
several problems.<br></div><div>I could fix it by calling primal() 
instead of barrier() (the optimal values are ok, even if the 
performances are now a little slower).<i><br>Clp0006I 2313  Obj -4114185.3</i><br><i><div class="im">Clp0000I Optimal - objective value -4114185.3</div></i><br></div><div>I
 think the only reason it&#39;s working now is because the postsolve is 
disabled if you solve the problem this way (which appears to be just a 
coincidence in this case).<br>
</div><div>So I still think the postsolve may be acting weird in the first case.<br><br></div><div>I
 would be interested to switch the presolve off, but haven&#39;t find any 
methods in the documentation of OsiClpSolverInterface or ClpSimplex to 
do that.<br>
<br></div><div>Vincent<br></div><div><div><div><div><div><br></div></div></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/7/24 William H. Patton <span dir="ltr">&lt;<a href="mailto:pattonwh@comcast.net" target="_blank">pattonwh@comcast.net</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    My guess is that presolve was pretty successful at reducing the
    problem and that the -4114185 was the presolved problem solution<br>
    The inverse presolve steps was then done to recover the base units
    of measure.  <br>
    Note that this Coin0511I<b> After Postsolve,</b> objective
    -182704.15 solution agrees with Cplex solution and so does not seem
    to be <b>visibly false</b>!<br>
    So try again with presolve off.<br>
    Also try the barrier solver. On the sample share2qp.mps it gives a
    slightly different solution than the standard solve.<br>
    <br>
    &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
    <br>
    <br>
    Coin LP version 1.14.4, build Nov 10 2011<br>
    Clp takes input from arguments ( - switches to stdin)<br>
    Enter ? for list of commands or help<br>
    Clp:presolve<br>
    <b>presolve has value on</b><br>
    Clp:import share2qp.mps<br>
    At line 1 NAME          SHARE2B<br>
    At line 2 ROWS<br>
    At line 100 COLUMNS<br>
    At line 482 RHS<br>
    At line 495 QUADOBJ<br>
    Problem SHARE2B has 96 rows, 79 columns and 694 elements<br>
    At line 524 ENDATA<br>
    Model was imported from .\share2qp.mps in 0.002 seconds<br>
    Clp:solve<br>
    <b>Presolve 93 (-3) rows, 79 (0) columns and 691 (-3) elements</b><br>
    <b>Perturbing problem by 0.001 % </b>of 11.662247 - largest nonzero
    change 9.8207092e-0<br>
    05 (% 0.0083883756) - largest zero change 0<br>
    0  Obj 0 Primal inf 145.87618 (5) Dual inf 15.1756 (9)<br>
    58  Obj 0<br>
    Optimal - objective value 0<br>
    0  Obj 1285.1361 Dual inf 1487.2647 (22)<br>
    42  Obj -400.91701<br>
    Optimal - objective value<b> -400.91701</b><br>
    After Postsolve, objective -398.05931, infeasibilities - dual 0 (0),
    primal 0 (0<br>
    )<br>
    Optimal objective<b> -398.059309</b> - 42 iterations time 0.012,
    Presolve 0.00<br>
    Clp:<b>presolve off</b><br>
    Clp:presolve<br>
    <b>presolve has value off</b><br>
    Clp:solve<br>
    0  Obj -400.91701<br>
    Optimal - objective value -400.91701<br>
    Optimal objective -400.9170115 - 0 iterations time 0.002<br>
    Clp:import share2qp.mps<br>
    At line 1 NAME          SHARE2B<br>
    At line 2 ROWS<br>
    At line 100 COLUMNS<br>
    At line 482 RHS<br>
    At line 495 QUADOBJ<br>
    Problem SHARE2B has 96 rows, 79 columns and 694 elements<br>
    At line 524 ENDATA<br>
    Model was imported from .\share2qp.mps in 0.004 seconds<br>
    Clp:solve<br>
    0  Obj 0 Primal inf 145.87619 (5) Dual inf 1.5175601e+011 (11)<br>
    76  Obj 571.60984 Primal inf 1.3459942 (2) Dual inf 7.9222065e+009
    (23)<br>
    152  Obj -400.89999 Dual inf 1.1847668 (4)<br>
    153  Obj -400.91701<br>
    Optimal - objective value -400.91701<br>
    Optimal objective<b> -400.9170115</b> - 153 iterations time 0.012<br>
    Clp:presolve<br>
    presolve has value off<br>
    Clp:<br>
    Clp:<b>barrier</b><br>
    2928 elements in sparse Cholesky, flop count 89374<br>
    0 Primal 1880441 Dual -1.6693328e+008 Complementarity 1.9590728e+008
    - 0 fixed,<br>
    rank 271<br>
    1 Primal 30581.248 Dual -10443941 Complementarity 26978058 - 0
    fixed, rank 271<br>
    2 Primal 1572.4622 Dual -3087057.1 Complementarity 6108433.1 - 0
    fixed, rank 271<br>
    <br>
    3 Primal <a href="tel:310.8557" value="+13108557" target="_blank">310.8557</a> Dual -1459155.3 Complementarity 2507164.8 - 0
    fixed, rank 271<br>
    4 Primal 509.42803 Dual -501381.13 Complementarity 606063.42 - 0
    fixed, rank 271<br>
    <br>
    5 Primal 967.29319 Dual -105866.26 Complementarity 115919.99 - 0
    fixed, rank 271<br>
    <br>
    6 Primal 837.84361 Dual -52400.522 Complementarity 57435.819 - 0
    fixed, rank 271<br>
    <br>
    7 Primal 102.95273 Dual -4147.861 Complementarity 4353.3398 - 0
    fixed, rank 271<br>
    8 Primal -311.19033 Dual -855.93051 Complementarity 551.31766 - 0
    fixed, rank 27<br>
    1<br>
    9 Primal -349.04464 Dual -618.45146 Complementarity 275.98936 - 0
    fixed, rank 27<br>
    1<br>
    10 Primal -377.72515 Dual -436.0772 Complementarity 59.71886 - 0
    fixed, rank 271<br>
    <br>
    11 Primal -393.65235 Dual -415.96868 Complementarity 22.998293 - 0
    fixed, rank 2<br>
    71<br>
    12 Primal -398.79134 Dual -403.89314 Complementarity 5.2467322 - 0
    fixed, rank 2<br>
    71<br>
    13 Primal -400.18831 Dual -401.99952 Complementarity 1.8687018 - 0
    fixed, rank 2<br>
    71<br>
    14 Primal -400.83016 Dual -401.04844 Complementarity 0.22457764 - 0
    fixed, rank<br>
    271<br>
    15 Primal -400.90225 Dual -400.9482 Complementarity 0.045949787 - 13
    fixed, rank<br>
     271<br>
    16 Primal -400.9224 Dual -400.92272 Complementarity 0.00031159724 -
    13 fixed, ra<br>
    nk 271<br>
    17 Primal -400.92254 Dual -400.92254 Complementarity 2.5038999e-006
    - 13 fixed,<br>
    rank 271<br>
    18 Primal -400.92254 Dual -400.92254 Complementarity 1.7307463e-008
    - 50 fixed,<br>
    rank 271<br>
    19 Primal -400.92254 Dual -400.92254 Complementarity 1.5460613e-008
    - 53 fixed,<br>
    rank 271<br>
    Exiting - using solution from iteration 17<br>
    At end primal/dual infeasibilities 0/0.078454371, complementarity
    gap 1.4091511e<br>
    -007, objective -400.92254<br>
    Optimal objective<b> -400.9225413</b> - 19 iterations time 0.042<span class="HOEnZb"><font color="#888888"><br>
    <br>
    <br>
    William</font></span><div class="im"><br>
    <br>
    <div>On 7/24/2013 10:27 AM, Michael Hennebry
      wrote:<br>
    </div>
    <blockquote type="cite">On Mon, 22 Jul 2013, Vincent Devillierse wrote:
      <br>
      <br>
      <blockquote type="cite">I&#39;ve tried to solve a non integer
        quadratic problem with the CLP API.
        <br>
        CLP seems to find the optimal solution, but after that, executes
        a
        <br>
        postsolve phase and the objective value is then totally
        different (and
        <br>
        visibly false).
        <br>
        <br>
        Here is as example of output :
        <br>
        *Clp0006I 1984  Obj -4113764.5 Dual inf 57.100756 (236)
        <br>
        Clp0006I 2058  Obj -4114185.3
        <br>
        Clp0000I Optimal - objective value -4114185.3
        <br>
        Coin0511I After Postsolve, objective -182704.15, infeasibilities
        - dual 0
        <br>
        (0), primal 0 (0)
        <br>
        Clp0032I Optimal objective -182704.1521 - 2058 iterations time
        9.752,
        <br>
        Presolve 0.02*
        <br>
        <br>
        -182704.15 is, according to Cplex the optimal objective value.
        <br>
        I don&#39;t know what * *-4114185.3 corresponds to.
        <br>
      </blockquote>
      <br>
      My guess is that -182704.15 is the optimum to
      <br>
      some linearization of the quadratic objective.
      <br>
      Probably it omits some constant term.
      <br>
      <br>
    </blockquote>
    <br>
  </div></div>

</blockquote></div><br></div>