# CbcEventHandler.hpp File Reference

Event handling for cbc. More...

`#include <map>`
Include dependency graph for CbcEventHandler.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
class | CbcEventHandler
| Base class for Cbc event handling. More...

## Detailed Description

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.

Definition in file CbcEventHandler.hpp.

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines