Cbc  2.10.5
 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 2467 2019-01-03 21:26:29Z unxusr $ */
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  // Default Constructor
17 
18  /* Constructor with model - assumed before cuts
19  Initial version does not do Lps
20  */
22 
23  // Copy constructor
25 
26  // Destructor
28 
30  virtual CbcHeuristic *clone() const;
31 
34 
36  virtual void generateCpp(FILE *fp);
37 
39  virtual void resetModel(CbcModel *model);
40 
42  virtual void setModel(CbcModel *model);
43 
56  virtual int solution(double &objectiveValue,
57  double *newSolution);
59  int solutionFix(double &objectiveValue,
60  double *newSolution,
61  const int *keep);
62 
64  inline void setSearchType(int value)
65  {
66  swap_ = value;
67  }
69  inline int *used() const
70  {
71  return used_;
72  }
73 
74 protected:
75  // Data
76 
77  // Original matrix by column
79 
80  // Number of solutions so we only do after new solution
82  // Type of search 0=normal, 1=BAB
83  int swap_;
85  int *used_;
86 };
87 
90 class CbcHeuristicFPump;
92 public:
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 
125  virtual int solution(double &objectiveValue,
126  double *newSolution);
128  inline void setIncrement(double value)
129  {
130  increment_ = value;
131  }
133  inline int *used() const
134  {
135  return used_;
136  }
137 
138 protected:
139  // Data
141  double increment_;
147  int *used_;
148 };
149 
157 public:
158  // Default Constructor
160 
161  /* Constructor with model - assumed before cuts
162  Initial version does not do Lps
163  */
164  CbcHeuristicNaive(CbcModel &model);
165 
166  // Copy constructor
168 
169  // Destructor
171 
173  virtual CbcHeuristic *clone() const;
174 
177 
179  virtual void generateCpp(FILE *fp);
180 
182  virtual void resetModel(CbcModel *model);
183 
185  virtual void setModel(CbcModel *model);
186 
191  virtual int solution(double &objectiveValue,
192  double *newSolution);
193 
195  inline void setLargeValue(double value)
196  {
197  large_ = value;
198  }
200  inline double largeValue() const
201  {
202  return large_;
203  }
204 
205 protected:
208  double large_;
209 };
210 
215 public:
216  // Default Constructor
218 
219  /* Constructor with model - assumed before cuts
220  Initial version does not do Lps
221  */
223 
224  // Copy constructor
226 
227  // Destructor
229 
231  virtual CbcHeuristic *clone() const;
232 
235 
237  virtual void generateCpp(FILE *fp);
238 
240  virtual void resetModel(CbcModel *model);
241 
243  virtual void setModel(CbcModel *model);
244 
251  virtual int solution(double &objectiveValue,
252  double *newSolution);
253 
255  inline void setNumberSolutions(int value)
256  {
257  if (value > 0 && value <= 10)
258  useNumber_ = value;
259  }
260 
261 protected:
262  // Data
264  std::vector< double > attempts_;
266  double random_[10];
271 };
272 
273 #endif
274 
275 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
276 */
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.
std::vector< double > attempts_
Attempts.
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)
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:100
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.