CbcEventHandler.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef CbcEventHandler_H
00011 #define CbcEventHandler_H
00012
00049 #include <cstddef>
00050 #include <map>
00051
00052
00053
00054 class CbcModel ;
00055
00056
00057
00058
00059
00082 class CbcEventHandler {
00083
00084 public:
00085
00088 enum CbcEvent {
00089 node = 200,
00091 treeStatus,
00093 solution,
00095 heuristicSolution,
00097 beforeSolution1,
00099 beforeSolution2,
00101 afterHeuristic,
00103 smallBranchAndBound,
00105 heuristicPass,
00107 convertToCuts,
00109 endSearch
00110 } ;
00111
00117 enum CbcAction {
00118 noAction = -1,
00120 stop = 0,
00124 restart,
00126 restartRoot,
00128 addCuts,
00130 killSolution,
00132 takeAction
00133
00134 } ;
00135
00138 typedef std::map<CbcEvent, CbcAction> eaMapPair ;
00139
00140
00143
00150 virtual CbcAction event(CbcEvent whichEvent) ;
00151
00158 virtual CbcAction event(CbcEvent whichEvent, void * data) ;
00159
00161
00162
00165
00168 CbcEventHandler(CbcModel *model = 0 ) ;
00169
00172 CbcEventHandler(const CbcEventHandler &orig) ;
00173
00176 CbcEventHandler& operator=(const CbcEventHandler &rhs) ;
00177
00180 virtual CbcEventHandler* clone() const ;
00181
00184 virtual ~CbcEventHandler() ;
00185
00187
00190
00193 inline void setModel(CbcModel *model) {
00194 model_ = model ;
00195 }
00196
00199 inline const CbcModel* getModel() const {
00200 return model_ ;
00201 }
00202
00205 inline void setDfltAction(CbcAction action) {
00206 dfltAction_ = action ;
00207 }
00208
00211 inline void setAction(CbcEvent event, CbcAction action) {
00212 if (eaMap_ == 0) {
00213 eaMap_ = new eaMapPair ;
00214 }
00215 (*eaMap_)[event] = action ;
00216 }
00217
00219
00220
00221 protected:
00222
00228
00231 CbcModel *model_ ;
00232
00235 CbcAction dfltAction_ ;
00236
00239 eaMapPair *eaMap_ ;
00240
00242 } ;
00243
00244 #endif
00245