Ignore:
Timestamp:
Nov 9, 2009 6:33:07 PM (10 years ago)
Author:
EdwinStraver
Message:

Changed formatting using AStyle -A4 -p

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/Cbc/src/CbcEventHandler.hpp

    r1271 r1286  
    7575*/
    7676
    77 class CbcEventHandler
    78 {
    79  
     77class CbcEventHandler {
     78
    8079public:
    8180
    82   /*! \brief Events known to cbc */
    83 
    84   enum CbcEvent
    85   { /*! Processing of the current node is complete. */
    86     node = 200,
    87     /*! A tree status interval has arrived. */
    88     treeStatus,
    89     /*! A solution has been found. */
    90     solution,
    91     /*! A heuristic solution has been found. */
    92     heuristicSolution,
    93     /*! A solution will be found unless user takes action (first check). */
    94     beforeSolution1,
    95     /*! A solution will be found unless user takes action (thorough check). */
    96     beforeSolution2,
    97     /*! End of search. */
    98     endSearch
    99   } ;
    100 
    101   /*! \brief Action codes returned by the event handler.
    102 
    103       Specific values are chosen to match ClpEventHandler return codes.
    104   */
    105 
    106   enum CbcAction
    107   { /*! Continue --- no action required. */
    108     noAction = -1,
    109     /*! Stop --- abort the current run at the next opportunity. */
    110     stop = 0,
    111     /*! Restart --- restart branch-and-cut search; do not undo root node
    112         processing.
     81    /*! \brief Events known to cbc */
     82
     83    enum CbcEvent { /*! Processing of the current node is complete. */
     84        node = 200,
     85        /*! A tree status interval has arrived. */
     86        treeStatus,
     87        /*! A solution has been found. */
     88        solution,
     89        /*! A heuristic solution has been found. */
     90        heuristicSolution,
     91        /*! A solution will be found unless user takes action (first check). */
     92        beforeSolution1,
     93        /*! A solution will be found unless user takes action (thorough check). */
     94        beforeSolution2,
     95        /*! End of search. */
     96        endSearch
     97    } ;
     98
     99    /*! \brief Action codes returned by the event handler.
     100
     101        Specific values are chosen to match ClpEventHandler return codes.
    113102    */
    114     restart,
    115     /*! RestartRoot --- undo root node and start branch-and-cut afresh. */
    116     restartRoot,
    117     /*! Add special cuts. */
    118     addCuts,
    119     /*! Pretend solution never happened. */
    120     killSolution
    121      
    122   } ;
    123 
    124   /*! \brief Data type for event/action pairs */
    125 
    126   typedef std::map<CbcEvent,CbcAction> eaMapPair ;
    127 
    128 
    129   /*! \name Event Processing */
    130   //@{
    131 
    132   /*! \brief Return the action to be taken for an event.
    133  
    134     Return the action that should be taken in response to the event passed as
    135     the parameter. The default implementation simply reads a return code
    136     from a map.
    137   */
    138   virtual CbcAction event(CbcEvent whichEvent) ;
    139 
    140   //@}
    141  
    142  
    143   /*! \name Constructors and destructors */
    144   //@{
    145 
    146   /*! \brief Default constructor. */
    147 
    148   CbcEventHandler(CbcModel *model = NULL) ;
    149 
    150   /*! \brief Copy constructor. */
    151 
    152   CbcEventHandler(const CbcEventHandler &orig) ;
    153 
    154   /*! \brief Assignment. */
    155 
    156   CbcEventHandler& operator=(const CbcEventHandler &rhs) ;
    157 
    158   /*! \brief Clone (virtual) constructor. */
    159 
    160   virtual CbcEventHandler* clone() const ;
    161 
    162   /*! \brief Destructor. */
    163 
    164   virtual ~CbcEventHandler() ;
    165 
    166   //@}
    167  
    168   /*! \name Set/Get methods */
    169   //@{
    170 
    171   /*! \brief Set model. */
    172 
    173   inline void setModel(CbcModel *model)
    174   { model_ = model ; }
    175 
    176   /*! \brief Get model. */
    177 
    178   inline const CbcModel* getModel() const
    179   { return model_ ; }
    180 
    181   /*! \brief Set the default action */
    182 
    183   inline void setDfltAction(CbcAction action)
    184   { dfltAction_ = action ; }
    185 
    186   /*! \brief Set the action code associated with an event */
    187 
    188   inline void setAction(CbcEvent event, CbcAction action)
    189   { if (eaMap_ == 0)
    190     { eaMap_ = new eaMapPair ; }
    191     (*eaMap_)[event] = action ; }
    192 
    193   //@}
    194  
    195  
     103
     104    enum CbcAction { /*! Continue --- no action required. */
     105        noAction = -1,
     106        /*! Stop --- abort the current run at the next opportunity. */
     107        stop = 0,
     108        /*! Restart --- restart branch-and-cut search; do not undo root node
     109        processing.
     110        */
     111        restart,
     112        /*! RestartRoot --- undo root node and start branch-and-cut afresh. */
     113        restartRoot,
     114        /*! Add special cuts. */
     115        addCuts,
     116        /*! Pretend solution never happened. */
     117        killSolution
     118
     119    } ;
     120
     121    /*! \brief Data type for event/action pairs */
     122
     123    typedef std::map<CbcEvent, CbcAction> eaMapPair ;
     124
     125
     126    /*! \name Event Processing */
     127    //@{
     128
     129    /*! \brief Return the action to be taken for an event.
     130
     131      Return the action that should be taken in response to the event passed as
     132      the parameter. The default implementation simply reads a return code
     133      from a map.
     134    */
     135    virtual CbcAction event(CbcEvent whichEvent) ;
     136
     137    //@}
     138
     139
     140    /*! \name Constructors and destructors */
     141    //@{
     142
     143    /*! \brief Default constructor. */
     144
     145    CbcEventHandler(CbcModel *model = NULL) ;
     146
     147    /*! \brief Copy constructor. */
     148
     149    CbcEventHandler(const CbcEventHandler &orig) ;
     150
     151    /*! \brief Assignment. */
     152
     153    CbcEventHandler& operator=(const CbcEventHandler &rhs) ;
     154
     155    /*! \brief Clone (virtual) constructor. */
     156
     157    virtual CbcEventHandler* clone() const ;
     158
     159    /*! \brief Destructor. */
     160
     161    virtual ~CbcEventHandler() ;
     162
     163    //@}
     164
     165    /*! \name Set/Get methods */
     166    //@{
     167
     168    /*! \brief Set model. */
     169
     170    inline void setModel(CbcModel *model) {
     171        model_ = model ;
     172    }
     173
     174    /*! \brief Get model. */
     175
     176    inline const CbcModel* getModel() const {
     177        return model_ ;
     178    }
     179
     180    /*! \brief Set the default action */
     181
     182    inline void setDfltAction(CbcAction action) {
     183        dfltAction_ = action ;
     184    }
     185
     186    /*! \brief Set the action code associated with an event */
     187
     188    inline void setAction(CbcEvent event, CbcAction action) {
     189        if (eaMap_ == 0) {
     190            eaMap_ = new eaMapPair ;
     191        }
     192        (*eaMap_)[event] = action ;
     193    }
     194
     195    //@}
     196
     197
    196198protected:
    197199
    198   /*! \name Data members
    199 
    200      Protected (as opposed to private) to allow access by derived classes.
    201   */
    202   //@{
    203 
    204   /*! \brief Pointer to associated CbcModel */
    205 
    206   CbcModel *model_ ;
    207 
    208   /*! \brief Default action */
    209 
    210   CbcAction dfltAction_ ;
    211 
    212   /*! \brief Pointer to a map that holds non-default event/action pairs */
    213 
    214   eaMapPair *eaMap_ ;
    215 
    216   //@}
     200    /*! \name Data members
     201
     202       Protected (as opposed to private) to allow access by derived classes.
     203    */
     204    //@{
     205
     206    /*! \brief Pointer to associated CbcModel */
     207
     208    CbcModel *model_ ;
     209
     210    /*! \brief Default action */
     211
     212    CbcAction dfltAction_ ;
     213
     214    /*! \brief Pointer to a map that holds non-default event/action pairs */
     215
     216    eaMapPair *eaMap_ ;
     217
     218    //@}
    217219} ;
    218220
Note: See TracChangeset for help on using the changeset viewer.