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

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

towards common use with other solvers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.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  virtual int solution(double & objectiveValue,
47                       double * newSolution);
48
49  /// Set maximum Time (default off) - also sets starttime to current
50  void setMaximumTime(double value);
51  /// Get maximum Time (default 0.0 == time limit off)
52  inline double maximumTime() const
53  { return maximumTime_;};
54  /// Set fake cutoff (default COIN_DBL_MAX == off)
55  inline void setFakeCutoff(double value)
56  { fakeCutoff_ = value;};
57  /// Get fake cutoff (default 0.0 == off)
58  inline double fakeCutoff() const
59  { return fakeCutoff_;};
60  /// Set absolute increment (default 0.0 == off)
61  inline void setAbsoluteIncrement(double value)
62  { absoluteIncrement_ = value;};
63  /// Get absolute increment (default 0.0 == off)
64  inline double absoluteIncrement() const
65  { return absoluteIncrement_;};
66  /// Set relative increment (default 0.0 == off)
67  inline void setRelativeIncrement(double value)
68  { relativeIncrement_ = value;};
69  /// Get relative increment (default 0.0 == off)
70  inline double relativeIncrement() const
71  { return relativeIncrement_;};
72  /// Set maximum passes (default 100)
73  inline void setMaximumPasses(int value)
74  { maximumPasses_=value;};
75  /// Get maximum passes (default 100)
76  inline int maximumPasses() const
77  { return maximumPasses_;};
78  /// Set maximum retries (default 1)
79  inline void setMaximumRetries(int value)
80  { maximumRetries_=value;};
81  /// Get maximum retries (default 1)
82  inline int maximumRetries() const
83  { return maximumRetries_;};
84
85protected:
86  // Data
87  /// Start time
88  double startTime_;
89  /// Maximum Cpu seconds
90  double maximumTime_;
91  /// If less than this round down
92  double downValue_;
93  /** Fake cutoff value.
94      If set then better of real cutoff and this used to add a constraint
95  */
96  double fakeCutoff_;
97  /// If positive carry on after solution expecting gain of at least this
98  double absoluteIncrement_;
99  /// If positive carry on after solution expecting gain of at least this times objective
100  double relativeIncrement_;
101  /// Maximum number of passes
102  int maximumPasses_;
103  /** Maximum number of retries if we find a solution.
104      If negative we clean out used array
105  */
106  int maximumRetries_;
107  /// If true round to expensive
108  bool roundExpensive_;
109
110private:
111  /// Illegal Assignment operator
112  CbcHeuristicFPump & operator=(const CbcHeuristicFPump& rhs);
113  /** Rounds solution - down if < downValue
114      If roundExpensive then always to more expnsive.
115      returns 0 if current is solution
116  */
117  int rounds(double * solution, const double * objective, 
118             bool roundExpensive=false,
119             double downValue=0.5, int *flip=0);
120  /* note for eagle eyed readers.
121     when_ can now be exotic -
122     <=10 normal
123  */
124};
125
126
127#endif
Note: See TracBrowser for help on using the repository browser.