<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">You raise an interesting point.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">The solver used inside branch and bound
is continually being messed up as cuts are added etc. On entry a
copy continuousSolver_ is cloned. At the end this copy has
variables fixed to give best solution and that is returned.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">The code in CbcModel.cpp is</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix"> delete continuousSolver_;<br>
continuousSolver_ = solver_->clone();<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">It would probably be cleaner to change
this to something like<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix"> delete continuousSolver_;</div>
<div class="moz-cite-prefix"> OsiSolverInterface * tempSolver =
solver_->clone();<br>
</div>
<div class="moz-cite-prefix">
continuousSolver_ = solver_;</div>
<div class="moz-cite-prefix"> solver_ = tempSolver;</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">However that fails.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">I will look into it.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">John Forrest<br>
<div class="moz-cite-prefix"><br>
</div>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 05/01/2019 23:12, Wendel Melo wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAATj=845ooLpKqT=H0fdDLu7oUEKe2cM3vJjV8nNYfKoKMMv=A@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">Dear friends<br>
<br>
I am giving my first steps with CBC to Mixed Integer Linear
Programming (MILP) by means of the C++ API. My current goal is
to turn Cbc one of the MILP solvers supported in Muriqui
Optimizer, a free MINLP solver (<a
href="http://www.wendelmelo.net/software"
moz-do-not-send="true">www.wendelmelo.net/software</a>).<br>
<br>
Due to design questions, I have been constructing an object of
the CbcModel class using an empty OsiSolverInterface object:<br>
<br>
OsiClpSolverInterface clp ;<br>
CbcModel *model = new (std::nothrow) CbcModel(clp);<br>
<br>
After that, I have been set the coefficients of my MILP
problem by means of the pointer returned by the method
CbcModel::solver, for example:<br>
<br>
OsiSolverInterface *solver = model->solver()<br>
<br>
solver->addCol(0, NULL, NULL, 0.0, 1000.0, 1.0);<br>
<br>
I am performing in this way to avoid delay copping the
OsiSolverInterface object in the CbcModel constructor since I
need to solve a sequence where the same MILP problem has to be
solved several times just changing some parameters.<br>
<br>
But I have been getting some problems. After calling method
CbcModel::branchAndBound by the second time, the pointer
returned by CbcModel::solver is getting a different value of
the previous call, for example:<br>
<br>
std::cout << "before BB solver pointer: " <<
model->solver() << std::endl;<br>
model->branchAndBound()<br>
std::cout << "after BB solver pointer: " <<
model->solver() << std::endl;<br>
<br>
The code above prints:<br>
<br>
before BB solver pointer: 0x1455a628<br>
after BB solver pointer: 0x14887f88<br>
<br>
So, we can see the solver pointer in CbcModel object was
changed. Why is it happening? I believe creating new solver
objects is bad because increase the computations. Is there a
way to avoid the changing of solver object pointer? Are there
other methods in CbcModel that can provoke the changing of the
solver pointer?<br>
<br>
Thanks in advanced<br>
<br>
Best regards<br>
<br>
<br>
Wendel Melo<br>
<a href="http://www.wendeldelo.net" moz-do-not-send="true">www.wendeldelo.net</a><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-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>
<p><br>
</p>
</body>
</html>