Cbc  2.8.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CbcHeuristicLocal.hpp
Go to the documentation of this file.
1 /* $Id: CbcHeuristicLocal.hpp 1802 2012-11-21 09:38:56Z 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
77  CoinPackedMatrix matrix_;
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);
127 
129  inline int * used() const {
130  return used_;
131  }
132 
133 protected:
134  // Data
135  // Copy of Feasibility pump
137  // Number of solutions so we only do after new solution
140  int * used_;
141 };
142 
143 
151 public:
152 
153  // Default Constructor
155 
156  /* Constructor with model - assumed before cuts
157  Initial version does not do Lps
158  */
159  CbcHeuristicNaive (CbcModel & model);
160 
161  // Copy constructor
163 
164  // Destructor
166 
168  virtual CbcHeuristic * clone() const;
169 
172 
174  virtual void generateCpp( FILE * fp) ;
175 
177  virtual void resetModel(CbcModel * model);
178 
180  virtual void setModel(CbcModel * model);
181 
182  using CbcHeuristic::solution ;
186  virtual int solution(double & objectiveValue,
187  double * newSolution);
188 
190  inline void setLargeValue(double value) {
191  large_ = value;
192  }
194  inline double largeValue() const {
195  return large_;
196  }
197 
198 protected:
201  double large_;
202 };
203 
208 public:
209 
210  // Default Constructor
212 
213  /* Constructor with model - assumed before cuts
214  Initial version does not do Lps
215  */
217 
218  // Copy constructor
220 
221  // Destructor
223 
225  virtual CbcHeuristic * clone() const;
226 
229 
231  virtual void generateCpp( FILE * fp) ;
232 
234  virtual void resetModel(CbcModel * model);
235 
237  virtual void setModel(CbcModel * model);
238 
239  using CbcHeuristic::solution ;
245  virtual int solution(double & objectiveValue,
246  double * newSolution);
247 
249  inline void setNumberSolutions(int value) {
250  if (value > 0 && value <= 10)
251  useNumber_ = value;
252  }
253 
254 protected:
255  // Data
257  std::vector <double> attempts_;
259  double random_[10];
264 };
265 
266 #endif
267 
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 < lar...
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_
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.
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)
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:100
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.