Cbc 2.10.5
Loading...
Searching...
No Matches
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"
10#include "OsiClpSolverInterface.hpp"
11
16public:
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 {
229 }
231 inline double reducedCostMultiplier() const
232 {
234 }
235
236protected:
237 // Data
293
294private:
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
315class CbcDisasterHandler : public OsiClpDisasterHandler {
316public:
320#ifdef JJF_ZERO
322 virtual void intoSimplex();
324 virtual bool check() const;
326 virtual void saveInfo();
327#endif
329 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
361protected:
366 CbcModel *cbcModel_;
367
369};
370#endif
371
372#endif
373
374/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
375*/
Feasibility Pump class.
double fakeCutoff_
Fake cutoff value.
double weightFactor() const
Get weight factor (default 0.1)
double weightFactor_
Factor for decreasing weight.
int fixOnReducedCosts_
Set whether to fix variables on known solution 0 - do not fix 1 - fix integers on reduced costs 2 - f...
void setAccumulate(int value)
Set use of multiple solutions and solves 0 - do not reuse solves, do not accumulate integer solutions...
void setMaximumRetries(int value)
Set maximum retries (default 1)
double iterationRatio() const
Get iteration to size ratio.
void setArtificialCost(double value)
Set threshold cost for using original cost - even on continuous (default infinity)
int solutionInternal(double &objectiveValue, double *newSolution)
Does real work.
int maximumRetries_
Maximum number of retries if we find a solution.
double initialWeight() const
Get initial weight (default 0.0 == off)
void setInitialWeight(double value)
Set initial weight (default 0.0 == off)
void setMaximumTime(double value)
Set maximum Time (default off) - also sets starttime to current.
void setReducedCostMultiplier(double value)
Set reduced cost multiplier 1.0 as normal <1.0 (x) - pretend gap is x* actual gap - just for fixing.
int fixOnReducedCosts() const
Get reduced cost option.
void setFakeCutoff(double value)
Set fake cutoff (default COIN_DBL_MAX == off)
int accumulate_
Set use of multiple solutions and solves 0 - do not reuse solves, do not accumulate integer solutions...
int maximumPasses_
Maximum number of passes.
CbcHeuristicFPump(const CbcHeuristicFPump &)
double iterationRatio_
If iterationRatio >0 use instead of maximumPasses_ test is iterations > ratio*(2*nrow+ncol)
int accumulate() const
Get accumulation option.
int solutionGeneral(double &objectiveValue, double *newSolution, int maxAround=1, bool fixSatisfied=false)
If general integers then adds variables to turn into binaries round solution.
double startTime_
Start time.
double maximumTime_
Maximum Cpu seconds.
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
double fakeCutoff() const
Get fake cutoff (default 0.0 == off)
double artificialCost_
Threshold cost for using original cost - even on continuous.
CbcHeuristicFPump(CbcModel &model, double downValue=0.5, bool roundExpensive=false)
double relativeIncrement_
If positive carry on after solution expecting gain of at least this times objective.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
void setAbsoluteIncrement(double value)
Set absolute increment (default 0.0 == off)
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...
double artificialCost() const
Get threshold cost for using original cost - even on continuous (default infinity)
void setMaximumPasses(int value)
Set maximum passes (default 100)
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 absoluteIncrement() const
Get absolute increment (default 0.0 == off)
int rounds(OsiSolverInterface *solver, double *solution, int numberIntegers, const int *integerVariable, int passNumber, double downValue=0.5, int *flip=0)
Rounds solution - down if < downValue If roundExpensive then always to more expnsive.
void setIterationRatio(double value)
Set iteration to size ratio.
double defaultRounding() const
Get default rounding (default 0.5)
double reducedCostMultiplier_
Reduced cost multiplier 1.0 as normal <1.0 (x) - pretend gap is x* actual gap - just for fixing.
int maximumRetries() const
Get maximum retries (default 1)
double relativeIncrement() const
Get relative increment (default 0.0 == off)
void setDefaultRounding(double value)
Set default rounding (default 0.5)
double absoluteIncrement_
If positive carry on after solution expecting gain of at least this.
int maximumPasses() const
Get maximum passes (default 100)
double defaultRounding_
Default is round up if > this.
double maximumTime() const
Get maximum Time (default 0.0 == time limit off)
CbcHeuristicFPump & operator=(const CbcHeuristicFPump &rhs)
Assignment operator.
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
double initialWeight_
Initial weight for true objective.
bool roundExpensive_
If true round to expensive.
void setRelativeIncrement(double value)
Set relative increment (default 0.0 == off)
virtual CbcHeuristic * clone() const
Clone.
void setWeightFactor(double value)
Set weight factor (default 0.1)
double reducedCostMultiplier() const
Get reduced cost multiplier.
Heuristic base class.
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...
Simple Branch and bound class.
Definition CbcModel.hpp:100