Cbc  2.9.8
CbcEventHandler.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006, International Business Machines Corporation and others.
3  All Rights Reserved.
4 
5  This code is licensed under the terms of the Eclipse Public License (EPL).
6 
7  $Id: CbcEventHandler.hpp 1987 2013-11-29 17:27:29Z forrest $
8 */
9 
10 #ifndef CbcEventHandler_H
11 #define CbcEventHandler_H
12 
49 #include <cstddef>
50 #include <map>
51 
52 /* May well already be declared, but can't hurt. */
53 
54 class CbcModel ;
55 
56 /*
57  cvs/svn: $Id: CbcEventHandler.hpp 1987 2013-11-29 17:27:29Z forrest $
58 */
59 
83 
84 public:
85 
88  enum CbcEvent {
89  node = 200,
110  } ;
111 
117  enum CbcAction {
118  noAction = -1,
120  stop = 0,
133 
134  } ;
135 
138  typedef std::map<CbcEvent, CbcAction> eaMapPair ;
139 
140 
143 
150  virtual CbcAction event(CbcEvent whichEvent) ;
151 
158  virtual CbcAction event(CbcEvent whichEvent, void * data) ;
159 
161 
162 
165 
168  CbcEventHandler(CbcModel *model = 0 /* was NULL but 4.6 complains */) ;
169 
172  CbcEventHandler(const CbcEventHandler &orig) ;
173 
177 
180  virtual CbcEventHandler* clone() const ;
181 
184  virtual ~CbcEventHandler() ;
185 
187 
190 
193  inline void setModel(CbcModel *model) {
194  model_ = model ;
195  }
196 
199  inline const CbcModel* getModel() const {
200  return model_ ;
201  }
202 
205  inline void setDfltAction(CbcAction action) {
206  dfltAction_ = action ;
207  }
208 
211  inline void setAction(CbcEvent event, CbcAction action) {
212  if (eaMap_ == 0) {
213  eaMap_ = new eaMapPair ;
214  }
215  (*eaMap_)[event] = action ;
216  }
217 
219 
220 
221 protected:
222 
228 
232 
236 
239  eaMapPair *eaMap_ ;
240 
242 } ;
243 
244 #endif
245 
Pretend solution never happened.
A solution will be found unless user takes action (thorough check).
CbcEventHandler & operator=(const CbcEventHandler &rhs)
Assignment.
A tree status interval has arrived.
CbcModel * model_
Pointer to associated CbcModel.
CbcAction dfltAction_
Default action.
Restart — restart branch-and-cut search; do not undo root node processing.
RestartRoot — undo root node and start branch-and-cut afresh.
CbcEvent
Events known to cbc.
After failed heuristic.
eaMapPair * eaMap_
Pointer to a map that holds non-default event/action pairs.
Base class for Cbc event handling.
A solution has been found.
virtual CbcEventHandler * clone() const
Clone (virtual) constructor.
std::map< CbcEvent, CbcAction > eaMapPair
Data type for event/action pairs.
CbcEventHandler(CbcModel *model=0)
Default constructor.
After a pass of heuristic.
void setModel(CbcModel *model)
Set model.
const CbcModel * getModel() const
Get model.
A solution will be found unless user takes action (first check).
void setAction(CbcEvent event, CbcAction action)
Set the action code associated with an event.
Stop — abort the current run at the next opportunity.
Continue — no action required.
void setDfltAction(CbcAction action)
Set the default action.
CbcAction
Action codes returned by the event handler.
A heuristic solution has been found.
When converting constraints to cuts.
virtual CbcAction event(CbcEvent whichEvent)
Return the action to be taken for an event.
Processing of the current node is complete.
Simple Branch and bound class.
Definition: CbcModel.hpp:101
Take action on modified data.
On entry to small branch and bound.
virtual ~CbcEventHandler()
Destructor.