source: branches/devel/Cbc/src/CbcHeuristicFPump.hpp @ 484

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

for osi methods

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