00001
00006 #ifndef CbcEventHandler_H
00007 #define CbcEventHandler_H
00008
00045 #include <map>
00046
00047
00048
00049 class CbcModel ;
00050
00051
00052
00053
00054
00077 class CbcEventHandler
00078 {
00079
00080 public:
00081
00084 enum CbcEvent
00085 {
00086 node = 200,
00088 treeStatus,
00090 solution,
00092 heuristicSolution,
00094 beforeSolution1,
00096 beforeSolution2,
00098 endSearch
00099 } ;
00100
00106 enum CbcAction
00107 {
00108 noAction = -1,
00110 stop = 0,
00114 restart,
00116 restartRoot,
00118 addCuts,
00120 killSolution
00121
00122 } ;
00123
00126 typedef std::map<CbcEvent,CbcAction> eaMapPair ;
00127
00128
00131
00138 virtual CbcAction event(CbcEvent whichEvent) ;
00139
00141
00142
00145
00148 CbcEventHandler(CbcModel *model = NULL) ;
00149
00152 CbcEventHandler(const CbcEventHandler &orig) ;
00153
00156 CbcEventHandler& operator=(const CbcEventHandler &rhs) ;
00157
00160 virtual CbcEventHandler* clone() const ;
00161
00164 virtual ~CbcEventHandler() ;
00165
00167
00170
00173 inline void setModel(CbcModel *model)
00174 { model_ = model ; }
00175
00178 inline const CbcModel* getModel() const
00179 { return model_ ; }
00180
00183 inline void setDfltAction(CbcAction action)
00184 { dfltAction_ = action ; }
00185
00188 inline void setAction(CbcEvent event, CbcAction action)
00189 { if (eaMap_ == 0)
00190 { eaMap_ = new eaMapPair ; }
00191 (*eaMap_)[event] = action ; }
00192
00194
00195
00196 protected:
00197
00203
00206 CbcModel *model_ ;
00207
00210 CbcAction dfltAction_ ;
00211
00214 eaMapPair *eaMap_ ;
00215
00217 } ;
00218
00219 #endif