source: trunk/Cbc/src/CbcHeuristicFPump.hpp @ 758

Last change on this file since 758 was 758, checked in by forrest, 13 years ago

fpump - make dj fixing optional

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.8 KB
Line 
1// Copyright (C) 2004, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef CbcHeuristicFeasibilityPump_H
4#define CbcHeuristicFeasibilityPump_H
5
6#include "CbcHeuristic.hpp"
7
8/** Rounding class
9 */
10
11class CbcHeuristicFPump : public CbcHeuristic {
12public:
13
14  // Default Constructor
15  CbcHeuristicFPump ();
16
17  // Constructor with model - assumed before cuts
18  CbcHeuristicFPump (CbcModel & model,
19                     double downValue=0.5,bool roundExpensive=false);
20 
21  // Copy constructor
22  CbcHeuristicFPump ( const CbcHeuristicFPump &);
23   
24  // Destructor
25  ~CbcHeuristicFPump ();
26 
27  /// Assignment operator
28  CbcHeuristicFPump & operator=(const CbcHeuristicFPump& rhs);
29  /// Clone
30  virtual CbcHeuristic * clone() const;
31  /// Create C++ lines to get to current state
32  virtual void generateCpp( FILE * fp) ;
33
34  /// Resets stuff if model changes
35  virtual void resetModel(CbcModel * model);
36
37  /// update model (This is needed if cliques update matrix etc)
38  virtual void setModel(CbcModel * model);
39 
40  /** returns 0 if no solution, 1 if valid solution
41      with better objective value than one passed in
42      Sets solution values if good, sets objective value (only if good)
43      This is called after cuts have been added - so can not add cuts.
44
45      It may make sense for user to call this outside Branch and Cut to
46      get solution.  Or normally is just at root node.
47
48      * new meanings for when_ - on first try then set back to 1
49        11 - at end fix all integers at same bound throughout
50        12 - also fix all integers staying at same internal integral value throughout
51        13 - also fix all continuous variables staying at same bound throughout
52        14 - also fix all continuous variables staying at same internal value throughout
53        15 - as 13 but no internal integers
54  */
55  virtual int solution(double & objectiveValue,
56                       double * newSolution);
57
58  /// Set maximum Time (default off) - also sets starttime to current
59  void setMaximumTime(double value);
60  /// Get maximum Time (default 0.0 == time limit off)
61  inline double maximumTime() const
62  { return maximumTime_;}
63  /// Set fake cutoff (default COIN_DBL_MAX == off)
64  inline void setFakeCutoff(double value)
65  { fakeCutoff_ = value;}
66  /// Get fake cutoff (default 0.0 == off)
67  inline double fakeCutoff() const
68  { return fakeCutoff_;}
69  /// Set absolute increment (default 0.0 == off)
70  inline void setAbsoluteIncrement(double value)
71  { absoluteIncrement_ = value;}
72  /// Get absolute increment (default 0.0 == off)
73  inline double absoluteIncrement() const
74  { return absoluteIncrement_;}
75  /// Set relative increment (default 0.0 == off)
76  inline void setRelativeIncrement(double value)
77  { relativeIncrement_ = value;}
78  /// Get relative increment (default 0.0 == off)
79  inline double relativeIncrement() const
80  { return relativeIncrement_;}
81  /// Set default rounding (default 0.5)
82  inline void setDefaultRounding(double value)
83  { defaultRounding_ = value;}
84  /// Get default rounding (default 0.5)
85  inline double defaultRounding() const
86  { return defaultRounding_;}
87  /// Set initial weight (default 0.0 == off)
88  inline void setInitialWeight(double value)
89  { initialWeight_ = value;}
90  /// Get initial weight (default 0.0 == off)
91  inline double initialWeight() const
92  { return initialWeight_;}
93  /// Set weight factor (default 0.1)
94  inline void setWeightFactor(double value)
95  { weightFactor_ = value;}
96  /// Get weight factor (default 0.1)
97  inline double weightFactor() const
98  { return weightFactor_;}
99  /// Set maximum passes (default 100)
100  inline void setMaximumPasses(int value)
101  { maximumPasses_=value;}
102  /// Get maximum passes (default 100)
103  inline int maximumPasses() const
104  { return maximumPasses_;}
105  /// Set maximum retries (default 1)
106  inline void setMaximumRetries(int value)
107  { maximumRetries_=value;}
108  /// Get maximum retries (default 1)
109  inline int maximumRetries() const
110  { return maximumRetries_;}
111  /**  Set use of multiple solutions and solves
112       0 - do not reuse solves, do not accumulate integer solutions for local search
113       1 - do not reuse solves, accumulate integer solutions for local search
114       2 - reuse solves, do not accumulate integer solutions for local search
115       3 - reuse solves, accumulate integer solutions for local search
116  */
117  inline void setAccumulate(int value)
118  { accumulate_=value;}
119  /// Get accumulation option
120  inline int accumulate() const
121  { return accumulate_;}
122  /**  Set whether to fix variables on known solution
123       0 - do not fix
124       1 - fix integers on reduced costs
125       2 - fix integers on reduced costs but only on entry
126  */
127  inline void setFixOnReducedCosts(int value)
128  { fixOnReducedCosts_=value;}
129  /// Get reduced cost option
130  inline int fixOnReducedCosts() const
131  { return fixOnReducedCosts_;}
132
133protected:
134  // Data
135  /// Start time
136  double startTime_;
137  /// Maximum Cpu seconds
138  double maximumTime_;
139  /** Fake cutoff value.
140      If set then better of real cutoff and this used to add a constraint
141  */
142  double fakeCutoff_;
143  /// If positive carry on after solution expecting gain of at least this
144  double absoluteIncrement_;
145  /// If positive carry on after solution expecting gain of at least this times objective
146  double relativeIncrement_;
147  /// Default is round up if > this
148  double defaultRounding_;
149  /// Initial weight for true objective
150  double initialWeight_;
151  /// factor for decreasing weight
152  double weightFactor_;
153  /// Maximum number of passes
154  int maximumPasses_;
155  /** Maximum number of retries if we find a solution.
156      If negative we clean out used array
157  */
158  int maximumRetries_;
159  /**  Set use of multiple solutions and solves
160       0 - do not reuse solves, do not accumulate integer solutions for local search
161       1 - do not reuse solves, accumulate integer solutions for local search
162       2 - reuse solves, do not accumulate integer solutions for local search
163       3 - reuse solves, accumulate integer solutions for local search
164       If we add 4 then use second form of problem (with extra rows and variables)
165  */
166  int accumulate_;
167  /**  Set whether to fix variables on known solution
168       0 - do not fix
169       1 - fix integers on reduced costs
170       2 - fix integers on reduced costs but only on entry
171  */
172  int fixOnReducedCosts_;
173  /// If true round to expensive
174  bool roundExpensive_;
175
176private:
177  /** Rounds solution - down if < downValue
178      If roundExpensive then always to more expnsive.
179      returns 0 if current is solution
180  */
181  int rounds(OsiSolverInterface * solver,double * solution, const double * objective, 
182             int numberIntegers, const int * integerVariable,
183             char * pumpPrint,int & passNumber,
184             bool roundExpensive=false,
185             double downValue=0.5, int *flip=0);
186  /* note for eagle eyed readers.
187     when_ can now be exotic -
188     <=10 normal
189  */
190};
191
192
193#endif
Note: See TracBrowser for help on using the repository browser.