Cbc  2.10.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbcHeuristicGreedy.hpp
Go to the documentation of this file.
1 /* $Id: CbcHeuristicGreedy.hpp 2465 2019-01-03 19:26:52Z unxusr $ */
2 // Copyright (C) 2005, 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 CbcHeuristicGreedy_H
7 #define CbcHeuristicGreedy_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;
34  virtual void generateCpp(FILE *fp);
35 
37  virtual void setModel(CbcModel *model);
38 
50  virtual int solution(double &objectiveValue,
51  double *newSolution);
53  virtual void validate();
55  virtual void resetModel(CbcModel *model);
56  /* Algorithm
57  0 - use current upper bounds
58  1 - use original upper bounds
59  If 10 added perturb ratios more
60  if 100 added round up all >=0.5
61  */
62  inline int algorithm() const
63  {
64  return algorithm_;
65  }
66  inline void setAlgorithm(int value)
67  {
68  algorithm_ = value;
69  }
70  // Only do this many times
71  inline int numberTimes() const
72  {
73  return numberTimes_;
74  }
75  inline void setNumberTimes(int value)
76  {
77  numberTimes_ = value;
78  }
79 
80 protected:
82  void gutsOfConstructor(CbcModel *model);
83  // Data
84 
85  // Original matrix by column
87  // original number of rows
89  /* Algorithm
90  0 - use current upper bounds
91  1 - use original upper bounds
92  If 10 added perturb ratios more
93  */
97 };
98 
100 public:
101  // Default Constructor
103 
104  /* Constructor with model - assumed before cuts
105  Initial version does not do Lps
106  */
108 
109  // Copy constructor
111 
112  // Destructor
114 
116  virtual CbcHeuristic *clone() const;
120  virtual void generateCpp(FILE *fp);
121 
123  virtual void setModel(CbcModel *model);
124 
136  virtual int solution(double &objectiveValue,
137  double *newSolution);
139  virtual void validate();
141  virtual void resetModel(CbcModel *model);
142  /* Algorithm
143  0 - use current upper bounds
144  1 - use original upper bounds
145  If 10 added perturb ratios more
146  if 100 added round up all >=0.5
147  */
148  inline int algorithm() const
149  {
150  return algorithm_;
151  }
152  inline void setAlgorithm(int value)
153  {
154  algorithm_ = value;
155  }
156  // Fraction of rhs to cover before branch and cut
157  inline void setFraction(double value)
158  {
159  fraction_ = value;
160  }
161  inline double fraction() const
162  {
163  return fraction_;
164  }
165  // Only do this many times
166  inline int numberTimes() const
167  {
168  return numberTimes_;
169  }
170  inline void setNumberTimes(int value)
171  {
172  numberTimes_ = value;
173  }
174 
175 protected:
177  void gutsOfConstructor(CbcModel *model);
178  // Data
179 
180  // Original matrix by column
182  // Fraction of rhs to cover before branch and cut
183  double fraction_;
184  // original number of rows
186  /* Algorithm
187  0 - use current upper bounds
188  1 - use original upper bounds
189  If 10 added perturb ratios more
190  */
194 };
195 
200 public:
201  // Default Constructor
203 
204  /* Constructor with model - assumed before cuts
205  Initial version does not do Lps
206  */
208 
209  // Copy constructor
211 
212  // Destructor
214 
216  virtual CbcHeuristic *clone() const;
220  virtual void generateCpp(FILE *fp);
221 
223  virtual void setModel(CbcModel *model);
224 
236  virtual int solution(double &objectiveValue,
237  double *newSolution);
239  virtual void validate();
241  virtual void resetModel(CbcModel *model);
242  /* Algorithm
243  Bits
244  1 bit - use current model, otherwise original
245  2 - use current solution as starting point, otherwise pure greedy
246  4 - as 2 but use merit not merit/size
247  8 - use duals to modify greedy
248  16 - use duals on GUB/SOS in special way
249  */
250  inline int algorithm() const
251  {
252  return algorithm_;
253  }
254  inline void setAlgorithm(int value)
255  {
256  algorithm_ = value;
257  }
258  // Only do this many times
259  inline int numberTimes() const
260  {
261  return numberTimes_;
262  }
263  inline void setNumberTimes(int value)
264  {
265  numberTimes_ = value;
266  }
267 
268 protected:
270  void gutsOfConstructor(CbcModel *model);
271  // Data
272 
273  // Original RHS - if -1.0 then SOS otherwise <= value
274  double *originalRhs_;
275  // Original matrix by column
277  // original number of rows
279  /* Algorithm
280  */
284 };
285 
286 #endif
287 
288 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
289 */
virtual void validate()
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
CbcHeuristicGreedyEquality & operator=(const CbcHeuristicGreedyEquality &rhs)
Assignment operator.
void gutsOfConstructor(CbcModel *model)
Guts of constructor from a CbcModel.
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.
int numberTimes_
Do this many times.
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
virtual CbcHeuristic * clone() const
Clone.
void setNumberTimes(int value)
virtual CbcHeuristic * clone() const
Clone.
virtual void validate()
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
void gutsOfConstructor(CbcModel *model)
Guts of constructor from a CbcModel.
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
Greedy heuristic for SOS and L rows (and positive elements)
Sparse Matrix Base Class.
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
int numberTimes_
Do this many times.
virtual CbcHeuristic * clone() const
Clone.
Heuristic base class.
virtual void validate()
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
int numberTimes_
Do this many times.
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...
CbcHeuristicGreedySOS & operator=(const CbcHeuristicGreedySOS &rhs)
Assignment operator.
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
Greedy heuristic classes.
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
Simple Branch and bound class.
Definition: CbcModel.hpp:100
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
void gutsOfConstructor(CbcModel *model)
Guts of constructor from a CbcModel.
CbcHeuristicGreedyCover & operator=(const CbcHeuristicGreedyCover &rhs)
Assignment operator.