Thanks All.<br><br>This <br>   const char *args[] = {&quot;Cbc_Test&quot;, &quot;-solve&quot;, &quot;-quit&quot;};<br>   CbcModel model(*solver.getRealSolverPtr());<br>   CbcMain0(model);<br><div class="im">   CbcMain1(3, args, model);<br>

<br>seems to work much better than OsiCbc::branchAndBound( ) !<br>
<br>This is a very odd construction. Maybe I asked this before, but why don&#39;t we just have a CbcModel::model.solve( ) method? Why is there not some simple API like this for solving a MILP with CBC?<br><br>Moreover - for OSI users, why don&#39;t we have an OsiCbc::solveMilp( ) method? The base class can have solveMilp( ) virtual and for those OsiXxx&#39;s that can solve MILPs (OsiCpx, OsiXpr, OsiCbc, ...), it gets derived, else it returns an error. I understand the reluctance to add MILP support in OSI when OSI2 was being discussed -- but that was many years ago. As an &quot;interim&quot; fix, can we at least make OSI work for MILPs - since many people are already using them to define and (try to) solve MILPs.<br>

<br>Thanks,<br>Matt<br></div><br><br><div class="gmail_quote"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<div class="im"><br>
&gt; I have a similar problem, which you helped me with previously:<br>
&gt; <a href="http://list.coin-or.org/pipermail/cbc/2008-February/thread.html#99" target="_blank">http://list.coin-or.org/pipermail/cbc/2008-February/thread.html#99</a><br>
&gt;<br>
&gt; Just a quick summary: I have a model in OSI and need to get solution<br>
&gt; there as well:<br>
&gt;   OsiCbcSolverInterface solver;<br>
<br>
</div>Better use &quot;OsiClpSolverInterface solver;&quot; here.<br>
I think Cbc do some special stuff if the instance comes as an OsiClp object.<br>
<div class="im"><br>
&gt;   const char *args[] = {&quot;Cbc_Test&quot;, &quot;-solve&quot;, &quot;-quit&quot;};<br>
&gt;<br>
&gt; One option is to create a new CbcModel and solve it:<br>
&gt;   CbcModel model(*solver.getRealSolverPtr());<br>
&gt;   CbcMain0(model);<br>
&gt;   CbcMain1(3, args, model);<br>
&gt; This works fine, but how do I get copy the solution to the OSI object?<br>
&gt; (I tried solver-&gt;getModelPtr()-&gt;setBestSolution and<br>
&gt; solver-&gt;getModelPtr()-&gt;setObjValue, using the values from model, but it<br>
&gt; does not work - it does not update the &quot;best possible solution&quot;, so even<br>
&gt; if solver knows about the optimal solution, it does not know it is<br>
&gt; optimal..)<br>
<br>
</div>CbcModel creates a copy of the Osi interface that you give to it and<br>
works on this one. So maybe using the OsiSolverInterface* from<br>
model.solver() will work?<br>
Or you fix integer variables to the solution in your Osi, try to copy<br>
the basis from model.solver() as well, and do a resolve() in your Osi.<br>
<div class="im"><br>
&gt; The other option is to work directly on the CbcModel of the OSI object:<br>
&gt;   CbcMain0(*solver.getModelPtr());<br>
&gt;   CbcMain1(3, args, *solver.getModelPtr());<br>
&gt; In works fine in the sense that solver now has the optimal solution (and<br>
&gt; knows it is optimal).<br>
&gt; The problem with this version is that the CbcMain1 function takes more<br>
&gt; than 3 times longer and in the first option - any idea why and how to<br>
&gt; fix it?<br>
<br>
</div>Maybe the way the CbcModel is setup in OsiCbc is different.<br>
<div class="im"><br>
Stefan<br>
<br>
--<br>
Stefan Vigerske<br>
Humboldt University Berlin, Numerical Mathematics<br>
<a href="http://www.math.hu-berlin.de/%7Estefan" target="_blank">http://www.math.hu-berlin.de/~stefan</a><br>
<br>
</div><div><div></div><div class="h5">_______________________________________________<br>
Coin-discuss mailing list<br>
<a href="mailto:Coin-discuss@list.coin-or.org">Coin-discuss@list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/coin-discuss" target="_blank">http://list.coin-or.org/mailman/listinfo/coin-discuss</a><br>
</div></div></blockquote></div><br>