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

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

for local tree search and feasibility pump

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