CbcSOS.hpp
Go to the documentation of this file.
1 // Edwin 11/9/2009-- carved out of CbcBranchActual
2 #ifndef CbcSOS_H
3 #define CbcSOS_H
4 
23 class CbcSOS : public CbcObject {
24 
25 public:
26 
27  // Default Constructor
28  CbcSOS ();
29 
41  const int * which, const double * weights, int identifier,
42  int type = 1);
43 
44  // Copy constructor
45  CbcSOS ( const CbcSOS &);
46 
48  virtual CbcObject * clone() const;
49 
50  // Assignment operator
51  CbcSOS & operator=( const CbcSOS& rhs);
52 
53  // Destructor
54  virtual ~CbcSOS ();
55 
57  virtual double infeasibility(const OsiBranchingInformation * info,
58  int &preferredWay) const;
59 
62  virtual void feasibleRegion();
63 
65  virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
66 
67 
68 
72  virtual CbcObjectUpdateData createUpdateInformation(const OsiSolverInterface * solver,
73  const CbcNode * node,
74  const CbcBranchingObject * branchingObject);
76  virtual void updateInformation(const CbcObjectUpdateData & data) ;
82  virtual OsiSolverBranch * solverBranch() const;
84  virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
85 
87  OsiSOS * osiObject(const OsiSolverInterface * solver) const;
89  inline int numberMembers() const {
90  return numberMembers_;
91  }
92 
94  inline const int * members() const {
95  return members_;
96  }
97 
99  inline int sosType() const {
100  return sosType_;
101  }
103  inline int numberTimesDown() const {
104  return numberTimesDown_;
105  }
107  inline int numberTimesUp() const {
108  return numberTimesUp_;
109  }
110 
112  inline const double * weights() const {
113  return weights_;
114  }
115 
117  inline void setNumberMembers(int n) {
118  numberMembers_ = n;
119  }
120 
122  inline int * mutableMembers() const {
123  return members_;
124  }
125 
127  inline double * mutableWeights() const {
128  return weights_;
129  }
130 
133  virtual bool canDoHeuristics() const {
134  return (sosType_ == 1 && integerValued_);
135  }
137  inline void setIntegerValued(bool yesNo) {
138  integerValued_ = yesNo;
139  }
140 private:
142 
144  int * members_;
157  double * weights_;
159  mutable double shadowEstimateDown_;
161  mutable double shadowEstimateUp_;
165  double upDynamicPseudoRatio_;
167  int numberTimesDown_;
169  int numberTimesUp_;
171  int numberMembers_;
173  int sosType_;
175  bool integerValued_;
176 };
177 
184 
185 public:
186 
187  // Default Constructor
189 
190  // Useful constructor
191  CbcSOSBranchingObject (CbcModel * model, const CbcSOS * clique,
192  int way,
193  double separator);
194 
195  // Copy constructor
197 
198  // Assignment operator
200 
202  virtual CbcBranchingObject * clone() const;
203 
204  // Destructor
205  virtual ~CbcSOSBranchingObject ();
206 
209  virtual double branch();
212  virtual void fix(OsiSolverInterface * solver,
213  double * lower, double * upper,
214  int branchState) const ;
215 
219  virtual void previousBranch() {
222  }
223 
227  virtual void print();
228 
230  virtual CbcBranchObjType type() const {
231  return SoSBranchObj;
232  }
233 
241  virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
242 
252  (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
253 
255  void computeNonzeroRange();
256 
257 private:
259  const CbcSOS * set_;
261  double separator_;
267  int firstNonzero_;
268  int lastNonzero_;
269 };
270 #endif
271