• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/tmp/buildd/coinor-cbc-2.5.0/Cbc/src/CbcEventHandler.hpp

Go to the documentation of this file.
00001 
00006 #ifndef CbcEventHandler_H
00007 #define CbcEventHandler_H
00008 
00045 #include <map>
00046 
00047 /* May well already be declared, but can't hurt. */
00048 
00049 class CbcModel ;
00050 
00051 /*
00052   cvs/svn: $Id: CbcEventHandler.hpp 1432 2010-02-07 19:33:53Z bjarni $
00053 */
00054 
00077 class CbcEventHandler {
00078 
00079 public:
00080 
00083     enum CbcEvent { 
00084         node = 200,
00086         treeStatus,
00088         solution,
00090         heuristicSolution,
00092         beforeSolution1,
00094         beforeSolution2,
00096         endSearch
00097     } ;
00098 
00104     enum CbcAction { 
00105         noAction = -1,
00107         stop = 0,
00111         restart,
00113         restartRoot,
00115         addCuts,
00117         killSolution
00118 
00119     } ;
00120 
00123     typedef std::map<CbcEvent, CbcAction> eaMapPair ;
00124 
00125 
00128 
00135     virtual CbcAction event(CbcEvent whichEvent) ;
00136 
00138 
00139 
00142 
00145     CbcEventHandler(CbcModel *model = NULL) ;
00146 
00149     CbcEventHandler(const CbcEventHandler &orig) ;
00150 
00153     CbcEventHandler& operator=(const CbcEventHandler &rhs) ;
00154 
00157     virtual CbcEventHandler* clone() const ;
00158 
00161     virtual ~CbcEventHandler() ;
00162 
00164 
00167 
00170     inline void setModel(CbcModel *model) {
00171         model_ = model ;
00172     }
00173 
00176     inline const CbcModel* getModel() const {
00177         return model_ ;
00178     }
00179 
00182     inline void setDfltAction(CbcAction action) {
00183         dfltAction_ = action ;
00184     }
00185 
00188     inline void setAction(CbcEvent event, CbcAction action) {
00189         if (eaMap_ == 0) {
00190             eaMap_ = new eaMapPair ;
00191         }
00192         (*eaMap_)[event] = action ;
00193     }
00194 
00196 
00197 
00198 protected:
00199 
00205 
00208     CbcModel *model_ ;
00209 
00212     CbcAction dfltAction_ ;
00213 
00216     eaMapPair *eaMap_ ;
00217 
00219 } ;
00220 
00221 #endif
00222 

Generated on Tue Sep 7 2010 20:23:52 by  doxygen 1.7.1