Cbc  2.10.10
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CbcCountRowCut.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 #ifndef CbcCountRowCut_H
7 #define CbcCountRowCut_H
8 
9 class OsiCuts;
10 class OsiRowCut;
11 class CbcNodeInfo;
12 
13 //#############################################################################
34 class CbcCountRowCut : public OsiRowCut {
35 
36 public:
39 
42 
44  CbcCountRowCut(const OsiRowCut &);
45 
47  CbcCountRowCut(const OsiRowCut &, CbcNodeInfo *, int whichOne,
48  int whichGenerator = -1, int numberPointingToThis = 0);
49 
56  virtual ~CbcCountRowCut();
58 
60  void increment(int change = 1);
61 
63  int decrement(int change = 1);
64 
72  void setInfo(CbcNodeInfo *, int whichOne);
73 
75  inline int numberPointingToThis()
76  {
77  return numberPointingToThis_;
78  }
79 
81  inline int whichCutGenerator() const
82  {
83  return whichCutGenerator_;
84  }
85 
87  bool canDropCut(const OsiSolverInterface *solver, int row) const;
88 
89 #ifdef CHECK_CUT_COUNTS
90  // Just for printing sanity checks
91  int tempNumber_;
92 #endif
93 
94 private:
97 
100 
103 
107 
110 
118 };
128 // for hashing
129 typedef struct {
130  int index, next;
131 } CoinHashLink;
132 class CbcRowCuts {
133 public:
134  CbcRowCuts(int initialMaxSize = 0, int hashMultiplier = 4);
135  ~CbcRowCuts();
136  CbcRowCuts(const CbcRowCuts &rhs);
137  CbcRowCuts &operator=(const CbcRowCuts &rhs);
138  inline OsiRowCut2 *cut(int sequence) const
139  {
140  return rowCut_[sequence];
141  }
142  inline int numberCuts() const
143  {
144  return numberCuts_;
145  }
146  inline int sizeRowCuts() const
147  {
148  return numberCuts_;
149  }
150  inline OsiRowCut *rowCutPtr(int sequence)
151  {
152  return rowCut_[sequence];
153  }
154  void eraseRowCut(int sequence);
155  // Return 0 if added, 1 if not, -1 if not added because of space
156  int addCutIfNotDuplicate(const OsiRowCut &cut, int whichType = 0);
157  // Return 0 if added, 1 if not, -1 if not added because of space
158  int addCutIfNotDuplicateWhenGreedy(const OsiRowCut &cut, int whichType = 0);
159  // Add in cuts as normal cuts (and delete)
160  void addCuts(OsiCuts &cs);
161  // Truncate
162  void truncate(int numberAfter);
163 
164 private:
165  OsiRowCut2 **rowCut_;
168  int size_;
172 };
173 #endif
174 
175 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
176 */
CbcRowCuts::numberCuts_
int numberCuts_
Definition: CbcCountRowCut.hpp:170
CbcRowCuts::operator=
CbcRowCuts & operator=(const CbcRowCuts &rhs)
CbcCountRowCut::~CbcCountRowCut
virtual ~CbcCountRowCut()
Destructor.
CbcRowCuts::size_
int size_
Definition: CbcCountRowCut.hpp:168
CbcCountRowCut::whichCutGenerator
int whichCutGenerator() const
Which generator for cuts - as user order.
Definition: CbcCountRowCut.hpp:81
CbcRowCuts::numberCuts
int numberCuts() const
Definition: CbcCountRowCut.hpp:142
CbcCountRowCut
OsiRowCut augmented with bookkeeping.
Definition: CbcCountRowCut.hpp:34
CbcCountRowCut::operator=
CbcCountRowCut & operator=(const CbcCountRowCut &rhs)
Standard assignment is illegal (reference counts would be incorrect)
CbcCountRowCut::increment
void increment(int change=1)
Increment the number of references.
CbcRowCuts::sizeRowCuts
int sizeRowCuts() const
Definition: CbcCountRowCut.hpp:146
CbcRowCuts::cut
OsiRowCut2 * cut(int sequence) const
Definition: CbcCountRowCut.hpp:138
CbcCountRowCut::numberPointingToThis
int numberPointingToThis()
Number of other CbcNodeInfo objects pointing to this row cut.
Definition: CbcCountRowCut.hpp:75
CbcRowCuts::addCutIfNotDuplicate
int addCutIfNotDuplicate(const OsiRowCut &cut, int whichType=0)
CbcCountRowCut::CbcCountRowCut
CbcCountRowCut()
Default Constructor.
CbcCountRowCut::whichCutGenerator_
int whichCutGenerator_
Which generator created this cut (add 10000 if globally valid) if -1 then from global cut pool -2 cut...
Definition: CbcCountRowCut.hpp:117
CbcRowCuts::hashMultiplier_
int hashMultiplier_
Definition: CbcCountRowCut.hpp:169
CbcRowCuts::~CbcRowCuts
~CbcRowCuts()
CbcRowCuts::rowCut_
OsiRowCut2 ** rowCut_
Definition: CbcCountRowCut.hpp:165
CbcRowCuts::CbcRowCuts
CbcRowCuts(int initialMaxSize=0, int hashMultiplier=4)
CbcRowCuts::addCutIfNotDuplicateWhenGreedy
int addCutIfNotDuplicateWhenGreedy(const OsiRowCut &cut, int whichType=0)
CbcCountRowCut::decrement
int decrement(int change=1)
Decrement the number of references and return the number left.
CbcNodeInfo
Information required to recreate the subproblem at this node.
Definition: CbcNodeInfo.hpp:68
CbcCountRowCut::canDropCut
bool canDropCut(const OsiSolverInterface *solver, int row) const
Returns true if can drop cut if slack basic.
CbcRowCuts::truncate
void truncate(int numberAfter)
CbcCountRowCut::numberPointingToThis_
int numberPointingToThis_
Number of other CbcNodeInfo objects pointing to this cut.
Definition: CbcCountRowCut.hpp:109
CbcRowCuts
Definition: CbcCountRowCut.hpp:132
CbcCountRowCut::setInfo
void setInfo(CbcNodeInfo *, int whichOne)
Set the information associating this cut with a node.
CbcRowCuts::addCuts
void addCuts(OsiCuts &cs)
CbcCountRowCut::owner_
CbcNodeInfo * owner_
Backward pointer to owning CbcNodeInfo.
Definition: CbcCountRowCut.hpp:102
CbcRowCuts::rowCutPtr
OsiRowCut * rowCutPtr(int sequence)
Definition: CbcCountRowCut.hpp:150
CbcRowCuts::lastHash_
int lastHash_
Definition: CbcCountRowCut.hpp:171
CbcCountRowCut::ownerCut_
int ownerCut_
Index of cut in owner's cut set (cuts_ ).
Definition: CbcCountRowCut.hpp:106
CbcRowCuts::hash_
CoinHashLink * hash_
Hash table.
Definition: CbcCountRowCut.hpp:167
CbcRowCuts::eraseRowCut
void eraseRowCut(int sequence)