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 
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
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.
double large_
Data Large value.
LocalSearch class.
Crossover Search class.
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
double largeValue() const
Gets large cost value.
CbcHeuristicCrossover & operator=(const CbcHeuristicCrossover &rhs)
Assignment operator.
virtual CbcHeuristic * clone() const
Clone.
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
int * used_
Whether a variable has been in a solution (also when)
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 generateCpp(FILE *fp)
Create C++ lines to get to current state.
Naive class a) Fix all ints as close to zero as possible b) Fix all ints with nonzero costs and < lar...
double random_[10]
Random numbers to stop same search happening.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
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 numberSolutions_
Number of solutions so we only do after new solution.
virtual CbcHeuristic * clone() const
Clone.
int * used() const
Used array so we can set.
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
void setSearchType(int value)
Sets type of search.
Heuristic base class.
CbcHeuristicLocal & operator=(const CbcHeuristicLocal &rhs)
Assignment operator.
std::vector< double > attempts_
Attempts.
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
CbcHeuristicNaive & operator=(const CbcHeuristicNaive &rhs)
Assignment operator.
void setLargeValue(double value)
Sets large cost value.
int useNumber_
Number of solutions to use.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
Simple Branch and bound class.
Definition: CbcModel.hpp:98
virtual CbcHeuristic * clone() const
Clone.
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
CoinPackedMatrix matrix_