CbcHeuristicLocal.hpp
Go to the documentation of this file.
1 /* $Id: CbcHeuristicLocal.hpp 1432 2010-02-07 19:33:53Z bjarni $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef CbcHeuristicLocal_H
5 #define CbcHeuristicLocal_H
6 
7 #include "CbcHeuristic.hpp"
12 public:
13 
14  // Default Constructor
16 
17  /* Constructor with model - assumed before cuts
18  Initial version does not do Lps
19  */
20  CbcHeuristicLocal (CbcModel & model);
21 
22  // Copy constructor
24 
25  // Destructor
27 
29  virtual CbcHeuristic * clone() const;
30 
33 
35  virtual void generateCpp( FILE * fp) ;
36 
38  virtual void resetModel(CbcModel * model);
39 
41  virtual void setModel(CbcModel * model);
42 
55  virtual int solution(double & objectiveValue,
56  double * newSolution);
58  int solutionFix(double & objectiveValue,
59  double * newSolution,
60  const int * keep);
61 
63  inline void setSearchType(int value) {
64  swap_ = value;
65  }
67  inline int * used() const {
68  return used_;
69  }
70 
71 protected:
72  // Data
73 
74  // Original matrix by column
75  CoinPackedMatrix matrix_;
76 
77  // Number of solutions so we only do after new solution
79  // Type of search 0=normal, 1=BAB
80  int swap_;
82  int * used_;
83 };
84 
85 
93 public:
94 
95  // Default Constructor
97 
98  /* Constructor with model - assumed before cuts
99  Initial version does not do Lps
100  */
101  CbcHeuristicNaive (CbcModel & model);
102 
103  // Copy constructor
105 
106  // Destructor
108 
110  virtual CbcHeuristic * clone() const;
111 
114 
116  virtual void generateCpp( FILE * fp) ;
117 
119  virtual void resetModel(CbcModel * model);
120 
122  virtual void setModel(CbcModel * model);
123 
124  using CbcHeuristic::solution ;
128  virtual int solution(double & objectiveValue,
129  double * newSolution);
130 
132  inline void setLargeValue(double value) {
133  large_ = value;
134  }
136  inline double largeValue() const {
137  return large_;
138  }
139 
140 protected:
143  double large_;
144 };
145 
150 public:
151 
152  // Default Constructor
154 
155  /* Constructor with model - assumed before cuts
156  Initial version does not do Lps
157  */
159 
160  // Copy constructor
162 
163  // Destructor
165 
167  virtual CbcHeuristic * clone() const;
168 
171 
173  virtual void generateCpp( FILE * fp) ;
174 
176  virtual void resetModel(CbcModel * model);
177 
179  virtual void setModel(CbcModel * model);
180 
181  using CbcHeuristic::solution ;
187  virtual int solution(double & objectiveValue,
188  double * newSolution);
189 
191  inline void setNumberSolutions(int value) {
192  if (value > 0 && value <= 10)
193  useNumber_ = value;
194  }
195 
196 protected:
197  // Data
199  std::vector <double> attempts_;
201  double random_[10];
206 };
207 
208 #endif
209