# CbcStrategy.hpp

Go to the documentation of this file.

    00001 /* $Id: CbcStrategy.hpp 1573 2011-01-05 01:12:36Z lou $ */
    00002 // Copyright (C) 2005, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005
    00006 #ifndef CbcStrategy_H
    00007 #define CbcStrategy_H
    00008
    00009 #include "CbcModel.hpp"
    00010 class CglPreProcess;
    00011 class CbcNodeInfo;
    00012 class CbcNode;
    00013 class CoinWarmStartDiff;
    00014
    00015 //#############################################################################
    00018 class CbcStrategy {
    00019 public:
    00020     // Default Constructor
    00021     CbcStrategy ();
    00022
    00023     virtual ~CbcStrategy();
    00024
    00026     virtual CbcStrategy * clone() const = 0;
    00027
    00029     virtual void setupCutGenerators(CbcModel & model) = 0;
    00031     virtual void setupHeuristics(CbcModel & model) = 0;
    00033     virtual void setupPrinting(CbcModel & model, int modelLogLevel) = 0;
    00035     virtual void setupOther(CbcModel & model) = 0;
    00037     inline void setNested(int depth) {
    00038         depth_ = depth;
    00039     }
    00041     inline int getNested() const {
    00042         return depth_;
    00043     }
    00045     inline void setPreProcessState(int state) {
    00046         preProcessState_ = state;
    00047     }
    00049     inline int preProcessState() const {
    00050         return preProcessState_;
    00051     }
    00053     inline CglPreProcess * process() const {
    00054         return process_;
    00055     }
    00057     void deletePreProcess();
    00059     virtual CbcNodeInfo * fullNodeInfo(CbcModel * model, int numberRowsAtContinuous) const;
    00061     virtual CbcNodeInfo * partialNodeInfo(CbcModel * model, CbcNodeInfo * parent, CbcNode * owner,
    00062                                           int numberChangedBounds, const int * variables,
    00063                                           const double * boundChanges,
    00064                                           const CoinWarmStartDiff *basisDiff) const;
    00066     virtual void generateCpp( FILE * ) {}
    00073     virtual int status(CbcModel * model, CbcNodeInfo * parent, int whereFrom);
    00074 private:
    00075
    00077     CbcStrategy & operator=(const CbcStrategy& rhs);
    00078 protected:
    00079     // Data
    00081     int depth_;
    00087     int preProcessState_;
    00089     CglPreProcess * process_;
    00090 };
    00091
    00095 class CbcStrategyNull : public CbcStrategy {
    00096 public:
    00097
    00098     // Default Constructor
    00099     CbcStrategyNull () {}
    00100
    00101     // Copy constructor
    00102     CbcStrategyNull ( const CbcStrategyNull & rhs) : CbcStrategy(rhs) {}
    00103
    00104     // Destructor
    00105     ~CbcStrategyNull () {}
    00106
    00108     virtual CbcStrategy * clone() const {
    00109         return new CbcStrategyNull(*this);
    00110     }
    00111
    00113     virtual void setupCutGenerators(CbcModel & ) {}
    00115     virtual void setupHeuristics(CbcModel & ) {}
    00117     virtual void setupPrinting(CbcModel & , int ) {}
    00119     virtual void setupOther(CbcModel & ) {}
    00120
    00121 protected:
    00122     // Data
    00123 private:
    00125     CbcStrategyNull & operator=(const CbcStrategyNull& rhs);
    00126 };
    00127
    00131 class CbcStrategyDefault : public CbcStrategy {
    00132 public:
    00133
    00134     // Default Constructor
    00135     CbcStrategyDefault (int cutsOnlyAtRoot = 1,
    00136                         int numberStrong = 5,
    00137                         int numberBeforeTrust = 0,
    00138                         int printLevel = 0);
    00139
    00140     // Copy constructor
    00141     CbcStrategyDefault ( const CbcStrategyDefault &);
    00142
    00143     // Destructor
    00144     ~CbcStrategyDefault ();
    00145
    00147     virtual CbcStrategy * clone() const;
    00148
    00150     virtual void setupCutGenerators(CbcModel & model);
    00152     virtual void setupHeuristics(CbcModel & model);
    00154     virtual void setupPrinting(CbcModel & model, int modelLogLevel) ;
    00156     virtual void setupOther(CbcModel & model);
    00158     inline void setupPreProcessing(int desired = 1, int passes = 10) {
    00159         desiredPreProcess_ = desired;
    00160         preProcessPasses_ = passes;
    00161     }
    00163     inline int desiredPreProcess() const {
    00164         return desiredPreProcess_;
    00165     }
    00167     inline int preProcessPasses() const {
    00168         return preProcessPasses_;
    00169     }
    00171     virtual void generateCpp( FILE * fp) ;
    00172
    00173 protected:
    00174     // Data
    00175
    00176     // Whether to do cuts only at root (-1 -> switch off totally)
    00177     int cutsOnlyAtRoot_;
    00178
    00179     // How much strong branching to do
    00180     int numberStrong_;
    00181
    00182     // Number branches needed to trust with dynamic pseudo costs
    00183     int numberBeforeTrust_;
    00184
    00185     // Print level 0 little, 1 medium
    00186     int printLevel_;
    00187
    00196     int desiredPreProcess_;
    00198     int preProcessPasses_;
    00199
    00200 private:
    00202     CbcStrategyDefault & operator=(const CbcStrategyDefault& rhs);
    00203 };
    00204
    00205
    00209 class CbcStrategyDefaultSubTree : public CbcStrategy {
    00210 public:
    00211
    00212     // Default Constructor
    00213     CbcStrategyDefaultSubTree (CbcModel * parent = NULL, int cutsOnlyAtRoot = 1,
    00214                                int numberStrong = 5,
    00215                                int numberBeforeTrust = 0,
    00216                                int printLevel = 0);
    00217
    00218     // Copy constructor
    00219     CbcStrategyDefaultSubTree ( const CbcStrategyDefaultSubTree &);
    00220
    00221     // Destructor
    00222     ~CbcStrategyDefaultSubTree ();
    00223
    00225     virtual CbcStrategy * clone() const;
    00226
    00228     virtual void setupCutGenerators(CbcModel & model);
    00230     virtual void setupHeuristics(CbcModel & model);
    00232     virtual void setupPrinting(CbcModel & model, int modelLogLevel) ;
    00234     virtual void setupOther(CbcModel & model);
    00235 protected:
    00236     // Data
    00237     // Parent model
    00238     CbcModel * parentModel_;
    00239     // Whether to do cuts only at root (-1 -> switch off totally)
    00240     int cutsOnlyAtRoot_;
    00241
    00242     // How much strong branching to do
    00243     int numberStrong_;
    00244
    00245     // Number branches needed to trust with dynamic pseudo costs
    00246     int numberBeforeTrust_;
    00247
    00248     // Print level 0 little, 1 medium
    00249     int printLevel_;
    00250
    00251 private:
    00253     CbcStrategyDefaultSubTree & operator=(const CbcStrategyDefaultSubTree& rhs);
    00254 };
    00255
    00256
    00257 #endif
    00258

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines