<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Vasily,<br>
<br>
If you are using trunk look at Cbc/examples/inc.cpp<br>
<br>
John Forrest<br>
On 08/10/18 13:38, Luís Borges de Oliveira wrote:<br>
</div>
<blockquote type="cite" cite="mid:5BBB4FBB.4000703@siscog.pt">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
Hello Vasily,<br>
<br>
John gave us some hints on how to do this a few years ago,
including the post-processing bits that you're having trouble
with. Here's the e-mail thread: <a class="moz-txt-link-freetext"
href="https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_pipermail_cbc_2016-2DAugust_002029.html&d=DwMD-g&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=vzcNR6TllSgtHyt1Ti-Z95HcMZKWZl6XU6i5wRniABw&s=jfUVsm3wA-cinqOw6QYpdGpb2k200L39iL3QNVtUvJo&e="
moz-do-not-send="true">https://list.coin-or.org/pipermail/cbc/2016-August/002029.html</a><br>
<br>
HTH,<br>
Luís<br>
<br>
<div class="moz-cite-prefix">On 06-10-2018 19:19, Vasily Stepanov
wrote:<br>
</div>
<blockquote
cite="mid:CAKO+nOfMbM+KYH_=8ERp2F4zrRMVPX+ei0AomZ+y6r+67YpBaw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">I'm using callCbc() function, and I would
like to obtain every new solution during the solving
process.</div>
<div>Here are some minimal example</div>
<div dir="ltr"><br>
</div>
<div dir="ltr"> OsiClpSolverInterface osi;<br>
</div>
<div dir="ltr"> CbcModel model(osi);<br>
</div>
<div dir="ltr"> CoinModel build;<br>
</div>
<div> // ... setting up the model.<br>
</div>
<div dir="ltr"> osi.loadFromCoinModel(build);<br>
</div>
<div dir="ltr"> MyEventHandler eventHandler;<br>
</div>
<div dir="ltr">
model.passInEventHandler(&eventHandler);<br>
</div>
<div dir="ltr"> callCbc(args, model);<br>
</div>
<div dir="ltr"><br>
</div>
<div>And later the event method:</div>
<div><br>
</div>
<div dir="ltr"> CbcEventHandler::CbcAction
MyEventHandler::event(CbcEvent whichEvent) {<br>
</div>
<div dir="ltr"> const CbcModel *model = getModel();</div>
<div dir="ltr"><br>
</div>
<div> // Here I can filter out sub trees.</div>
<div dir="ltr"> if (model->parentModel()) {</div>
<div dir="ltr"> return
CbcEventHandler::CbcAction::noAction;</div>
<div dir="ltr"> }</div>
<div dir="ltr"><br>
</div>
<div dir="ltr"> if (whichEvent ==
CbcEventHandler::CbcEvent::solution || whichEvent ==
CbcEventHandler::CbcEvent::heuristicSolution) {</div>
<div dir="ltr">
<div> const double *best_solution =
model->bestSolution();</div>
<div><br>
</div>
</div>
<div> // And here is the best solution found so
far.<br>
</div>
<div> // But still this is not the solution for
my problem, but for the optimised one,<br>
</div>
<div> // with reduced number of columns.</div>
<div> std::vector<double>
original_solution(original_columns_count, 0);<br>
</div>
<div> const int* original_columns =
model->originalColumns();<br>
</div>
<div> for (int i = 0; i <
model->getNumCols(); ++i) {</div>
<div> original_solution[original_columns[i]]
= best_solution[i];</div>
<div> }</div>
<div><br>
</div>
<div> // original_solution will have zeroes where
it should not be.<br>
</div>
<div> }<br>
</div>
<div dir="ltr"> }</div>
<div dir="ltr"><br>
</div>
<div>The question is: How to restore the solution from the
one which has reduced number of columns.</div>
<div>And more general question: How to obtain every new
solution during the solving process in callCbc() method.</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks,</div>
<div>// Vasily</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Cbc mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Cbc@list.coin-or.org" moz-do-not-send="true">Cbc@list.coin-or.org</a>
<a class="moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cbc&d=DwMD-g&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=vzcNR6TllSgtHyt1Ti-Z95HcMZKWZl6XU6i5wRniABw&s=-dUD0KXsukaZPQ5NQ_nUHv8HtkUnM2IN70f6h4UBzEk&e=" moz-do-not-send="true">https://list.coin-or.org/mailman/listinfo/cbc</a>
</pre>
</blockquote>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Cbc mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Cbc@list.coin-or.org">Cbc@list.coin-or.org</a>
<a class="moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cbc&d=DwICAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=vzcNR6TllSgtHyt1Ti-Z95HcMZKWZl6XU6i5wRniABw&s=-dUD0KXsukaZPQ5NQ_nUHv8HtkUnM2IN70f6h4UBzEk&e=">https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cbc&d=DwICAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=vzcNR6TllSgtHyt1Ti-Z95HcMZKWZl6XU6i5wRniABw&s=-dUD0KXsukaZPQ5NQ_nUHv8HtkUnM2IN70f6h4UBzEk&e=</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>