Cbc  2.9.8
CbcClique.hpp
Go to the documentation of this file.
1 // $Id: CbcClique.hpp 1899 2013-04-09 18:12:08Z stefan $
2 // Copyright (C) 2002, 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 // Edwin 11/9/2009-- carved out of CbcBranchActual
7 
8 #ifndef CbcClique_H
9 #define CbcClique_H
10 
41 class CbcClique : public CbcObject {
42 
43 public:
44 
46  CbcClique ();
47 
52  const int * which, const char * type,
53  int identifier, int slack = -1);
54 
56  CbcClique ( const CbcClique &);
57 
59  virtual CbcObject * clone() const;
60 
62  CbcClique & operator=( const CbcClique& rhs);
63 
65  virtual ~CbcClique ();
66 
68  virtual double infeasibility(const OsiBranchingInformation * info,
69  int &preferredWay) const;
70 
73  virtual void feasibleRegion();
74 
76  virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
78  inline int numberMembers() const {
79  return numberMembers_;
80  }
86  inline int numberNonSOSMembers() const {
87  return numberNonSOSMembers_;
88  }
89 
91  inline const int * members() const {
92  return members_;
93  }
94 
104  inline char type(int index) const {
105  if (type_) return type_[index];
106  else return 1;
107  }
108 
110  inline int cliqueType() const {
111  return cliqueType_;
112  }
114  virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
115 
116 protected:
120 
123 
125  int * members_;
126 
136  char * type_;
137 
144 
151  int slack_;
152 };
153 
163 
164 public:
165 
166  // Default Constructor
168 
169  // Useful constructor
171  int way,
172  int numberOnDownSide, const int * down,
173  int numberOnUpSide, const int * up);
174 
175  // Copy constructor
177 
178  // Assignment operator
180 
182  virtual CbcBranchingObject * clone() const;
183 
184  // Destructor
185  virtual ~CbcCliqueBranchingObject ();
186 
189  virtual double branch();
190 
194  virtual void print();
195 
197  virtual CbcBranchObjType type() const {
198  return CliqueBranchObj;
199  }
200 
208  virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
209 
218  virtual CbcRangeCompare compareBranchingObject
219  (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
220 
221 private:
223  const CbcClique * clique_;
225  unsigned int downMask_[2];
227  unsigned int upMask_[2];
228 };
229 
235 
236 public:
237 
238  // Default Constructor
240 
241  // Useful constructor
243  int way,
244  int numberOnDownSide, const int * down,
245  int numberOnUpSide, const int * up);
246 
247  // Copy constructor
249 
250  // Assignment operator
252 
254  virtual CbcBranchingObject * clone() const;
255 
256  // Destructor
257  virtual ~CbcLongCliqueBranchingObject ();
258 
261  virtual double branch();
262 
266  virtual void print();
267 
269  virtual CbcBranchObjType type() const {
270  return LongCliqueBranchObj;
271  }
272 
280  virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
281 
290  virtual CbcRangeCompare compareBranchingObject
291  (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
292 
293 private:
295  const CbcClique * clique_;
297  unsigned int * downMask_;
299  unsigned int * upMask_;
300 };
301 
302 #endif
303 
char type(int index) const
Type of each member, i.e., which way is strong.
Definition: CbcClique.hpp:104
Unordered Clique Branching Object class.
Definition: CbcClique.hpp:234
virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns)
Redoes data when sequence numbers change.
Branching object for cliques.
Definition: CbcClique.hpp:41
virtual ~CbcClique()
Destructor.
virtual void feasibleRegion()=0
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...
int * members_
Members (indices in range 0 ... numberIntegers_-1)
Definition: CbcClique.hpp:125
virtual void feasibleRegion()
This looks at solution and sets bounds to contain solution.
CbcRangeCompare
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
Definition: CbcClique.hpp:197
const int * members() const
Members (indices in range 0 ... numberIntegers_-1)
Definition: CbcClique.hpp:91
int slack_
Slack variable for the clique.
Definition: CbcClique.hpp:151
virtual CbcObject * clone() const
Clone.
Abstract branching object base class Now just difference with OsiBranchingObject. ...
int cliqueType_
Clique type.
Definition: CbcClique.hpp:143
int numberMembers() const
Number of members.
Definition: CbcClique.hpp:78
int numberMembers_
data Number of members
Definition: CbcClique.hpp:119
CbcBranchObjType
CbcModel * model() const
Return model.
Definition: CbcObject.hpp:240
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object...
char * type_
Strong value for each member.
Definition: CbcClique.hpp:136
virtual void print() const
Print something about branch - only if log level high.
int cliqueType() const
Clique type: 0 is <=, 1 is ==.
Definition: CbcClique.hpp:110
int numberNonSOSMembers() const
Number of variables with -1 coefficient.
Definition: CbcClique.hpp:86
CbcClique()
Default Constructor.
int numberNonSOSMembers_
Number of Non SOS members i.e. fixing to zero is strong.
Definition: CbcClique.hpp:122
CbcClique & operator=(const CbcClique &rhs)
Assignment operator.
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5.
Branching object for unordered cliques.
Definition: CbcClique.hpp:162
Simple Branch and bound class.
Definition: CbcModel.hpp:101
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
Definition: CbcClique.hpp:269
int preferredWay() const
If -1 down always chosen first, +1 up always, 0 normal.
Definition: CbcObject.hpp:245
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.