# 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 1675 2011-06-19 17:23:14Z stefan $
    00008 */
    00009
    00010 #ifndef CbcEventHandler_H
    00011 #define CbcEventHandler_H
    00012
    00049 #include <map>
    00050
    00051 /* May well already be declared, but can't hurt. */
    00052
    00053 class CbcModel ;
    00054
    00055 /*
    00056   cvs/svn: $Id: CbcEventHandler.hpp 1675 2011-06-19 17:23:14Z stefan $
    00057 */
    00058
    00081 class CbcEventHandler {
    00082
    00083 public:
    00084
    00087     enum CbcEvent {
    00088         node = 200,
    00090         treeStatus,
    00092         solution,
    00094         heuristicSolution,
    00096         beforeSolution1,
    00098         beforeSolution2,
    00100         afterHeuristic,
    00102         endSearch
    00103     } ;
    00104
    00110     enum CbcAction {
    00111         noAction = -1,
    00113         stop = 0,
    00117         restart,
    00119         restartRoot,
    00121         addCuts,
    00123         killSolution
    00124
    00125     } ;
    00126
    00129     typedef std::map<CbcEvent, CbcAction> eaMapPair ;
    00130
    00131
    00134
    00141     virtual CbcAction event(CbcEvent whichEvent) ;
    00142
    00144
    00145
    00148
    00151     CbcEventHandler(CbcModel *model = 0 /* was NULL but 4.6 complains */) ;
    00152
    00155     CbcEventHandler(const CbcEventHandler &orig) ;
    00156
    00159     CbcEventHandler& operator=(const CbcEventHandler &rhs) ;
    00160
    00163     virtual CbcEventHandler* clone() const ;
    00164
    00167     virtual ~CbcEventHandler() ;
    00168
    00170
    00173
    00176     inline void setModel(CbcModel *model) {
    00177         model_ = model ;
    00178     }
    00179
    00182     inline const CbcModel* getModel() const {
    00183         return model_ ;
    00184     }
    00185
    00188     inline void setDfltAction(CbcAction action) {
    00189         dfltAction_ = action ;
    00190     }
    00191
    00194     inline void setAction(CbcEvent event, CbcAction action) {
    00195         if (eaMap_ == 0) {
    00196             eaMap_ = new eaMapPair ;
    00197         }
    00198         (*eaMap_)[event] = action ;
    00199     }
    00200
    00202
    00203
    00204 protected:
    00205
    00211
    00214     CbcModel *model_ ;
    00215
    00218     CbcAction dfltAction_ ;
    00219
    00222     eaMapPair *eaMap_ ;
    00223
    00225 } ;
    00226
    00227 #endif
    00228

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines