Cbc
2.10.10
|
Feasibility Pump class. More...
#include <CbcHeuristicFPump.hpp>
Public Member Functions | |
CbcHeuristicFPump () | |
CbcHeuristicFPump (CbcModel &model, double downValue=0.5, bool roundExpensive=false) | |
CbcHeuristicFPump (const CbcHeuristicFPump &) | |
~CbcHeuristicFPump () | |
CbcHeuristicFPump & | operator= (const CbcHeuristicFPump &rhs) |
Assignment operator. More... | |
virtual CbcHeuristic * | clone () const |
Clone. More... | |
virtual void | generateCpp (FILE *fp) |
Create C++ lines to get to current state. More... | |
virtual void | resetModel (CbcModel *model) |
Resets stuff if model changes. More... | |
virtual void | setModel (CbcModel *model) |
update model (This is needed if cliques update matrix etc) More... | |
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 solution values if good, sets objective value (only if good) This is called after cuts have been added - so can not add cuts. More... | |
int | solutionGeneral (double &objectiveValue, double *newSolution, int maxAround=1, bool fixSatisfied=false) |
If general integers then adds variables to turn into binaries round solution. More... | |
void | setMaximumTime (double value) |
Set maximum Time (default off) - also sets starttime to current. More... | |
double | maximumTime () const |
Get maximum Time (default 0.0 == time limit off) More... | |
void | setFakeCutoff (double value) |
Set fake cutoff (default COIN_DBL_MAX == off) More... | |
double | fakeCutoff () const |
Get fake cutoff (default 0.0 == off) More... | |
void | setAbsoluteIncrement (double value) |
Set absolute increment (default 0.0 == off) More... | |
double | absoluteIncrement () const |
Get absolute increment (default 0.0 == off) More... | |
void | setRelativeIncrement (double value) |
Set relative increment (default 0.0 == off) More... | |
double | relativeIncrement () const |
Get relative increment (default 0.0 == off) More... | |
void | setDefaultRounding (double value) |
Set default rounding (default 0.5) More... | |
double | defaultRounding () const |
Get default rounding (default 0.5) More... | |
void | setInitialWeight (double value) |
Set initial weight (default 0.0 == off) More... | |
double | initialWeight () const |
Get initial weight (default 0.0 == off) More... | |
void | setWeightFactor (double value) |
Set weight factor (default 0.1) More... | |
double | weightFactor () const |
Get weight factor (default 0.1) More... | |
void | setArtificialCost (double value) |
Set threshold cost for using original cost - even on continuous (default infinity) More... | |
double | artificialCost () const |
Get threshold cost for using original cost - even on continuous (default infinity) More... | |
double | iterationRatio () const |
Get iteration to size ratio. More... | |
void | setIterationRatio (double value) |
Set iteration to size ratio. More... | |
void | setMaximumPasses (int value) |
Set maximum passes (default 100) More... | |
int | maximumPasses () const |
Get maximum passes (default 100) More... | |
void | setMaximumRetries (int value) |
Set maximum retries (default 1) More... | |
int | maximumRetries () const |
Get maximum retries (default 1) More... | |
void | setAccumulate (int value) |
Set use of multiple solutions and solves 0 - do not reuse solves, do not accumulate integer solutions for local search 1 - do not reuse solves, accumulate integer solutions for local search 2 - reuse solves, do not accumulate integer solutions for local search 3 - reuse solves, accumulate integer solutions for local search If we add 4 then use second form of problem (with extra rows and variables for general integers) At some point (date?), I added. More... | |
int | accumulate () const |
Get accumulation option. More... | |
void | setFixOnReducedCosts (int value) |
Set whether to fix variables on known solution 0 - do not fix 1 - fix integers on reduced costs 2 - fix integers on reduced costs but only on entry. More... | |
int | fixOnReducedCosts () const |
Get reduced cost option. More... | |
void | setReducedCostMultiplier (double value) |
Set reduced cost multiplier 1.0 as normal <1.0 (x) - pretend gap is x* actual gap - just for fixing. More... | |
double | reducedCostMultiplier () const |
Get reduced cost multiplier. More... | |
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 solution values if good, sets objective value This is called after cuts have been added - so can not add cuts More... | |
![]() | |
CbcHeuristic () | |
CbcHeuristic (CbcModel &model) | |
CbcHeuristic (const CbcHeuristic &) | |
virtual | ~CbcHeuristic () |
CbcHeuristic & | operator= (const CbcHeuristic &rhs) |
Assignment operator. More... | |
virtual int | solution2 (double &, double *, OsiCuts &) |
returns 0 if no solution, 1 if valid solution, -1 if just returning an estimate of best possible solution with better objective value than one passed in Sets solution values if good, sets objective value (only if nonzero code) This is called at same time as cut generators - so can add cuts Default is do nothing More... | |
virtual void | validate () |
Validate model i.e. sets when_ to 0 if necessary (may be NULL) More... | |
void | setWhen (int value) |
Sets "when" flag - 0 off, 1 at root, 2 other than root, 3 always. More... | |
int | when () const |
Gets "when" flag - 0 off, 1 at root, 2 other than root, 3 always. More... | |
void | setNumberNodes (int value) |
Sets number of nodes in subtree (default 200) More... | |
int | numberNodes () const |
Gets number of nodes in a subtree (default 200) More... | |
void | setSwitches (int value) |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 16 bit - needs new solution to run 1024 bit - stop all heuristics on max time. More... | |
int | switches () const |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 16 bit - needs new solution to run 1024 bit - stop all heuristics on max time 65536 bit and above used for temporary communication. More... | |
bool | exitNow (double bestObjective) const |
Whether to exit at once on gap. More... | |
void | setFeasibilityPumpOptions (int value) |
Sets feasibility pump options (-1 is off) More... | |
int | feasibilityPumpOptions () const |
Gets feasibility pump options (-1 is off) More... | |
void | setModelOnly (CbcModel *model) |
Just set model - do not do anything else. More... | |
void | setFractionSmall (double value) |
Sets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0) More... | |
double | fractionSmall () const |
Gets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0) More... | |
int | numberSolutionsFound () const |
Get how many solutions the heuristic thought it got. More... | |
void | incrementNumberSolutionsFound () |
Increment how many solutions the heuristic thought it got. More... | |
int | smallBranchAndBound (OsiSolverInterface *solver, int numberNodes, double *newSolution, double &newSolutionValue, double cutoff, std::string name) const |
Do mini branch and bound - return 0 not finished - no solution 1 not finished - solution 2 finished - no solution 3 finished - solution (could add global cut if finished) -1 returned on size -2 time or user event. More... | |
void | generateCpp (FILE *fp, const char *heuristic) |
Create C++ lines to get to current state - does work for base class. More... | |
virtual bool | canDealWithOdd () const |
Returns true if can deal with "odd" problems e.g. sos type 2. More... | |
const char * | heuristicName () const |
return name of heuristic More... | |
void | setHeuristicName (const char *name) |
set name of heuristic More... | |
void | setSeed (int value) |
Set random number generator seed. More... | |
int | getSeed () const |
Get random number generator seed. More... | |
void | setDecayFactor (double value) |
Sets decay factor (for howOften) on failure. More... | |
void | setInputSolution (const double *solution, double objValue) |
Set input solution. More... | |
void | setWhereFrom (int value) |
int | whereFrom () const |
void | setShallowDepth (int value) |
Upto this depth we call the tree shallow and the heuristic can be called multiple times. More... | |
void | setHowOftenShallow (int value) |
How often to invoke the heuristics in the shallow part of the tree. More... | |
void | setMinDistanceToRun (int value) |
How "far" should this node be from every other where the heuristic was run in order to allow the heuristic to run in this node, too. More... | |
virtual bool | shouldHeurRun (int whereFrom) |
Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution. More... | |
bool | shouldHeurRun_randomChoice () |
Check whether the heuristic should run this time. More... | |
void | debugNodes () |
void | printDistanceToNodes () |
int | numRuns () const |
how many times the heuristic has actually run More... | |
int | numCouldRun () const |
How many times the heuristic could run. More... | |
double | trueObjValue (double value) const |
Return objective function value with sign corrected. More... | |
bool | isHeuristicInteger (const OsiSolverInterface *solver, int iColumn) |
Is it integer for heuristics? More... | |
OsiSolverInterface * | cloneBut (int type) |
Clone, but ... More... | |
Protected Attributes | |
double | startTime_ |
Start time. More... | |
double | maximumTime_ |
Maximum Cpu seconds. More... | |
double | fakeCutoff_ |
Fake cutoff value. More... | |
double | absoluteIncrement_ |
If positive carry on after solution expecting gain of at least this. More... | |
double | relativeIncrement_ |
If positive carry on after solution expecting gain of at least this times objective. More... | |
double | defaultRounding_ |
Default is round up if > this. More... | |
double | initialWeight_ |
Initial weight for true objective. More... | |
double | weightFactor_ |
Factor for decreasing weight. More... | |
double | artificialCost_ |
Threshold cost for using original cost - even on continuous. More... | |
double | iterationRatio_ |
If iterationRatio >0 use instead of maximumPasses_ test is iterations > ratio*(2*nrow+ncol) More... | |
double | reducedCostMultiplier_ |
Reduced cost multiplier 1.0 as normal <1.0 (x) - pretend gap is x* actual gap - just for fixing. More... | |
int | maximumPasses_ |
Maximum number of passes. More... | |
int | maximumRetries_ |
Maximum number of retries if we find a solution. More... | |
int | accumulate_ |
Set use of multiple solutions and solves 0 - do not reuse solves, do not accumulate integer solutions for local search 1 - do not reuse solves, accumulate integer solutions for local search 2 - reuse solves, do not accumulate integer solutions for local search 3 - reuse solves, accumulate integer solutions for local search If we add 4 then use second form of problem (with extra rows and variables for general integers) If we do not accumulate solutions then no mini branch and bounds will be done reuse - refers to initial solve after adding in new "cut" If we add 8 then can run after initial cuts (if no solution) 16 - extra rounding 32,64,128 - create binaries for general. More... | |
int | fixOnReducedCosts_ |
Set whether to fix variables on known solution 0 - do not fix 1 - fix integers on reduced costs 2 - fix integers on reduced costs but only on entry. More... | |
bool | roundExpensive_ |
If true round to expensive. More... | |
![]() | |
CbcModel * | model_ |
Model. More... | |
int | when_ |
When flag - 0 off, 1 at root, 2 other than root, 3 always. More... | |
int | numberNodes_ |
Number of nodes in any sub tree. More... | |
int | feasibilityPumpOptions_ |
Feasibility pump options , -1 is off >=0 for feasibility pump itself -2 quick proximity search -3 longer proximity search. More... | |
double | fractionSmall_ |
Fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound. More... | |
CoinThreadRandom | randomNumberGenerator_ |
Thread specific random number generator. More... | |
std::string | heuristicName_ |
Name for printing. More... | |
int | howOften_ |
How often to do (code can change) More... | |
double | decayFactor_ |
How much to increase how often. More... | |
int | switches_ |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 16 bit - needs new solution to run 1024 bit - stop all heuristics on max time. More... | |
int | whereFrom_ |
int | shallowDepth_ |
Upto this depth we call the tree shallow and the heuristic can be called multiple times. More... | |
int | howOftenShallow_ |
How often to invoke the heuristics in the shallow part of the tree. More... | |
int | numInvocationsInShallow_ |
How many invocations happened within the same node when in a shallow part of the tree. More... | |
int | numInvocationsInDeep_ |
How many invocations happened when in the deep part of the tree. More... | |
int | lastRunDeep_ |
After how many deep invocations was the heuristic run last time. More... | |
int | numRuns_ |
how many times the heuristic has actually run More... | |
int | minDistanceToRun_ |
How "far" should this node be from every other where the heuristic was run in order to allow the heuristic to run in this node, too. More... | |
CbcHeuristicNodeList | runNodes_ |
The description of the nodes where this heuristic has been applied. More... | |
int | numCouldRun_ |
How many times the heuristic could run. More... | |
int | numberSolutionsFound_ |
How many solutions the heuristic thought it got. More... | |
int | numberNodesDone_ |
How many nodes the heuristic did this go. More... | |
double * | inputSolution_ |
Private Member Functions | |
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. More... | |
int | solutionInternal (double &objectiveValue, double *newSolution) |
Does real work. More... | |
Feasibility Pump class.
Definition at line 15 of file CbcHeuristicFPump.hpp.
CbcHeuristicFPump::CbcHeuristicFPump | ( | ) |
CbcHeuristicFPump::CbcHeuristicFPump | ( | CbcModel & | model, |
double | downValue = 0.5 , |
||
bool | roundExpensive = false |
||
) |
CbcHeuristicFPump::CbcHeuristicFPump | ( | const CbcHeuristicFPump & | ) |
CbcHeuristicFPump::~CbcHeuristicFPump | ( | ) |
CbcHeuristicFPump& CbcHeuristicFPump::operator= | ( | const CbcHeuristicFPump & | rhs | ) |
Assignment operator.
|
virtual |
Clone.
Implements CbcHeuristic.
|
virtual |
Create C++ lines to get to current state.
Reimplemented from CbcHeuristic.
|
virtual |
Resets stuff if model changes.
Implements CbcHeuristic.
|
virtual |
update model (This is needed if cliques update matrix etc)
Reimplemented from CbcHeuristic.
|
virtual |
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value (only if good) This is called after cuts have been added - so can not add cuts.
It may make sense for user to call this outside Branch and Cut to get solution. Or normally is just at root node.
new meanings for when_ - on first try then set back to 1 11 - at end fix all integers at same bound throughout 12 - also fix all integers staying at same internal integral value throughout 13 - also fix all continuous variables staying at same bound throughout 14 - also fix all continuous variables staying at same internal value throughout 15 - as 13 but no internal integers And beyond that, it's apparently possible for the range to be between 21 and 25, in which case it's reduced on entry to solution() to be between 11 and 15 and allSlack is set to true. Then, if we're not processing general integers, we'll use an all-slack basis to solve ... what? Don't see that yet.
Implements CbcHeuristic.
int CbcHeuristicFPump::solutionGeneral | ( | double & | objectiveValue, |
double * | newSolution, | ||
int | maxAround = 1 , |
||
bool | fixSatisfied = false |
||
) |
If general integers then adds variables to turn into binaries round solution.
void CbcHeuristicFPump::setMaximumTime | ( | double | value | ) |
Set maximum Time (default off) - also sets starttime to current.
|
inline |
Get maximum Time (default 0.0 == time limit off)
Definition at line 74 of file CbcHeuristicFPump.hpp.
|
inline |
Set fake cutoff (default COIN_DBL_MAX == off)
Definition at line 79 of file CbcHeuristicFPump.hpp.
|
inline |
Get fake cutoff (default 0.0 == off)
Definition at line 84 of file CbcHeuristicFPump.hpp.
|
inline |
Set absolute increment (default 0.0 == off)
Definition at line 89 of file CbcHeuristicFPump.hpp.
|
inline |
Get absolute increment (default 0.0 == off)
Definition at line 94 of file CbcHeuristicFPump.hpp.
|
inline |
Set relative increment (default 0.0 == off)
Definition at line 99 of file CbcHeuristicFPump.hpp.
|
inline |
Get relative increment (default 0.0 == off)
Definition at line 104 of file CbcHeuristicFPump.hpp.
|
inline |
Set default rounding (default 0.5)
Definition at line 109 of file CbcHeuristicFPump.hpp.
|
inline |
Get default rounding (default 0.5)
Definition at line 114 of file CbcHeuristicFPump.hpp.
|
inline |
Set initial weight (default 0.0 == off)
Definition at line 119 of file CbcHeuristicFPump.hpp.
|
inline |
Get initial weight (default 0.0 == off)
Definition at line 124 of file CbcHeuristicFPump.hpp.
|
inline |
Set weight factor (default 0.1)
Definition at line 129 of file CbcHeuristicFPump.hpp.
|
inline |
Get weight factor (default 0.1)
Definition at line 134 of file CbcHeuristicFPump.hpp.
|
inline |
Set threshold cost for using original cost - even on continuous (default infinity)
Definition at line 139 of file CbcHeuristicFPump.hpp.
|
inline |
Get threshold cost for using original cost - even on continuous (default infinity)
Definition at line 144 of file CbcHeuristicFPump.hpp.
|
inline |
Get iteration to size ratio.
Definition at line 149 of file CbcHeuristicFPump.hpp.
|
inline |
Set iteration to size ratio.
Definition at line 154 of file CbcHeuristicFPump.hpp.
|
inline |
Set maximum passes (default 100)
Definition at line 159 of file CbcHeuristicFPump.hpp.
|
inline |
Get maximum passes (default 100)
Definition at line 164 of file CbcHeuristicFPump.hpp.
|
inline |
Set maximum retries (default 1)
Definition at line 169 of file CbcHeuristicFPump.hpp.
|
inline |
Get maximum retries (default 1)
Definition at line 174 of file CbcHeuristicFPump.hpp.
|
inline |
Set use of multiple solutions and solves 0 - do not reuse solves, do not accumulate integer solutions for local search 1 - do not reuse solves, accumulate integer solutions for local search 2 - reuse solves, do not accumulate integer solutions for local search 3 - reuse solves, accumulate integer solutions for local search If we add 4 then use second form of problem (with extra rows and variables for general integers) At some point (date?), I added.
And then there are a few bit fields: 4 - something about general integers So my (lh) guess for 4 was at least in the ballpark, but I'll have to rethink 8 entirely (and it may well not mean the same thing as it did when I added that comment. 8 - determines whether we process general integers
And on 090831, John added
If we add 4 then use second form of problem (with extra rows and variables for general integers) If we add 8 then can run after initial cuts (if no solution)
Definition at line 199 of file CbcHeuristicFPump.hpp.
|
inline |
Get accumulation option.
Definition at line 204 of file CbcHeuristicFPump.hpp.
|
inline |
Set whether to fix variables on known solution 0 - do not fix 1 - fix integers on reduced costs 2 - fix integers on reduced costs but only on entry.
Definition at line 213 of file CbcHeuristicFPump.hpp.
|
inline |
Get reduced cost option.
Definition at line 218 of file CbcHeuristicFPump.hpp.
|
inline |
Set reduced cost multiplier 1.0 as normal <1.0 (x) - pretend gap is x* actual gap - just for fixing.
Definition at line 226 of file CbcHeuristicFPump.hpp.
|
inline |
Get reduced cost multiplier.
Definition at line 231 of file CbcHeuristicFPump.hpp.
|
private |
Rounds solution - down if < downValue If roundExpensive then always to more expnsive.
returns 0 if current is solution
|
private |
Does real work.
virtual int CbcHeuristic::solution |
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value This is called after cuts have been added - so can not add cuts
|
protected |
Start time.
Definition at line 239 of file CbcHeuristicFPump.hpp.
|
protected |
Maximum Cpu seconds.
Definition at line 241 of file CbcHeuristicFPump.hpp.
|
protected |
Fake cutoff value.
If set then better of real cutoff and this used to add a constraint
Definition at line 245 of file CbcHeuristicFPump.hpp.
|
protected |
If positive carry on after solution expecting gain of at least this.
Definition at line 247 of file CbcHeuristicFPump.hpp.
|
protected |
If positive carry on after solution expecting gain of at least this times objective.
Definition at line 249 of file CbcHeuristicFPump.hpp.
|
protected |
Default is round up if > this.
Definition at line 251 of file CbcHeuristicFPump.hpp.
|
protected |
Initial weight for true objective.
Definition at line 253 of file CbcHeuristicFPump.hpp.
|
protected |
Factor for decreasing weight.
Definition at line 255 of file CbcHeuristicFPump.hpp.
|
protected |
Threshold cost for using original cost - even on continuous.
Definition at line 257 of file CbcHeuristicFPump.hpp.
|
protected |
If iterationRatio >0 use instead of maximumPasses_ test is iterations > ratio*(2*nrow+ncol)
Definition at line 260 of file CbcHeuristicFPump.hpp.
|
protected |
Reduced cost multiplier 1.0 as normal <1.0 (x) - pretend gap is x* actual gap - just for fixing.
Definition at line 265 of file CbcHeuristicFPump.hpp.
|
protected |
Maximum number of passes.
Definition at line 267 of file CbcHeuristicFPump.hpp.
|
protected |
Maximum number of retries if we find a solution.
If negative we clean out used array
Definition at line 271 of file CbcHeuristicFPump.hpp.
|
protected |
Set use of multiple solutions and solves 0 - do not reuse solves, do not accumulate integer solutions for local search 1 - do not reuse solves, accumulate integer solutions for local search 2 - reuse solves, do not accumulate integer solutions for local search 3 - reuse solves, accumulate integer solutions for local search If we add 4 then use second form of problem (with extra rows and variables for general integers) If we do not accumulate solutions then no mini branch and bounds will be done reuse - refers to initial solve after adding in new "cut" If we add 8 then can run after initial cuts (if no solution) 16 - extra rounding 32,64,128 - create binaries for general.
Definition at line 284 of file CbcHeuristicFPump.hpp.
|
protected |
Set whether to fix variables on known solution 0 - do not fix 1 - fix integers on reduced costs 2 - fix integers on reduced costs but only on entry.
Definition at line 290 of file CbcHeuristicFPump.hpp.
|
protected |
If true round to expensive.
Definition at line 292 of file CbcHeuristicFPump.hpp.