[Cbc] Question regarding Handler

Alexis Guigue aguigue at softree.com
Fri Nov 16 16:35:48 EST 2012


Hi,

I am playing around with handlers now and I have come across the 
following. In words (but
I can provide more code if needed).

- I have derived a class OptEventHandler from ClpEventHandler.
- I am creating an instance m_osiClpSolver of OsiClpSolverInterface and 
populate it with some data
- Then comes setting the handler
         OptEventHandler handler;
m_osiClpSolver.getModelPtr()->passInEventHandler(&handler);
- And finally, the call to optimization
     m_osiClpSolver.initialSolve();

My function int OptEventHandler::event(Event whichEvent) is quite 
trivial, i.e.,
  if (whichEvent == endOfIteration) {
         int numIter = model_->getIterationCount();
         cout << numIter  << "\n";
end

For the first problem I try, everything goes well, the iteration number 
displays and
the problem solves to optimality. I checked, the algorithm used is -1.

For my second problem (almost the same), the iteration number keeps at 0.
However, the problem solves to optimality, and I checked the algorithm in
model_ is 0.

I know it is somewhat a rough description, but any idea why I am not able
to get the iteration number in the second case (note, I am still with 
CBC 2.7.1).

Cheers

Thanks

Alexis


-- 
Software Engineer/Research Engineer
Softree Technical Systems Inc.
www.softree.com
Engineering an Easier Way



More information about the Cbc mailing list