<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    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://list.coin-or.org/pipermail/cbc/2016-August/002029.html">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">Cbc@list.coin-or.org</a>
<a class="moz-txt-link-freetext" href="https://list.coin-or.org/mailman/listinfo/cbc">https://list.coin-or.org/mailman/listinfo/cbc</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>