CbcSimpleIntegerDynamicPseudoCost.hpp
Go to the documentation of this file.
1 // Edwin 11/17/2009 - carved out of CbcBranchDynamic
2 #ifndef CbcSimpleIntegerDynamicPseudoCost_H
3 #define CbcSimpleIntegerDynamicPseudoCost_H
4 
5 #include "CbcSimpleInteger.hpp"
6 
7 #define TYPERATIO 0.9
8 #define MINIMUM_MOVEMENT 0.1
9 #define TYPE2 0
10 // was 1 - but that looks flakey
11 #define INFEAS 1
12 #define MOD_SHADOW 1
13 // weight at 1.0 is max min
14 #define WEIGHT_AFTER 0.8
15 #define WEIGHT_BEFORE 0.1
16 //Stolen from Constraint Integer Programming book (with epsilon change)
17 #define WEIGHT_PRODUCT
18 
19 
30 
31 public:
32 
33  // Default Constructor
35 
36  // Useful constructor - passed model index
37  CbcSimpleIntegerDynamicPseudoCost (CbcModel * model, int iColumn, double breakEven = 0.5);
38 
39  // Useful constructor - passed model index and pseudo costs
40  CbcSimpleIntegerDynamicPseudoCost (CbcModel * model, int iColumn,
42 
43  // Useful constructor - passed model index and pseudo costs
44  CbcSimpleIntegerDynamicPseudoCost (CbcModel * model, int dummy, int iColumn,
45  double downDynamicPseudoCost, double upDynamicPseudoCost);
46 
47  // Copy constructor
49 
51  virtual CbcObject * clone() const;
52 
53  // Assignment operator
55 
56  // Destructor
58 
60  virtual double infeasibility(const OsiBranchingInformation * info,
61  int &preferredWay) const;
62 
64  virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
65 
66 
68  void fillCreateBranch(CbcIntegerBranchingObject * branching, const OsiBranchingInformation * info, int way) ;
69 
70 
74  virtual CbcObjectUpdateData createUpdateInformation(const OsiSolverInterface * solver,
75  const CbcNode * node,
76  const CbcBranchingObject * branchingObject);
78  virtual void updateInformation(const CbcObjectUpdateData & data) ;
80  void copySome(const CbcSimpleIntegerDynamicPseudoCost * otherObject);
82  virtual void updateBefore(const OsiObject * rhs) ;
84  virtual void updateAfter(const OsiObject * rhs, const OsiObject * baseObject) ;
86  void updateAfterMini(int numberDown, int numberDownInfeasible, double sumDown,
87  int numberUp, int numberUpInfeasible, double sumUp);
88 
94  virtual OsiSolverBranch * solverBranch() const;
95 
97  inline double downDynamicPseudoCost() const {
99  }
101  void setDownDynamicPseudoCost(double value) ;
103  void updateDownDynamicPseudoCost(double value);
104 
106  inline double upDynamicPseudoCost() const {
107  return upDynamicPseudoCost_;
108  }
110  void setUpDynamicPseudoCost(double value);
112  void updateUpDynamicPseudoCost(double value);
113 
115  inline double downShadowPrice() const {
116  return downShadowPrice_;
117  }
119  inline void setDownShadowPrice(double value) {
120  downShadowPrice_ = value;
121  }
123  inline double upShadowPrice() const {
124  return upShadowPrice_;
125  }
127  inline void setUpShadowPrice(double value) {
128  upShadowPrice_ = value;
129  }
130 
132  inline double upDownSeparator() const {
133  return upDownSeparator_;
134  }
136  inline void setUpDownSeparator(double value) {
137  upDownSeparator_ = value;
138  }
139 
141  inline double sumDownCost() const {
142  return sumDownCost_;
143  }
145  inline void setSumDownCost(double value) {
146  sumDownCost_ = value;
147  }
149  inline void addToSumDownCost(double value) {
150  sumDownCost_ += value;
151  lastDownCost_ = value;
152  }
153 
155  inline double sumUpCost() const {
156  return sumUpCost_;
157  }
159  inline void setSumUpCost(double value) {
160  sumUpCost_ = value;
161  }
163  inline void addToSumUpCost(double value) {
164  sumUpCost_ += value;
165  lastUpCost_ = value;
166  }
167 
169  inline double sumDownChange() const {
170  return sumDownChange_;
171  }
173  inline void setSumDownChange(double value) {
174  sumDownChange_ = value;
175  }
177  inline void addToSumDownChange(double value) {
178  sumDownChange_ += value;
179  }
180 
182  inline double sumUpChange() const {
183  return sumUpChange_;
184  }
186  inline void setSumUpChange(double value) {
187  sumUpChange_ = value;
188  }
190  inline void addToSumUpChange(double value) {
191  sumUpChange_ += value;
192  }
193 
195  inline double sumDownDecrease() const {
196  return sumDownDecrease_;
197  }
199  inline void setSumDownDecrease(double value) {
200  sumDownDecrease_ = value;
201  }
203  inline void addToSumDownDecrease(double value) {
204  sumDownDecrease_ += value;/*lastDownDecrease_ = (int) value;*/
205  }
206 
208  inline double sumUpDecrease() const {
209  return sumUpDecrease_;
210  }
212  inline void setSumUpDecrease(double value) {
213  sumUpDecrease_ = value;
214  }
216  inline void addToSumUpDecrease(double value) {
217  sumUpDecrease_ += value;/*lastUpDecrease_ = (int) value;*/
218  }
219 
221  inline int numberTimesDown() const {
222  return numberTimesDown_;
223  }
225  inline void setNumberTimesDown(int value) {
226  numberTimesDown_ = value;
227  }
229  inline void incrementNumberTimesDown() {
231  }
232 
234  inline int numberTimesUp() const {
235  return numberTimesUp_;
236  }
238  inline void setNumberTimesUp(int value) {
239  numberTimesUp_ = value;
240  }
242  inline void incrementNumberTimesUp() {
243  numberTimesUp_++;
244  }
245 
247  inline int numberTimesDownInfeasible() const {
249  }
251  inline void setNumberTimesDownInfeasible(int value) {
253  }
257  }
258 
260  inline int numberTimesUpInfeasible() const {
262  }
264  inline void setNumberTimesUpInfeasible(int value) {
265  numberTimesUpInfeasible_ = value;
266  }
270  }
271 
273  inline int numberBeforeTrust() const {
274  return numberBeforeTrust_;
275  }
277  inline void setNumberBeforeTrust(int value) {
278  numberBeforeTrust_ = value;
279  }
283  }
284 
286  virtual double upEstimate() const;
288  virtual double downEstimate() const;
289 
291  inline int method() const {
292  return method_;
293  }
295  inline void setMethod(int value) {
296  method_ = value;
297  }
298 
300  void setDownInformation(double changeObjectiveDown, int changeInfeasibilityDown);
302  void setUpInformation(double changeObjectiveUp, int changeInfeasibilityUp);
304  void setProbingInformation(int fixedDown, int fixedUp);
305 
307  void print(int type = 0, double value = 0.0) const;
309  bool same(const CbcSimpleIntegerDynamicPseudoCost * obj) const;
310 protected:
312 
314  double downDynamicPseudoCost_;
316  double upDynamicPseudoCost_;
321  double upDownSeparator_;
323  double sumDownCost_;
325  double sumUpCost_;
327  double sumDownChange_;
329  double sumUpChange_;
331  mutable double downShadowPrice_;
333  mutable double upShadowPrice_;
335  double sumDownDecrease_;
337  double sumUpDecrease_;
339  double lastDownCost_;
341  double lastUpCost_;
343  mutable int lastDownDecrease_;
345  mutable int lastUpDecrease_;
347  int numberTimesDown_;
349  int numberTimesUp_;
355  int numberBeforeTrust_;
367 
371  int method_;
372 };
384 
385 public:
386 
389 
398  int way , double value) ;
399 
408  double lowerValue, double upperValue) ;
409 
412 
415 
417  virtual CbcBranchingObject * clone() const;
418 
421 
427  virtual double branch();
428 
430  inline double changeInGuessed() const {
431  return changeInGuessed_;
432  }
434  inline void setChangeInGuessed(double value) {
435  changeInGuessed_ = value;
436  }
437 
439  virtual CbcBranchObjType type() const {
441  }
442 
452  (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
453 
454 protected:
456  double changeInGuessed_;
457 };
458 #endif
459