Cbc  2.10.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 2467 2019-01-03 21:26:29Z unxusr $
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 2467 2019-01-03 21:26:29Z unxusr $
58 */
59 
83 
84 public:
87  enum CbcEvent {
88  node = 200,
111  };
112 
118  enum CbcAction {
119  noAction = -1,
121  stop = 0,
134 
135  };
136 
139  typedef std::map< CbcEvent, CbcAction > eaMapPair;
140 
143 
150  virtual CbcAction event(CbcEvent whichEvent);
151 
158  virtual CbcAction event(CbcEvent whichEvent, void *data);
159 
161 
164 
167  CbcEventHandler(CbcModel *model = 0 /* was NULL but 4.6 complains */);
168 
171  CbcEventHandler(const CbcEventHandler &orig);
172 
176 
179  virtual CbcEventHandler *clone() const;
180 
183  virtual ~CbcEventHandler();
184 
186 
189 
192  inline void setModel(CbcModel *model)
193  {
194  model_ = model;
195  }
196 
199  inline const CbcModel *getModel() const
200  {
201  return model_;
202  }
203 
206  inline void setDfltAction(CbcAction action)
207  {
208  dfltAction_ = action;
209  }
210 
213  inline void setAction(CbcEvent event, CbcAction action)
214  {
215  if (eaMap_ == 0) {
216  eaMap_ = new eaMapPair;
217  }
218  (*eaMap_)[event] = action;
219  }
220 
222 
223 protected:
229 
233 
237 
241 
243 };
244 
245 #endif
246 
247 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
248 */
Pretend solution never happened.
std::map< CbcEvent, CbcAction > eaMapPair
Data type for event/action pairs.
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.
const CbcModel * getModel() const
Get model.
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.
CbcEventHandler(CbcModel *model=0)
Default constructor.
After a pass of heuristic.
void setModel(CbcModel *model)
Set 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 CbcEventHandler * clone() const
Clone (virtual) constructor.
virtual CbcAction event(CbcEvent whichEvent)
Return the action to be taken for an event.
Having generated cuts, allows user to think.
Processing of the current node is complete.
Simple Branch and bound class.
Definition: CbcModel.hpp:100
Take action on modified data.
On entry to small branch and bound.
virtual ~CbcEventHandler()
Destructor.