Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbcHeuristicLocal.hpp
Go to the documentation of this file.
1 /* $Id: CbcHeuristicLocal.hpp 1943 2013-07-21 09:05:45Z forrest $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CbcHeuristicLocal_H
7 #define CbcHeuristicLocal_H
8 
9 #include "CbcHeuristic.hpp"
14 public:
15 
16  // Default Constructor
18 
19  /* Constructor with model - assumed before cuts
20  Initial version does not do Lps
21  */
22  CbcHeuristicLocal (CbcModel & model);
23 
24  // Copy constructor
26 
27  // Destructor
29 
31  virtual CbcHeuristic * clone() const;
32 
35 
37  virtual void generateCpp( FILE * fp) ;
38 
40  virtual void resetModel(CbcModel * model);
41 
43  virtual void setModel(CbcModel * model);
44 
57  virtual int solution(double & objectiveValue,
58  double * newSolution);
60  int solutionFix(double & objectiveValue,
61  double * newSolution,
62  const int * keep);
63 
65  inline void setSearchType(int value) {
66  swap_ = value;
67  }
69  inline int * used() const {
70  return used_;
71  }
72 
73 protected:
74  // Data
75 
76  // Original matrix by column
78 
79  // Number of solutions so we only do after new solution
81  // Type of search 0=normal, 1=BAB
82  int swap_;
84  int * used_;
85 };
86 
89 class CbcHeuristicFPump;
91 public:
92 
93  // Default Constructor
95 
96  /* Constructor with model - assumed before cuts
97  */
99 
100  // Copy constructor
102 
103  // Destructor
105 
107  virtual CbcHeuristic * clone() const;
108 
111 
113  virtual void generateCpp( FILE * fp) ;
114 
116  virtual void resetModel(CbcModel * model);
117 
119  virtual void setModel(CbcModel * model);
120 
121  using CbcHeuristic::solution ;
125  virtual int solution(double & objectiveValue,
126  double * newSolution);
128  inline void setIncrement(double value)
129  { increment_ = value;}
131  inline int * used() const {
132  return used_;
133  }
134 
135 protected:
136  // Data
138  double increment_;
144  int * used_;
145 };
146 
147 
155 public:
156 
157  // Default Constructor
159 
160  /* Constructor with model - assumed before cuts
161  Initial version does not do Lps
162  */
163  CbcHeuristicNaive (CbcModel & model);
164 
165  // Copy constructor
167 
168  // Destructor
170 
172  virtual CbcHeuristic * clone() const;
173 
176 
178  virtual void generateCpp( FILE * fp) ;
179 
181  virtual void resetModel(CbcModel * model);
182 
184  virtual void setModel(CbcModel * model);
185 
186  using CbcHeuristic::solution ;
190  virtual int solution(double & objectiveValue,
191  double * newSolution);
192 
194  inline void setLargeValue(double value) {
195  large_ = value;
196  }
198  inline double largeValue() const {
199  return large_;
200  }
201 
202 protected:
205  double large_;
206 };
207 
212 public:
213 
214  // Default Constructor
216 
217  /* Constructor with model - assumed before cuts
218  Initial version does not do Lps
219  */
221 
222  // Copy constructor
224 
225  // Destructor
227 
229  virtual CbcHeuristic * clone() const;
230 
233 
235  virtual void generateCpp( FILE * fp) ;
236 
238  virtual void resetModel(CbcModel * model);
239 
241  virtual void setModel(CbcModel * model);
242 
243  using CbcHeuristic::solution ;
249  virtual int solution(double & objectiveValue,
250  double * newSolution);
251 
253  inline void setNumberSolutions(int value) {
254  if (value > 0 && value <= 10)
255  useNumber_ = value;
256  }
257 
258 protected:
259  // Data
261  std::vector <double> attempts_;
263  double random_[10];
268 };
269 
270 #endif
271 
Crossover Search class.
LocalSearch class.
CbcHeuristicCrossover & operator=(const CbcHeuristicCrossover &rhs)
Assignment operator.
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
int * used_
Whether a variable has been in a solution (also when)
double large_
Data Large value.
Naive class a) Fix all ints as close to zero as possible b) Fix all ints with nonzero costs and &lt; lar...
void setIncrement(double value)
Set extra increment.
void setSearchType(int value)
Sets type of search.
double random_[10]
Random numbers to stop same search happening.
CoinPackedMatrix matrix_
virtual CbcHeuristic * clone() const
Clone.
virtual CbcHeuristic * clone() const
Clone.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
std::vector< double > attempts_
Attempts.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
CbcHeuristicFPump * feasibilityPump_
Copy of Feasibility pump.
int numberSolutions_
Number of solutions so we only do after new solution.
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
int * used() const
Used array so we can set.
CbcHeuristicNaive & operator=(const CbcHeuristicNaive &rhs)
Assignment operator.
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
int useNumber_
Number of solutions to use.
virtual CbcHeuristic * clone() const
Clone.
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
int * used() const
Used array so we can set.
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
void setNumberSolutions(int value)
Sets number of solutions to use.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
Sparse Matrix Base Class.
int * used_
Whether a variable has been in a solution (also when)
void setLargeValue(double value)
Sets large cost value.
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
Heuristic base class.
CbcHeuristicLocal & operator=(const CbcHeuristicLocal &rhs)
Assignment operator.
virtual CbcHeuristic * clone() const
Clone.
int solutionFix(double &objectiveValue, double *newSolution, const int *keep)
This version fixes stuff and does IP.
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
virtual int solution(double &objectiveValue, double *newSolution)=0
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets sol...
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
double increment_
Increment to use if no change.
Feasibility Pump class.
double largeValue() const
Gets large cost value.
CbcHeuristicProximity & operator=(const CbcHeuristicProximity &rhs)
Assignment operator.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
Simple Branch and bound class.
Definition: CbcModel.hpp:101
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
int numberSolutions_
Number of solutions so we only do after new solution.