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

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

nonlinear

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.2 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 default rounding (default 0.5)
80  inline void setDefaultRounding(double value)
81  { defaultRounding_ = value;};
82  /// Get default rounding (default 0.5)
83  inline double defaultRounding() const
84  { return defaultRounding_;};
85  /// Set initial weight (default 0.0 == off)
86  inline void setInitialWeight(double value)
87  { initialWeight_ = value;};
88  /// Get initial weight (default 0.0 == off)
89  inline double initialWeight() const
90  { return initialWeight_;};
91  /// Set weight factor (default 0.1)
92  inline void setWeightFactor(double value)
93  { weightFactor_ = value;};
94  /// Get weight factor (default 0.1)
95  inline double weightFactor() const
96  { return weightFactor_;};
97  /// Set maximum passes (default 100)
98  inline void setMaximumPasses(int value)
99  { maximumPasses_=value;};
100  /// Get maximum passes (default 100)
101  inline int maximumPasses() const
102  { return maximumPasses_;};
103  /// Set maximum retries (default 1)
104  inline void setMaximumRetries(int value)
105  { maximumRetries_=value;};
106  /// Get maximum retries (default 1)
107  inline int maximumRetries() const
108  { return maximumRetries_;};
109  /**  Set use of multiple solutions and solves
110       0 - do not reuse solves, do not accumulate integer solutions for local search
111       1 - do not reuse solves, accumulate integer solutions for local search
112       2 - reuse solves, do not accumulate integer solutions for local search
113       3 - reuse solves, accumulate integer solutions for local search
114  */
115  inline void setAccumulate(int value)
116  { accumulate_=value;};
117  /// Get accumulation option
118  inline int accumulate() const
119  { return accumulate_;};
120
121protected:
122  // Data
123  /// Start time
124  double startTime_;
125  /// Maximum Cpu seconds
126  double maximumTime_;
127  /** Fake cutoff value.
128      If set then better of real cutoff and this used to add a constraint
129  */
130  double fakeCutoff_;
131  /// If positive carry on after solution expecting gain of at least this
132  double absoluteIncrement_;
133  /// If positive carry on after solution expecting gain of at least this times objective
134  double relativeIncrement_;
135  /// Default is round up if > this
136  double defaultRounding_;
137  /// Initial weight for true objective
138  double initialWeight_;
139  /// factor for decreasing weight
140  double weightFactor_;
141  /// Maximum number of passes
142  int maximumPasses_;
143  /** Maximum number of retries if we find a solution.
144      If negative we clean out used array
145  */
146  int maximumRetries_;
147  /**  Set use of multiple solutions and solves
148       0 - do not reuse solves, do not accumulate integer solutions for local search
149       1 - do not reuse solves, accumulate integer solutions for local search
150       2 - reuse solves, do not accumulate integer solutions for local search
151       3 - reuse solves, accumulate integer solutions for local search
152       If we add 4 then use second form of problem (with extra rows and variables)
153  */
154  int accumulate_;
155  /// If true round to expensive
156  bool roundExpensive_;
157
158private:
159  /// Illegal Assignment operator
160  CbcHeuristicFPump & operator=(const CbcHeuristicFPump& rhs);
161  /** Rounds solution - down if < downValue
162      If roundExpensive then always to more expnsive.
163      returns 0 if current is solution
164  */
165  int rounds(double * solution, const double * objective, 
166             int numberIntegers, const int * integerVariable,
167             bool roundExpensive=false,
168             double downValue=0.5, int *flip=0);
169  /* note for eagle eyed readers.
170     when_ can now be exotic -
171     <=10 normal
172  */
173};
174
175
176#endif
Note: See TracBrowser for help on using the repository browser.