Cbc  2.9.8
CbcHeuristicFPump.hpp
Go to the documentation of this file.
1 /* $Id: CbcHeuristicFPump.hpp 1573 2011-01-05 01:12:36Z lou $ */
2 // Copyright (C) 2004, 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 CbcHeuristicFeasibilityPump_H
7 #define CbcHeuristicFeasibilityPump_H
8 
9 #include "CbcHeuristic.hpp"
10 #include "OsiClpSolverInterface.hpp"
11 
16 public:
17 
18  // Default Constructor
20 
21  // Constructor with model - assumed before cuts
22  CbcHeuristicFPump (CbcModel & model,
23  double downValue = 0.5, bool roundExpensive = false);
24 
25  // Copy constructor
27 
28  // Destructor
30 
34  virtual CbcHeuristic * clone() const;
36  virtual void generateCpp( FILE * fp) ;
37 
39  virtual void resetModel(CbcModel * model);
40 
42  virtual void setModel(CbcModel * model);
43 
65  virtual int solution(double & objectiveValue,
66  double * newSolution);
67 
69  void setMaximumTime(double value);
71  inline double maximumTime() const {
72  return maximumTime_;
73  }
75  inline void setFakeCutoff(double value) {
76  fakeCutoff_ = value;
77  }
79  inline double fakeCutoff() const {
80  return fakeCutoff_;
81  }
83  inline void setAbsoluteIncrement(double value) {
84  absoluteIncrement_ = value;
85  }
87  inline double absoluteIncrement() const {
88  return absoluteIncrement_;
89  }
91  inline void setRelativeIncrement(double value) {
92  relativeIncrement_ = value;
93  }
95  inline double relativeIncrement() const {
96  return relativeIncrement_;
97  }
99  inline void setDefaultRounding(double value) {
100  defaultRounding_ = value;
101  }
103  inline double defaultRounding() const {
104  return defaultRounding_;
105  }
107  inline void setInitialWeight(double value) {
108  initialWeight_ = value;
109  }
111  inline double initialWeight() const {
112  return initialWeight_;
113  }
115  inline void setWeightFactor(double value) {
116  weightFactor_ = value;
117  }
119  inline double weightFactor() const {
120  return weightFactor_;
121  }
123  inline void setArtificialCost(double value) {
124  artificialCost_ = value;
125  }
127  inline double artificialCost() const {
128  return artificialCost_;
129  }
131  inline double iterationRatio() const {
132  return iterationRatio_;
133  }
135  inline void setIterationRatio(double value) {
136  iterationRatio_ = value;
137  }
139  inline void setMaximumPasses(int value) {
140  maximumPasses_ = value;
141  }
143  inline int maximumPasses() const {
144  return maximumPasses_;
145  }
147  inline void setMaximumRetries(int value) {
148  maximumRetries_ = value;
149  }
151  inline int maximumRetries() const {
152  return maximumRetries_;
153  }
175  inline void setAccumulate(int value) {
176  accumulate_ = value;
177  }
179  inline int accumulate() const {
180  return accumulate_;
181  }
187  inline void setFixOnReducedCosts(int value) {
188  fixOnReducedCosts_ = value;
189  }
191  inline int fixOnReducedCosts() const {
192  return fixOnReducedCosts_;
193  }
198  inline void setReducedCostMultiplier(double value) {
199  reducedCostMultiplier_ = value;
200  }
202  inline double reducedCostMultiplier() const {
203  return reducedCostMultiplier_;
204  }
205 
206 protected:
207  // Data
209  double startTime_;
211  double maximumTime_;
215  double fakeCutoff_;
261 
262 private:
267  int rounds(OsiSolverInterface * solver, double * solution,
268  /*const double * objective, */
269  int numberIntegers, const int * integerVariable,
270  /*char * pumpPrint,*/int passNumber,
271  /*bool roundExpensive=false,*/
272  double downValue = 0.5, int *flip = 0);
273  /* note for eagle eyed readers.
274  when_ can now be exotic -
275  <=10 normal
276  */
277 };
278 
279 # ifdef COIN_HAS_CLP
280 
281 class CbcDisasterHandler : public OsiClpDisasterHandler {
282 public:
286 #ifdef JJF_ZERO
287  virtual void intoSimplex();
290  virtual bool check() const ;
292  virtual void saveInfo();
293 #endif
294  virtual int typeOfDisaster();
297 
298 
303  CbcDisasterHandler(CbcModel * model = NULL);
305  virtual ~CbcDisasterHandler();
306  // Copy
307  CbcDisasterHandler(const CbcDisasterHandler&);
308  // Assignment
309  CbcDisasterHandler& operator=(const CbcDisasterHandler&);
311  virtual ClpDisasterHandler * clone() const;
312 
314 
319  void setCbcModel(CbcModel * model);
321  inline CbcModel * cbcModel() const {
322  return cbcModel_;
323  }
324 
326 
327 
328 protected:
332  CbcModel * cbcModel_;
334 
336 };
337 #endif
338 
339 #endif
340 
void setDefaultRounding(double value)
Set default rounding (default 0.5)
void setAccumulate(int value)
Set use of multiple solutions and solves 0 - do not reuse solves, do not accumulate integer solutions...
double maximumTime_
Maximum Cpu seconds.
double weightFactor() const
Get weight factor (default 0.1)
int maximumPasses_
Maximum number of passes.
void setRelativeIncrement(double value)
Set relative increment (default 0.0 == off)
void setMaximumRetries(int value)
Set maximum retries (default 1)
double maximumTime() const
Get maximum Time (default 0.0 == time limit off)
double relativeIncrement() const
Get relative increment (default 0.0 == off)
int fixOnReducedCosts_
Set whether to fix variables on known solution 0 - do not fix 1 - fix integers on reduced costs 2 - f...
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets sol...
int maximumRetries_
Maximum number of retries if we find a solution.
void setFixOnReducedCosts(int value)
Set whether to fix variables on known solution 0 - do not fix 1 - fix integers on reduced costs 2 - f...
double reducedCostMultiplier() const
Get reduced cost multiplier.
void setWeightFactor(double value)
Set weight factor (default 0.1)
double startTime_
Start time.
void setArtificialCost(double value)
Set threshold cost for using original cost - even on continuous (default infinity) ...
int accumulate() const
Get accumulation option.
double artificialCost_
Threshold cost for using original cost - even on continuous.
double initialWeight() const
Get initial weight (default 0.0 == off)
void setMaximumPasses(int value)
Set maximum passes (default 100)
double iterationRatio() const
Get iteration to size ratio.
void setReducedCostMultiplier(double value)
Set reduced cost multiplier 1.0 as normal <1.0 (x) - pretend gap is x* actual gap - just for fixing...
double artificialCost() const
Get threshold cost for using original cost - even on continuous (default infinity) ...
int accumulate_
Set use of multiple solutions and solves 0 - do not reuse solves, do not accumulate integer solutions...
void setInitialWeight(double value)
Set initial weight (default 0.0 == off)
double reducedCostMultiplier_
Reduced cost multiplier 1.0 as normal <1.0 (x) - pretend gap is x* actual gap - just for fixing...
double weightFactor_
Factor for decreasing weight.
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
double defaultRounding() const
Get default rounding (default 0.5)
void setMaximumTime(double value)
Set maximum Time (default off) - also sets starttime to current.
CbcHeuristicFPump & operator=(const CbcHeuristicFPump &rhs)
Assignment operator.
double relativeIncrement_
If positive carry on after solution expecting gain of at least this times objective.
double initialWeight_
Initial weight for true objective.
double absoluteIncrement_
If positive carry on after solution expecting gain of at least this.
virtual CbcHeuristic * clone() const
Clone.
int maximumRetries() const
Get maximum retries (default 1)
void setAbsoluteIncrement(double value)
Set absolute increment (default 0.0 == off)
double fakeCutoff() const
Get fake cutoff (default 0.0 == off)
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
Heuristic base class.
int fixOnReducedCosts() const
Get reduced cost option.
double fakeCutoff_
Fake cutoff value.
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
virtual int solution(double &objectiveValue, double *newSolution)=0
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets sol...
void setIterationRatio(double value)
Set iteration to size ratio.
double iterationRatio_
If iterationRatio >0 use instead of maximumPasses_ test is iterations > ratio*(2*nrow+ncol) ...
Feasibility Pump class.
double defaultRounding_
Default is round up if > this.
bool roundExpensive_
If true round to expensive.
Simple Branch and bound class.
Definition: CbcModel.hpp:101
double absoluteIncrement() const
Get absolute increment (default 0.0 == off)
void setFakeCutoff(double value)
Set fake cutoff (default COIN_DBL_MAX == off)
int maximumPasses() const
Get maximum passes (default 100)