<div dir="ltr">Hi John,<div><br></div><div>That approach is certainly feasible, although I'd like keep in line with other commercial and open-source interfaces and make these modification routines "just work". What could be done is to always make a copy of the model before a solve, pick out the solution information, and throw away the dirty solved model. Unless there are any objections to the overhead of temporarily having multiple copies of the model around, I'll play around with this approach.</div>
<div><br></div><div>Thanks,</div><div>Miles</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 26, 2014 at 11:57 AM, John Forrest <span dir="ltr"><<a href="mailto:john.forrest@fastercoin.com" target="_blank">john.forrest@fastercoin.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Miles,<br>
<br>
Having solved a model the CbcModel is much modified e.g. average
change in objective when branching on integer variables, value of
best possible solution etc. Also a copy of solver at various
times has been solved. <br>
<br>
What is wrong with<br>
<br>
Cbc_Model * baseModel = Cbc_newModel();<br>
<br>
do what you like to build most of model<br>
<br>
while (wanted) {<br>
Cbc_Model * model = Cbc_clone(baseModel);<br>
<br>
adjust model <br>
<br>
Cbc_solve(model);<br>
<br>
use results<br>
<br>
Cbc_deleteModel(model);<br>
}<br>
<br>
Cbc_deleteModel(baseModel);<br>
<br>
If this is approximately what you want then it can be fine tuned.<br>
<br>
John Forrest<div><div class="h5"><br>
<br>
<br>
On 26/05/14 02:35, Miles Lubin wrote:<br>
</div></div></div>
<blockquote type="cite"><div><div class="h5">
<div dir="ltr">Hi all,
<div><br>
</div>
<div>I'm looking at supporting modification of the problem data
after solve in the C interface and have come across some
surprising behavior. </div>
<div><br>
</div>
<div>After solving using a CbcModel (using CbcMain1), the column
lower bounds (from CbcModel::getColLower) are changed to equal
the value of the optimal solution. I.e., a binary variable set
at 1 in the optimal solution will have a reported lower bound
of 1. I assume this is because the bounds are returned from
the internal Clp model. </div>
<div><br>
</div>
<div>Similarly, calling CbcModel::solver()->setColLower()
after solve to modify bounds doesn't seem to have any effect
on subsequent resolves (again using CbcMain1).</div>
<div><br>
</div>
<div>Is there a proper way to access and modify the original
problem data after a solve to avoid recreating the model from
scratch? If not, I'll simply not expose this functionality in
the C interface. Obviously one shouldn't expect to efficiently
hot-start the next MIP solve, but being able to modify a model
could be convenient for the user when solving a sequence of
related MIPs.<br>
</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Miles</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><pre>_______________________________________________
Cbc mailing list
<a href="mailto:Cbc@list.coin-or.org" target="_blank">Cbc@list.coin-or.org</a>
<a href="http://list.coin-or.org/mailman/listinfo/cbc" target="_blank">http://list.coin-or.org/mailman/listinfo/cbc</a>
</pre>
</blockquote>
<br>
</div>
<br>_______________________________________________<br>
Cbc mailing list<br>
<a href="mailto:Cbc@list.coin-or.org">Cbc@list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/cbc" target="_blank">http://list.coin-or.org/mailman/listinfo/cbc</a><br>
<br></blockquote></div><br></div>