Cbc  2.9.9
 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 1585 2011-01-11 19:04:34Z forrest $ */
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 
16  // Default Constructor
18 
19  /* Constructor with model - assumed before cuts
20  Initial version does not do Lps
21  */
23 
24  // Copy constructor
26 
27  // Destructor
29 
31  virtual CbcHeuristic * clone() const;
35  virtual void generateCpp( FILE * fp) ;
36 
38  virtual void setModel(CbcModel * model);
39 
51  virtual int solution(double & objectiveValue,
52  double * newSolution);
54  virtual void validate() ;
56  virtual void resetModel(CbcModel * model);
57  /* Algorithm
58  0 - use current upper bounds
59  1 - use original upper bounds
60  If 10 added perturb ratios more
61  if 100 added round up all >=0.5
62  */
63  inline int algorithm() const {
64  return algorithm_;
65  }
66  inline void setAlgorithm(int value) {
67  algorithm_ = value;
68  }
69  // Only do this many times
70  inline int numberTimes() const {
71  return numberTimes_;
72  }
73  inline void setNumberTimes(int value) {
74  numberTimes_ = value;
75  }
76 
77 protected:
79  void gutsOfConstructor(CbcModel * model);
80  // Data
81 
82  // Original matrix by column
84  // original number of rows
86  /* Algorithm
87  0 - use current upper bounds
88  1 - use original upper bounds
89  If 10 added perturb ratios more
90  */
94 
95 };
96 
97 
99 public:
100 
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 
125  using CbcHeuristic::solution ;
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  return algorithm_;
150  }
151  inline void setAlgorithm(int value) {
152  algorithm_ = value;
153  }
154  // Fraction of rhs to cover before branch and cut
155  inline void setFraction(double value) {
156  fraction_ = value;
157  }
158  inline double fraction() const {
159  return fraction_;
160  }
161  // Only do this many times
162  inline int numberTimes() const {
163  return numberTimes_;
164  }
165  inline void setNumberTimes(int value) {
166  numberTimes_ = value;
167  }
168 protected:
170  void gutsOfConstructor(CbcModel * model);
171  // Data
172 
173  // Original matrix by column
175  // Fraction of rhs to cover before branch and cut
176  double fraction_;
177  // original number of rows
179  /* Algorithm
180  0 - use current upper bounds
181  1 - use original upper bounds
182  If 10 added perturb ratios more
183  */
187 
188 };
189 
194 public:
195 
196  // Default Constructor
198 
199  /* Constructor with model - assumed before cuts
200  Initial version does not do Lps
201  */
203 
204  // Copy constructor
206 
207  // Destructor
209 
211  virtual CbcHeuristic * clone() const;
215  virtual void generateCpp( FILE * fp) ;
216 
218  virtual void setModel(CbcModel * model);
219 
220  using CbcHeuristic::solution ;
231  virtual int solution(double & objectiveValue,
232  double * newSolution);
234  virtual void validate() ;
236  virtual void resetModel(CbcModel * model);
237  /* Algorithm
238  Bits
239  1 bit - use current model, otherwise original
240  2 - use current solution as starting point, otherwise pure greedy
241  4 - as 2 but use merit not merit/size
242  8 - use duals to modify greedy
243  16 - use duals on GUB/SOS in special way
244  */
245  inline int algorithm() const {
246  return algorithm_;
247  }
248  inline void setAlgorithm(int value) {
249  algorithm_ = value;
250  }
251  // Only do this many times
252  inline int numberTimes() const {
253  return numberTimes_;
254  }
255  inline void setNumberTimes(int value) {
256  numberTimes_ = value;
257  }
258 
259 protected:
261  void gutsOfConstructor(CbcModel * model);
262  // Data
263 
264  // Original RHS - if -1.0 then SOS otherwise <= value
265  double * originalRhs_;
266  // Original matrix by column
268  // original number of rows
270  /* Algorithm
271  */
275 
276 };
277 
278 
279 #endif
280 
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:101
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.