CbcEventHandler.hpp

Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2006, International Business Machines Corporation and others.
00003   All Rights Reserved.
00004 
00005   This code is licensed under the terms of the Eclipse Public License (EPL).
00006 
00007   $Id: CbcEventHandler.hpp 1987 2013-11-29 17:27:29Z forrest $
00008 */
00009 
00010 #ifndef CbcEventHandler_H
00011 #define CbcEventHandler_H
00012 
00049 #include <cstddef>
00050 #include <map>
00051 
00052 /* May well already be declared, but can't hurt. */
00053 
00054 class CbcModel ;
00055 
00056 /*
00057   cvs/svn: $Id: CbcEventHandler.hpp 1987 2013-11-29 17:27:29Z forrest $
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 /* was NULL but 4.6 complains */) ;
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 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 9 Feb 2015 for Cbc by  doxygen 1.6.1