Cbc  2.10.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbcHeuristicFPump.hpp
Go to the documentation of this file.
1 /* $Id: CbcHeuristicFPump.hpp 2465 2019-01-03 19:26:52Z unxusr $ */
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"
11 
16 public:
17  // Default Constructor
19 
20  // Constructor with model - assumed before cuts
22  double downValue = 0.5, bool roundExpensive = false);
23 
24  // Copy constructor
26 
27  // Destructor
29 
33  virtual CbcHeuristic *clone() const;
35  virtual void generateCpp(FILE *fp);
36 
38  virtual void resetModel(CbcModel *model);
39 
41  virtual void setModel(CbcModel *model);
42 
64  virtual int solution(double &objectiveValue,
65  double *newSolution);
69  int solutionGeneral(double &objectiveValue, double *newSolution,
70  int maxAround = 1, bool fixSatisfied = false);
72  void setMaximumTime(double value);
74  inline double maximumTime() const
75  {
76  return maximumTime_;
77  }
79  inline void setFakeCutoff(double value)
80  {
81  fakeCutoff_ = value;
82  }
84  inline double fakeCutoff() const
85  {
86  return fakeCutoff_;
87  }
89  inline void setAbsoluteIncrement(double value)
90  {
91  absoluteIncrement_ = value;
92  }
94  inline double absoluteIncrement() const
95  {
96  return absoluteIncrement_;
97  }
99  inline void setRelativeIncrement(double value)
100  {
101  relativeIncrement_ = value;
102  }
104  inline double relativeIncrement() const
105  {
106  return relativeIncrement_;
107  }
109  inline void setDefaultRounding(double value)
110  {
111  defaultRounding_ = value;
112  }
114  inline double defaultRounding() const
115  {
116  return defaultRounding_;
117  }
119  inline void setInitialWeight(double value)
120  {
121  initialWeight_ = value;
122  }
124  inline double initialWeight() const
125  {
126  return initialWeight_;
127  }
129  inline void setWeightFactor(double value)
130  {
131  weightFactor_ = value;
132  }
134  inline double weightFactor() const
135  {
136  return weightFactor_;
137  }
139  inline void setArtificialCost(double value)
140  {
141  artificialCost_ = value;
142  }
144  inline double artificialCost() const
145  {
146  return artificialCost_;
147  }
149  inline double iterationRatio() const
150  {
151  return iterationRatio_;
152  }
154  inline void setIterationRatio(double value)
155  {
156  iterationRatio_ = value;
157  }
159  inline void setMaximumPasses(int value)
160  {
161  maximumPasses_ = value;
162  }
164  inline int maximumPasses() const
165  {
166  return maximumPasses_;
167  }
169  inline void setMaximumRetries(int value)
170  {
171  maximumRetries_ = value;
172  }
174  inline int maximumRetries() const
175  {
176  return maximumRetries_;
177  }
199  inline void setAccumulate(int value)
200  {
201  accumulate_ = value;
202  }
204  inline int accumulate() const
205  {
206  return accumulate_;
207  }
213  inline void setFixOnReducedCosts(int value)
214  {
215  fixOnReducedCosts_ = value;
216  }
218  inline int fixOnReducedCosts() const
219  {
220  return fixOnReducedCosts_;
221  }
226  inline void setReducedCostMultiplier(double value)
227  {
228  reducedCostMultiplier_ = value;
229  }
231  inline double reducedCostMultiplier() const
232  {
233  return reducedCostMultiplier_;
234  }
235 
236 protected:
237  // Data
239  double startTime_;
241  double maximumTime_;
245  double fakeCutoff_;
293 
294 private:
299  int rounds(OsiSolverInterface *solver, double *solution,
300  /*const double * objective, */
301  int numberIntegers, const int *integerVariable,
302  /*char * pumpPrint,*/ int passNumber,
303  /*bool roundExpensive=false,*/
304  double downValue = 0.5, int *flip = 0);
306  int solutionInternal(double &objectiveValue, double *newSolution);
307  /* note for eagle eyed readers.
308  when_ can now be exotic -
309  <=10 normal
310  */
311 };
312 
313 #ifdef COIN_HAS_CLP
314 
315 class CbcDisasterHandler : public OsiClpDisasterHandler {
316 public:
320 #ifdef JJF_ZERO
321  virtual void intoSimplex();
324  virtual bool check() const;
326  virtual void saveInfo();
327 #endif
328  virtual int typeOfDisaster();
331 
336  CbcDisasterHandler(CbcModel *model = NULL);
338  virtual ~CbcDisasterHandler();
339  // Copy
340  CbcDisasterHandler(const CbcDisasterHandler &);
341  // Assignment
342  CbcDisasterHandler &operator=(const CbcDisasterHandler &);
344  virtual ClpDisasterHandler *clone() const;
345 
347 
352  void setCbcModel(CbcModel *model);
354  inline CbcModel *cbcModel() const
355  {
356  return cbcModel_;
357  }
358 
360 
361 protected:
365  CbcModel *cbcModel_;
367 
369 };
370 #endif
371 
372 #endif
373 
374 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
375 */
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.
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)
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...
int maximumPasses() const
Get maximum passes (default 100)
double reducedCostMultiplier() const
Get reduced cost multiplier.
int maximumRetries() const
Get maximum retries (default 1)
int solutionInternal(double &objectiveValue, double *newSolution)
Does real work.
Base class for Clp disaster handling.
double absoluteIncrement() const
Get absolute increment (default 0.0 == off)
void setWeightFactor(double value)
Set weight factor (default 0.1)
double startTime_
Start time.
virtual int typeOfDisaster()
Type of disaster 0 can fix, 1 abort.
double weightFactor() const
Get weight factor (default 0.1)
void setArtificialCost(double value)
Set threshold cost for using original cost - even on continuous (default infinity) ...
double artificialCost_
Threshold cost for using original cost - even on continuous.
Abstract Base Class for describing an interface to a solver.
double maximumTime() const
Get maximum Time (default 0.0 == time limit off)
void setMaximumPasses(int value)
Set maximum passes (default 100)
int solutionGeneral(double &objectiveValue, double *newSolution, int maxAround=1, bool fixSatisfied=false)
If general integers then adds variables to turn into binaries round solution.
void setReducedCostMultiplier(double value)
Set reduced cost multiplier 1.0 as normal &lt;1.0 (x) - pretend gap is x* actual gap - just for fixing...
virtual bool check() const
Checks if disaster.
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 defaultRounding() const
Get default rounding (default 0.5)
double reducedCostMultiplier_
Reduced cost multiplier 1.0 as normal &lt;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 initialWeight() const
Get initial weight (default 0.0 == off)
virtual void intoSimplex()
Into simplex.
void setMaximumTime(double value)
Set maximum Time (default off) - also sets starttime to current.
virtual ClpDisasterHandler * clone() const
Clone.
int rounds(OsiSolverInterface *solver, double *solution, int numberIntegers, const int *integerVariable, int passNumber, double downValue=0.5, int *flip=0)
Rounds solution - down if &lt; downValue If roundExpensive then always to more expnsive.
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.
void setAbsoluteIncrement(double value)
Set absolute increment (default 0.0 == off)
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
Heuristic base class.
double iterationRatio() const
Get iteration to size ratio.
double fakeCutoff_
Fake cutoff value.
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
double fakeCutoff() const
Get fake cutoff (default 0.0 == off)
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 relativeIncrement() const
Get relative increment (default 0.0 == off)
double iterationRatio_
If iterationRatio &gt;0 use instead of maximumPasses_ test is iterations &gt; ratio*(2*nrow+ncol) ...
int accumulate() const
Get accumulation option.
OsiClpDisasterHandler & operator=(const OsiClpDisasterHandler &)
Feasibility Pump class.
int fixOnReducedCosts() const
Get reduced cost option.
double artificialCost() const
Get threshold cost for using original cost - even on continuous (default infinity) ...
virtual void saveInfo()
saves information for next attempt
double defaultRounding_
Default is round up if &gt; this.
bool roundExpensive_
If true round to expensive.
Simple Branch and bound class.
Definition: CbcModel.hpp:100
void setFakeCutoff(double value)
Set fake cutoff (default COIN_DBL_MAX == off)
virtual CbcHeuristic * clone() const
Clone.