/*
Copyright (C) 2006, International Business Machines Corporation and others.
All Rights Reserved.
This code is licensed under the terms of the Eclipse Public License (EPL).
$Id: CbcEventHandler.hpp 1987 2013-11-29 17:27:29Z forrest $
*/
#ifndef CbcEventHandler_H
#define CbcEventHandler_H
/*! \file CbcEventHandler.hpp
\brief Event handling for cbc
This file contains the declaration of CbcEventHandler, used for event
handling in cbc.
The central method is CbcEventHandler::event(). The default semantics of
this call are `ask for the action to take in reponse to this event'. The
call is made at the point in the code where the event occurs (e.g.,
when a solution is found, or when a node is added to or removed from the
search tree). The return value specifies the action to perform in response
to the event (e.g., continue, or stop).
This is a lazy class. Initially, it knows nothing about specific events,
and returns dfltAction_ for any event. This makes for a trivial constructor
and fast startup. The only place where the list of known events or actions
is hardwired is in the enum definitions for CbcEvent and CbcAction,
respectively.
At the first call to setAction, a map is created to hold (Event,Action)
pairs, and this map will be consulted ever after. Events not in the map
will still return the default value.
For serious extensions, derive a subclass and replace event() with a
function that suits you better. The function has access to the CbcModel
via a pointer held in the CbcEventHandler object, and can do as much
thinking as it likes before returning an answer. You can also print as
much information as you want. The model is held as a const, however, so
you can't alter reality.
The design of the class deliberately matches ClpEventHandler, so that other
solvers can participate in cbc without breaking the patterns set by
clp-specific code.
*/
#include
#include