<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">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">www.wendeldelo.net</a><br></div></div>