Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbcStrategy.hpp
Go to the documentation of this file.
1 /* $Id: CbcStrategy.hpp 1573 2011-01-05 01:12:36Z lou $ */
2 // Copyright (C) 2005, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CbcStrategy_H
7 #define CbcStrategy_H
8 
9 #include "CbcModel.hpp"
10 class CglPreProcess;
11 class CbcNodeInfo;
12 class CbcNode;
13 class CoinWarmStartDiff;
14 
15 //#############################################################################
18 class CbcStrategy {
19 public:
20  // Default Constructor
21  CbcStrategy ();
22 
23  virtual ~CbcStrategy();
24 
26  virtual CbcStrategy * clone() const = 0;
27 
29  virtual void setupCutGenerators(CbcModel & model) = 0;
31  virtual void setupHeuristics(CbcModel & model) = 0;
33  virtual void setupPrinting(CbcModel & model, int modelLogLevel) = 0;
35  virtual void setupOther(CbcModel & model) = 0;
37  inline void setNested(int depth) {
38  depth_ = depth;
39  }
41  inline int getNested() const {
42  return depth_;
43  }
45  inline void setPreProcessState(int state) {
46  preProcessState_ = state;
47  }
49  inline int preProcessState() const {
50  return preProcessState_;
51  }
53  inline CglPreProcess * process() const {
54  return process_;
55  }
57  void deletePreProcess();
59  virtual CbcNodeInfo * fullNodeInfo(CbcModel * model, int numberRowsAtContinuous) const;
61  virtual CbcNodeInfo * partialNodeInfo(CbcModel * model, CbcNodeInfo * parent, CbcNode * owner,
62  int numberChangedBounds, const int * variables,
63  const double * boundChanges,
64  const CoinWarmStartDiff *basisDiff) const;
66  virtual void generateCpp( FILE * ) {}
73  virtual int status(CbcModel * model, CbcNodeInfo * parent, int whereFrom);
74 private:
75 
77  CbcStrategy & operator=(const CbcStrategy& rhs);
78 protected:
79  // Data
81  int depth_;
90 };
91 
95 class CbcStrategyNull : public CbcStrategy {
96 public:
97 
98  // Default Constructor
100 
101  // Copy constructor
102  CbcStrategyNull ( const CbcStrategyNull & rhs) : CbcStrategy(rhs) {}
103 
104  // Destructor
106 
108  virtual CbcStrategy * clone() const {
109  return new CbcStrategyNull(*this);
110  }
111 
113  virtual void setupCutGenerators(CbcModel & ) {}
115  virtual void setupHeuristics(CbcModel & ) {}
117  virtual void setupPrinting(CbcModel & , int ) {}
119  virtual void setupOther(CbcModel & ) {}
120 
121 protected:
122  // Data
123 private:
126 };
127 
132 public:
133 
134  // Default Constructor
135  CbcStrategyDefault (int cutsOnlyAtRoot = 1,
136  int numberStrong = 5,
137  int numberBeforeTrust = 0,
138  int printLevel = 0);
139 
140  // Copy constructor
142 
143  // Destructor
145 
147  virtual CbcStrategy * clone() const;
148 
150  virtual void setupCutGenerators(CbcModel & model);
152  virtual void setupHeuristics(CbcModel & model);
154  virtual void setupPrinting(CbcModel & model, int modelLogLevel) ;
156  virtual void setupOther(CbcModel & model);
158  inline void setupPreProcessing(int desired = 1, int passes = 10) {
159  desiredPreProcess_ = desired;
160  preProcessPasses_ = passes;
161  }
163  inline int desiredPreProcess() const {
164  return desiredPreProcess_;
165  }
167  inline int preProcessPasses() const {
168  return preProcessPasses_;
169  }
171  virtual void generateCpp( FILE * fp) ;
172 
173 protected:
174  // Data
175 
176  // Whether to do cuts only at root (-1 -> switch off totally)
178 
179  // How much strong branching to do
181 
182  // Number branches needed to trust with dynamic pseudo costs
184 
185  // Print level 0 little, 1 medium
187 
199 
200 private:
203 };
204 
205 
210 public:
211 
212  // Default Constructor
213  CbcStrategyDefaultSubTree (CbcModel * parent = NULL, int cutsOnlyAtRoot = 1,
214  int numberStrong = 5,
215  int numberBeforeTrust = 0,
216  int printLevel = 0);
217 
218  // Copy constructor
220 
221  // Destructor
223 
225  virtual CbcStrategy * clone() const;
226 
228  virtual void setupCutGenerators(CbcModel & model);
230  virtual void setupHeuristics(CbcModel & model);
232  virtual void setupPrinting(CbcModel & model, int modelLogLevel) ;
234  virtual void setupOther(CbcModel & model);
235 protected:
236  // Data
237  // Parent model
239  // Whether to do cuts only at root (-1 -> switch off totally)
241 
242  // How much strong branching to do
244 
245  // Number branches needed to trust with dynamic pseudo costs
247 
248  // Print level 0 little, 1 medium
250 
251 private:
254 };
255 
256 
257 #endif
258 
int preProcessPasses() const
See how many passes wanted.
int preProcessState_
PreProcessing state - -1 infeasible 0 off 1 was done (so need post-processing)
Definition: CbcStrategy.hpp:87
CbcStrategyDefault & operator=(const CbcStrategyDefault &rhs)
Illegal Assignment operator.
CglPreProcess * process() const
Pre-processing object.
Definition: CbcStrategy.hpp:53
CbcStrategy & operator=(const CbcStrategy &rhs)
Illegal Assignment operator.
virtual CbcNodeInfo * fullNodeInfo(CbcModel *model, int numberRowsAtContinuous) const
Return a new Full node information pointer (descendant of CbcFullNodeInfo)
virtual void setupCutGenerators(CbcModel &model)
Setup cut generators.
virtual void setupHeuristics(CbcModel &model)
Setup heuristics.
virtual CbcStrategy * clone() const
Clone.
Default class for sub trees.
virtual CbcStrategy * clone() const
Clone.
virtual void setupCutGenerators(CbcModel &model)=0
Setup cut generators.
virtual void setupOther(CbcModel &)
Other stuff e.g. strong branching.
void setPreProcessState(int state)
Say preProcessing done.
Definition: CbcStrategy.hpp:45
virtual CbcNodeInfo * partialNodeInfo(CbcModel *model, CbcNodeInfo *parent, CbcNode *owner, int numberChangedBounds, const int *variables, const double *boundChanges, const CoinWarmStartDiff *basisDiff) const
Return a new Partial node information pointer (descendant of CbcPartialNodeInfo)
virtual void setupCutGenerators(CbcModel &)
Setup cut generators.
virtual void setupOther(CbcModel &model)
Other stuff e.g. strong branching.
int preProcessState() const
See what sort of preprocessing was done.
Definition: CbcStrategy.hpp:49
virtual void setupPrinting(CbcModel &model, int modelLogLevel)
Do printing stuff.
CbcStrategyDefaultSubTree(CbcModel *parent=NULL, int cutsOnlyAtRoot=1, int numberStrong=5, int numberBeforeTrust=0, int printLevel=0)
CbcStrategyDefaultSubTree & operator=(const CbcStrategyDefaultSubTree &rhs)
Illegal Assignment operator.
int desiredPreProcess_
Desired pre-processing 0 - none 1 - ordinary 2 - find sos 3 - find cliques 4 - more aggressive sos 5 ...
void setNested(int depth)
Set model depth (i.e. how nested)
Definition: CbcStrategy.hpp:37
virtual void setupOther(CbcModel &model)
Other stuff e.g. strong branching.
virtual void setupCutGenerators(CbcModel &model)
Setup cut generators.
void deletePreProcess()
Delete pre-processing object to save memory.
virtual ~CbcStrategy()
Information required while the node is live.
Definition: CbcNode.hpp:49
virtual void setupPrinting(CbcModel &, int)
Do printing stuff.
CbcStrategyDefault(int cutsOnlyAtRoot=1, int numberStrong=5, int numberBeforeTrust=0, int printLevel=0)
Null class.
Definition: CbcStrategy.hpp:95
virtual void setupHeuristics(CbcModel &model)=0
Setup heuristics.
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
virtual void setupPrinting(CbcModel &model, int modelLogLevel)
Do printing stuff.
virtual void setupHeuristics(CbcModel &model)
Setup heuristics.
int desiredPreProcess() const
See what sort of preprocessing wanted.
virtual void setupPrinting(CbcModel &model, int modelLogLevel)=0
Do printing stuff.
virtual CbcStrategy * clone() const =0
Clone.
CbcStrategyNull(const CbcStrategyNull &rhs)
Information required to recreate the subproblem at this node.
Definition: CbcNodeInfo.hpp:68
Abstract base class for warm start `diff' objects.
CbcStrategyNull & operator=(const CbcStrategyNull &rhs)
Illegal Assignment operator.
virtual void setupOther(CbcModel &model)=0
Other stuff e.g. strong branching and preprocessing.
int getNested() const
Get model depth (i.e. how nested)
Definition: CbcStrategy.hpp:41
virtual void setupHeuristics(CbcModel &)
Setup heuristics.
int depth_
Model depth.
Definition: CbcStrategy.hpp:81
virtual void generateCpp(FILE *)
Create C++ lines to get to current state.
Definition: CbcStrategy.hpp:66
virtual int status(CbcModel *model, CbcNodeInfo *parent, int whereFrom)
After a CbcModel::resolve this can return a status -1 no effect 0 treat as optimal 1 as 0 but do not ...
Class for preProcessing and postProcessing.
virtual CbcStrategy * clone() const
Clone.
int preProcessPasses_
Number of pre-processing passes.
Simple Branch and bound class.
Definition: CbcModel.hpp:101
void setupPreProcessing(int desired=1, int passes=10)
Set up preProcessing - see below.
CglPreProcess * process_
If preprocessing then this is object.
Definition: CbcStrategy.hpp:89
Strategy base class.
Definition: CbcStrategy.hpp:18
Default class.