Cbc  2.10.5
CbcClique.hpp
Go to the documentation of this file.
1 // $Id$
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:
46 
51  const int *which, const char *type,
52  int identifier, int slack = -1);
53 
55  CbcClique(const CbcClique &);
56 
58  virtual CbcObject *clone() const;
59 
62 
64  virtual ~CbcClique();
65 
67  virtual double infeasibility(const OsiBranchingInformation *info,
68  int &preferredWay) const;
69 
72  virtual void feasibleRegion();
73 
75  virtual CbcBranchingObject *createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way);
77  inline int numberMembers() const
78  {
79  return numberMembers_;
80  }
86  inline int numberNonSOSMembers() const
87  {
88  return numberNonSOSMembers_;
89  }
90 
92  inline const int *members() const
93  {
94  return members_;
95  }
96 
106  inline char type(int index) const
107  {
108  if (type_)
109  return type_[index];
110  else
111  return 1;
112  }
113 
115  inline int cliqueType() const
116  {
117  return cliqueType_;
118  }
120  virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns);
121 
122 protected:
126 
129 
131  int *members_;
132 
142  char *type_;
143 
150 
157  int slack_;
158 };
159 
169 
170 public:
171  // Default Constructor
173 
174  // Useful constructor
176  int way,
177  int numberOnDownSide, const int *down,
178  int numberOnUpSide, const int *up);
179 
180  // Copy constructor
182 
183  // Assignment operator
185 
187  virtual CbcBranchingObject *clone() const;
188 
189  // Destructor
191 
194  virtual double branch();
195 
199  virtual void print();
200 
202  virtual CbcBranchObjType type() const
203  {
204  return CliqueBranchObj;
205  }
206 
214  virtual int compareOriginalObject(const CbcBranchingObject *brObj) const;
215 
224  virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap = false);
225 
226 private:
230  unsigned int downMask_[2];
232  unsigned int upMask_[2];
233 };
234 
240 
241 public:
242  // Default Constructor
244 
245  // Useful constructor
247  int way,
248  int numberOnDownSide, const int *down,
249  int numberOnUpSide, const int *up);
250 
251  // Copy constructor
253 
254  // Assignment operator
256 
258  virtual CbcBranchingObject *clone() const;
259 
260  // Destructor
262 
265  virtual double branch();
266 
270  virtual void print();
271 
273  virtual CbcBranchObjType type() const
274  {
275  return LongCliqueBranchObj;
276  }
277 
285  virtual int compareOriginalObject(const CbcBranchingObject *brObj) const;
286 
295  virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap = false);
296 
297 private:
301  unsigned int *downMask_;
303  unsigned int *upMask_;
304 };
305 
306 #endif
307 
308 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
309 */
CbcRangeCompare
CbcBranchObjType
@ CliqueBranchObj
@ LongCliqueBranchObj
Abstract branching object base class Now just difference with OsiBranchingObject.
CbcModel * model() const
Return model.
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object,...
int way() const
Get the state of the branching object.
virtual void print() const
Print something about branch - only if log level high.
Branching object for unordered cliques.
Definition: CbcClique.hpp:168
CbcCliqueBranchingObject & operator=(const CbcCliqueBranchingObject &rhs)
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
Definition: CbcClique.hpp:202
CbcCliqueBranchingObject(CbcModel *model, const CbcClique *clique, int way, int numberOnDownSide, const int *down, int numberOnUpSide, const int *up)
virtual void print()
Print something about branch - only if log level high.
virtual ~CbcCliqueBranchingObject()
unsigned int upMask_[2]
upMask - bit set to fix to weak bounds, not set to leave unfixed
Definition: CbcClique.hpp:232
const CbcClique * clique_
data
Definition: CbcClique.hpp:228
virtual CbcBranchingObject * clone() const
Clone.
virtual int compareOriginalObject(const CbcBranchingObject *brObj) const
Compare the original object of this with the original object of brObj.
CbcCliqueBranchingObject(const CbcCliqueBranchingObject &)
unsigned int downMask_[2]
downMask - bit set to fix to weak bounds, not set to leave unfixed
Definition: CbcClique.hpp:230
virtual double branch()
Does next branch and updates state.
virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap=false)
Compare the this with brObj.
Branching object for cliques.
Definition: CbcClique.hpp:41
virtual void feasibleRegion()
This looks at solution and sets bounds to contain solution.
CbcClique(CbcModel *model, int cliqueType, int numberMembers, const int *which, const char *type, int identifier, int slack=-1)
Useful constructor (which are integer indices) slack can denote a slack in set.
int cliqueType_
Clique type.
Definition: CbcClique.hpp:149
virtual ~CbcClique()
Destructor.
CbcClique & operator=(const CbcClique &rhs)
Assignment operator.
CbcClique(const CbcClique &)
Copy constructor.
int numberMembers_
data Number of members
Definition: CbcClique.hpp:125
int numberNonSOSMembers() const
Number of variables with -1 coefficient.
Definition: CbcClique.hpp:86
char type(int index) const
Type of each member, i.e., which way is strong.
Definition: CbcClique.hpp:106
int numberMembers() const
Number of members.
Definition: CbcClique.hpp:77
virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns)
Redoes data when sequence numbers change.
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.
const int * members() const
Members (indices in range 0 ... numberIntegers_-1)
Definition: CbcClique.hpp:92
int slack_
Slack variable for the clique.
Definition: CbcClique.hpp:157
CbcClique()
Default Constructor.
char * type_
Strong value for each member.
Definition: CbcClique.hpp:142
int * members_
Members (indices in range 0 ... numberIntegers_-1)
Definition: CbcClique.hpp:131
int cliqueType() const
Clique type: 0 is <=, 1 is ==.
Definition: CbcClique.hpp:115
virtual CbcObject * clone() const
Clone.
int numberNonSOSMembers_
Number of Non SOS members i.e. fixing to zero is strong.
Definition: CbcClique.hpp:128
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5.
Unordered Clique Branching Object class.
Definition: CbcClique.hpp:239
unsigned int * downMask_
downMask - bit set to fix to weak bounds, not set to leave unfixed
Definition: CbcClique.hpp:301
virtual CbcBranchObjType type() const
Return the type (an integer identifier) of this.
Definition: CbcClique.hpp:273
CbcLongCliqueBranchingObject & operator=(const CbcLongCliqueBranchingObject &rhs)
virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap=false)
Compare the this with brObj.
CbcLongCliqueBranchingObject(CbcModel *model, const CbcClique *clique, int way, int numberOnDownSide, const int *down, int numberOnUpSide, const int *up)
CbcLongCliqueBranchingObject(const CbcLongCliqueBranchingObject &)
const CbcClique * clique_
data
Definition: CbcClique.hpp:299
virtual int compareOriginalObject(const CbcBranchingObject *brObj) const
Compare the original object of this with the original object of brObj.
virtual CbcBranchingObject * clone() const
Clone.
unsigned int * upMask_
upMask - bit set to fix to weak bounds, not set to leave unfixed
Definition: CbcClique.hpp:303
virtual double branch()
Does next branch and updates state.
virtual void print()
Print something about branch - only if log level high.
Simple Branch and bound class.
Definition: CbcModel.hpp:100
CbcModel * model() const
Return model.
Definition: CbcObject.hpp:252
virtual void feasibleRegion()=0
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...
int preferredWay() const
If -1 down always chosen first, +1 up always, 0 normal.
Definition: CbcObject.hpp:258