Cbc  2.8.12
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 1986 2013-11-29 17:24:44Z forrest $
8 */
9 
10 #ifndef CbcEventHandler_H
11 #define CbcEventHandler_H
12 
48 #include <cstddef>
49 #include <map>
50 
51 /* May well already be declared, but can't hurt. */
52 
53 class CbcModel ;
54 
55 /*
56  cvs/svn: $Id: CbcEventHandler.hpp 1986 2013-11-29 17:24:44Z forrest $
57 */
58 
82 
83 public:
84 
87  enum CbcEvent {
88  node = 200,
103  } ;
104 
110  enum CbcAction {
111  noAction = -1,
113  stop = 0,
124 
125  } ;
126 
129  typedef std::map<CbcEvent, CbcAction> eaMapPair ;
130 
131 
134 
141  virtual CbcAction event(CbcEvent whichEvent) ;
142 
144 
145 
148 
151  CbcEventHandler(CbcModel *model = 0 /* was NULL but 4.6 complains */) ;
152 
155  CbcEventHandler(const CbcEventHandler &orig) ;
156 
160 
163  virtual CbcEventHandler* clone() const ;
164 
167  virtual ~CbcEventHandler() ;
168 
170 
173 
176  inline void setModel(CbcModel *model) {
177  model_ = model ;
178  }
179 
182  inline const CbcModel* getModel() const {
183  return model_ ;
184  }
185 
188  inline void setDfltAction(CbcAction action) {
189  dfltAction_ = action ;
190  }
191 
194  inline void setAction(CbcEvent event, CbcAction action) {
195  if (eaMap_ == 0) {
196  eaMap_ = new eaMapPair ;
197  }
198  (*eaMap_)[event] = action ;
199  }
200 
202 
203 
204 protected:
205 
211 
215 
219 
222  eaMapPair *eaMap_ ;
223 
225 } ;
226 
227 #endif
228 
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.
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.
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:100
virtual ~CbcEventHandler()
Destructor.