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/CbcStrategy.hpp

    r1271 r1286  
    1616class CbcStrategy {
    1717public:
    18   // Default Constructor
    19   CbcStrategy ();
    20 
    21   virtual ~CbcStrategy();
    22 
    23   /// Clone
    24   virtual CbcStrategy * clone() const=0;
    25 
    26   /// Setup cut generators
    27   virtual void setupCutGenerators(CbcModel & model)=0;
    28   /// Setup heuristics
    29   virtual void setupHeuristics(CbcModel & model)=0;
    30   /// Do printing stuff
    31   virtual void setupPrinting(CbcModel & model,int modelLogLevel)=0;
    32   /// Other stuff e.g. strong branching and preprocessing
    33   virtual void setupOther(CbcModel & model)=0;
    34   /// Set model depth (i.e. how nested)
    35   inline void setNested(int depth)
    36   { depth_=depth;}
    37   /// Get model depth (i.e. how nested)
    38   inline int getNested() const
    39   { return depth_;}
    40   /// Say preProcessing done
    41   inline void setPreProcessState(int state)
    42   { preProcessState_=state;}
    43   /// See what sort of preprocessing was done
    44   inline int preProcessState() const
    45   { return preProcessState_;}
    46   /// Pre-processing object
    47   inline CglPreProcess * process() const
    48   { return process_;}
    49   /// Delete pre-processing object to save memory
    50   void deletePreProcess();
    51   /// Return a new Full node information pointer (descendant of CbcFullNodeInfo)
    52   virtual CbcNodeInfo * fullNodeInfo(CbcModel * model,int numberRowsAtContinuous) const;
    53   /// Return a new Partial node information pointer (descendant of CbcPartialNodeInfo)
    54   virtual CbcNodeInfo * partialNodeInfo(CbcModel * model, CbcNodeInfo * parent, CbcNode * owner,
    55                                         int numberChangedBounds,const int * variables,
    56                                         const double * boundChanges,
    57                                         const CoinWarmStartDiff *basisDiff) const;
    58   /// Create C++ lines to get to current state
    59   virtual void generateCpp( FILE * ) {}
    60   /** After a CbcModel::resolve this can return a status
    61       -1 no effect
    62       0 treat as optimal
    63       1 as 0 but do not do any more resolves (i.e. no more cuts)
    64       2 treat as infeasible
    65   */
    66   virtual int status(CbcModel * model, CbcNodeInfo * parent, int whereFrom);
    67 private:
    68  
    69   /// Illegal Assignment operator
    70   CbcStrategy & operator=(const CbcStrategy& rhs);
    71 protected:
    72   // Data
    73   /// Model depth
    74   int depth_;
    75   /** PreProcessing state -
    76       -1 infeasible
    77       0 off
    78       1 was done (so need post-processing)
    79   */
    80   int preProcessState_;
    81   /// If preprocessing then this is object
    82   CglPreProcess * process_;
     18    // Default Constructor
     19    CbcStrategy ();
     20
     21    virtual ~CbcStrategy();
     22
     23    /// Clone
     24    virtual CbcStrategy * clone() const = 0;
     25
     26    /// Setup cut generators
     27    virtual void setupCutGenerators(CbcModel & model) = 0;
     28    /// Setup heuristics
     29    virtual void setupHeuristics(CbcModel & model) = 0;
     30    /// Do printing stuff
     31    virtual void setupPrinting(CbcModel & model, int modelLogLevel) = 0;
     32    /// Other stuff e.g. strong branching and preprocessing
     33    virtual void setupOther(CbcModel & model) = 0;
     34    /// Set model depth (i.e. how nested)
     35    inline void setNested(int depth) {
     36        depth_ = depth;
     37    }
     38    /// Get model depth (i.e. how nested)
     39    inline int getNested() const {
     40        return depth_;
     41    }
     42    /// Say preProcessing done
     43    inline void setPreProcessState(int state) {
     44        preProcessState_ = state;
     45    }
     46    /// See what sort of preprocessing was done
     47    inline int preProcessState() const {
     48        return preProcessState_;
     49    }
     50    /// Pre-processing object
     51    inline CglPreProcess * process() const {
     52        return process_;
     53    }
     54    /// Delete pre-processing object to save memory
     55    void deletePreProcess();
     56    /// Return a new Full node information pointer (descendant of CbcFullNodeInfo)
     57    virtual CbcNodeInfo * fullNodeInfo(CbcModel * model, int numberRowsAtContinuous) const;
     58    /// Return a new Partial node information pointer (descendant of CbcPartialNodeInfo)
     59    virtual CbcNodeInfo * partialNodeInfo(CbcModel * model, CbcNodeInfo * parent, CbcNode * owner,
     60                                          int numberChangedBounds, const int * variables,
     61                                          const double * boundChanges,
     62                                          const CoinWarmStartDiff *basisDiff) const;
     63    /// Create C++ lines to get to current state
     64    virtual void generateCpp( FILE * ) {}
     65    /** After a CbcModel::resolve this can return a status
     66        -1 no effect
     67        0 treat as optimal
     68        1 as 0 but do not do any more resolves (i.e. no more cuts)
     69        2 treat as infeasible
     70    */
     71    virtual int status(CbcModel * model, CbcNodeInfo * parent, int whereFrom);
     72private:
     73
     74    /// Illegal Assignment operator
     75    CbcStrategy & operator=(const CbcStrategy& rhs);
     76protected:
     77    // Data
     78    /// Model depth
     79    int depth_;
     80    /** PreProcessing state -
     81        -1 infeasible
     82        0 off
     83        1 was done (so need post-processing)
     84    */
     85    int preProcessState_;
     86    /// If preprocessing then this is object
     87    CglPreProcess * process_;
    8388};
    8489
     
    8994public:
    9095
    91   // Default Constructor
    92   CbcStrategyNull () {}
    93 
    94   // Copy constructor
    95   CbcStrategyNull ( const CbcStrategyNull & rhs) : CbcStrategy(rhs) {}
    96    
    97   // Destructor
    98   ~CbcStrategyNull () {}
    99  
    100   /// Clone
    101   virtual CbcStrategy * clone() const { return new CbcStrategyNull(*this);}
    102 
    103   /// Setup cut generators
    104   virtual void setupCutGenerators(CbcModel & ) {}
    105   /// Setup heuristics
    106   virtual void setupHeuristics(CbcModel & ) {}
    107   /// Do printing stuff
    108   virtual void setupPrinting(CbcModel & ,int ) {}
    109   /// Other stuff e.g. strong branching
    110   virtual void setupOther(CbcModel & ) {}
    111 
    112 protected:
    113   // Data
    114 private:
    115   /// Illegal Assignment operator
    116   CbcStrategyNull & operator=(const CbcStrategyNull& rhs);
     96    // Default Constructor
     97    CbcStrategyNull () {}
     98
     99    // Copy constructor
     100    CbcStrategyNull ( const CbcStrategyNull & rhs) : CbcStrategy(rhs) {}
     101
     102    // Destructor
     103    ~CbcStrategyNull () {}
     104
     105    /// Clone
     106    virtual CbcStrategy * clone() const {
     107        return new CbcStrategyNull(*this);
     108    }
     109
     110    /// Setup cut generators
     111    virtual void setupCutGenerators(CbcModel & ) {}
     112    /// Setup heuristics
     113    virtual void setupHeuristics(CbcModel & ) {}
     114    /// Do printing stuff
     115    virtual void setupPrinting(CbcModel & , int ) {}
     116    /// Other stuff e.g. strong branching
     117    virtual void setupOther(CbcModel & ) {}
     118
     119protected:
     120    // Data
     121private:
     122    /// Illegal Assignment operator
     123    CbcStrategyNull & operator=(const CbcStrategyNull& rhs);
    117124};
    118125
     
    123130public:
    124131
    125   // Default Constructor
    126   CbcStrategyDefault (int cutsOnlyAtRoot=1,
    127                       int numberStrong=5,
    128                       int numberBeforeTrust=0,
    129                       int printLevel=0);
    130 
    131   // Copy constructor
    132   CbcStrategyDefault ( const CbcStrategyDefault &);
    133    
    134   // Destructor
    135   ~CbcStrategyDefault ();
    136  
    137   /// Clone
    138   virtual CbcStrategy * clone() const;
    139 
    140   /// Setup cut generators
    141   virtual void setupCutGenerators(CbcModel & model);
    142   /// Setup heuristics
    143   virtual void setupHeuristics(CbcModel & model);
    144   /// Do printing stuff
    145   virtual void setupPrinting(CbcModel & model,int modelLogLevel) ;
    146   /// Other stuff e.g. strong branching
    147   virtual void setupOther(CbcModel & model);
    148   /// Set up preProcessing - see below
    149   inline void setupPreProcessing(int desired=1, int passes=10)
    150   { desiredPreProcess_=desired;preProcessPasses_=passes;}
    151   /// See what sort of preprocessing wanted
    152   inline int desiredPreProcess() const
    153   { return desiredPreProcess_;}
    154   /// See how many passes wanted
    155   inline int preProcessPasses() const
    156   { return preProcessPasses_;}
    157   /// Create C++ lines to get to current state
    158   virtual void generateCpp( FILE * fp) ;
    159 
    160 protected:
    161   // Data
    162 
    163   // Whether to do cuts only at root (-1 -> switch off totally)
    164   int cutsOnlyAtRoot_;
    165 
    166   // How much strong branching to do
    167   int numberStrong_;
    168 
    169   // Number branches needed to trust with dynamic pseudo costs
    170   int numberBeforeTrust_;
    171 
    172   // Print level 0 little, 1 medium
    173   int printLevel_;
    174 
    175   /** Desired pre-processing
    176       0 - none
    177       1 - ordinary
    178       2 - find sos
    179       3 - find cliques
    180       4 - more aggressive sos
    181       5 - add integer slacks
    182   */
    183   int desiredPreProcess_;
    184   /// Number of pre-processing passes
    185   int preProcessPasses_;
    186 
    187 private:
    188   /// Illegal Assignment operator
    189   CbcStrategyDefault & operator=(const CbcStrategyDefault& rhs);
     132    // Default Constructor
     133    CbcStrategyDefault (int cutsOnlyAtRoot = 1,
     134                        int numberStrong = 5,
     135                        int numberBeforeTrust = 0,
     136                        int printLevel = 0);
     137
     138    // Copy constructor
     139    CbcStrategyDefault ( const CbcStrategyDefault &);
     140
     141    // Destructor
     142    ~CbcStrategyDefault ();
     143
     144    /// Clone
     145    virtual CbcStrategy * clone() const;
     146
     147    /// Setup cut generators
     148    virtual void setupCutGenerators(CbcModel & model);
     149    /// Setup heuristics
     150    virtual void setupHeuristics(CbcModel & model);
     151    /// Do printing stuff
     152    virtual void setupPrinting(CbcModel & model, int modelLogLevel) ;
     153    /// Other stuff e.g. strong branching
     154    virtual void setupOther(CbcModel & model);
     155    /// Set up preProcessing - see below
     156    inline void setupPreProcessing(int desired = 1, int passes = 10) {
     157        desiredPreProcess_ = desired;
     158        preProcessPasses_ = passes;
     159    }
     160    /// See what sort of preprocessing wanted
     161    inline int desiredPreProcess() const {
     162        return desiredPreProcess_;
     163    }
     164    /// See how many passes wanted
     165    inline int preProcessPasses() const {
     166        return preProcessPasses_;
     167    }
     168    /// Create C++ lines to get to current state
     169    virtual void generateCpp( FILE * fp) ;
     170
     171protected:
     172    // Data
     173
     174    // Whether to do cuts only at root (-1 -> switch off totally)
     175    int cutsOnlyAtRoot_;
     176
     177    // How much strong branching to do
     178    int numberStrong_;
     179
     180    // Number branches needed to trust with dynamic pseudo costs
     181    int numberBeforeTrust_;
     182
     183    // Print level 0 little, 1 medium
     184    int printLevel_;
     185
     186    /** Desired pre-processing
     187        0 - none
     188        1 - ordinary
     189        2 - find sos
     190        3 - find cliques
     191        4 - more aggressive sos
     192        5 - add integer slacks
     193    */
     194    int desiredPreProcess_;
     195    /// Number of pre-processing passes
     196    int preProcessPasses_;
     197
     198private:
     199    /// Illegal Assignment operator
     200    CbcStrategyDefault & operator=(const CbcStrategyDefault& rhs);
    190201};
    191202
     
    197208public:
    198209
    199   // Default Constructor
    200   CbcStrategyDefaultSubTree (CbcModel * parent=NULL,int cutsOnlyAtRoot=1,
    201                       int numberStrong=5,
    202                       int numberBeforeTrust=0,
    203                       int printLevel=0);
    204 
    205   // Copy constructor
    206   CbcStrategyDefaultSubTree ( const CbcStrategyDefaultSubTree &);
    207    
    208   // Destructor
    209   ~CbcStrategyDefaultSubTree ();
    210  
    211   /// Clone
    212   virtual CbcStrategy * clone() const;
    213 
    214   /// Setup cut generators
    215   virtual void setupCutGenerators(CbcModel & model);
    216   /// Setup heuristics
    217   virtual void setupHeuristics(CbcModel & model);
    218   /// Do printing stuff
    219   virtual void setupPrinting(CbcModel & model,int modelLogLevel) ;
    220   /// Other stuff e.g. strong branching
    221   virtual void setupOther(CbcModel & model);
    222 protected:
    223   // Data
    224   // Parent model
    225   CbcModel * parentModel_;
    226   // Whether to do cuts only at root (-1 -> switch off totally)
    227   int cutsOnlyAtRoot_;
    228 
    229   // How much strong branching to do
    230   int numberStrong_;
    231 
    232   // Number branches needed to trust with dynamic pseudo costs
    233   int numberBeforeTrust_;
    234 
    235   // Print level 0 little, 1 medium
    236   int printLevel_;
    237 
    238 private:
    239   /// Illegal Assignment operator
    240   CbcStrategyDefaultSubTree & operator=(const CbcStrategyDefaultSubTree& rhs);
     210    // Default Constructor
     211    CbcStrategyDefaultSubTree (CbcModel * parent = NULL, int cutsOnlyAtRoot = 1,
     212                               int numberStrong = 5,
     213                               int numberBeforeTrust = 0,
     214                               int printLevel = 0);
     215
     216    // Copy constructor
     217    CbcStrategyDefaultSubTree ( const CbcStrategyDefaultSubTree &);
     218
     219    // Destructor
     220    ~CbcStrategyDefaultSubTree ();
     221
     222    /// Clone
     223    virtual CbcStrategy * clone() const;
     224
     225    /// Setup cut generators
     226    virtual void setupCutGenerators(CbcModel & model);
     227    /// Setup heuristics
     228    virtual void setupHeuristics(CbcModel & model);
     229    /// Do printing stuff
     230    virtual void setupPrinting(CbcModel & model, int modelLogLevel) ;
     231    /// Other stuff e.g. strong branching
     232    virtual void setupOther(CbcModel & model);
     233protected:
     234    // Data
     235    // Parent model
     236    CbcModel * parentModel_;
     237    // Whether to do cuts only at root (-1 -> switch off totally)
     238    int cutsOnlyAtRoot_;
     239
     240    // How much strong branching to do
     241    int numberStrong_;
     242
     243    // Number branches needed to trust with dynamic pseudo costs
     244    int numberBeforeTrust_;
     245
     246    // Print level 0 little, 1 medium
     247    int printLevel_;
     248
     249private:
     250    /// Illegal Assignment operator
     251    CbcStrategyDefaultSubTree & operator=(const CbcStrategyDefaultSubTree& rhs);
    241252};
    242253
Note: See TracChangeset for help on using the changeset viewer.