Cbc  2.9.9
CbcCountRowCut.hpp
Go to the documentation of this file.
1 /* $Id: CbcCountRowCut.hpp 2094 2014-11-18 11:15:36Z forrest $ */
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 
10 class OsiCuts;
11 class OsiRowCut;
12 class CbcNodeInfo;
13 
14 //#############################################################################
35 class CbcCountRowCut : public OsiRowCut {
36 
37 public:
38 
41 
44 
46  CbcCountRowCut ( const OsiRowCut &);
47 
49  CbcCountRowCut(const OsiRowCut &, CbcNodeInfo *, int whichOne,
50  int whichGenerator = -1, int numberPointingToThis = 0);
51 
58  virtual ~CbcCountRowCut ();
60 
62  void increment(int change = 1);
63 
65  int decrement(int change = 1);
66 
74  void setInfo(CbcNodeInfo *, int whichOne);
75 
77  inline int numberPointingToThis() {
78  return numberPointingToThis_;
79  }
80 
82  inline int whichCutGenerator() const {
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:
95 
98 
100  CbcCountRowCut & operator=(const CbcCountRowCut& rhs);
101 
103  CbcNodeInfo * owner_;
104 
107  int ownerCut_;
108 
110  int numberPointingToThis_;
111 
118  int whichCutGenerator_;
119 
120 };
130 // for hashing
131 typedef struct {
132  int index, next;
133 } CoinHashLink;
134 class CbcRowCuts {
135 public:
136 
137  CbcRowCuts(int initialMaxSize=0, int hashMultiplier=4 );
139  CbcRowCuts(const CbcRowCuts& rhs);
141  inline OsiRowCut2 * cut(int sequence) const
142  { return rowCut_[sequence];}
143  inline int numberCuts() const
144  { return numberCuts_;}
145  inline int sizeRowCuts() const
146  { return numberCuts_;}
147  inline OsiRowCut * rowCutPtr(int sequence)
148  { return rowCut_[sequence];}
149  void eraseRowCut(int sequence);
150  // Return 0 if added, 1 if not, -1 if not added because of space
151  int addCutIfNotDuplicate(const OsiRowCut & cut,int whichType=0);
152  // Return 0 if added, 1 if not, -1 if not added because of space
153  int addCutIfNotDuplicateWhenGreedy(const OsiRowCut & cut,int whichType=0);
154  // Add in cuts as normal cuts (and delete)
155  void addCuts(OsiCuts & cs);
156  // Truncate
157  void truncate(int numberAfter);
158 private:
159  OsiRowCut2 ** rowCut_;
161  CoinHashLink *hash_;
162  int size_;
163  int hashMultiplier_;
164  int numberCuts_;
165  int lastHash_;
166 };
167 #endif
168 
CbcCountRowCut::CbcCountRowCut
CbcCountRowCut(const OsiRowCut &, CbcNodeInfo *, int whichOne, int whichGenerator=-1, int numberPointingToThis=0)
‘Copy’ constructor using an OsiRowCut and an CbcNodeInfo
CbcRowCuts::operator=
CbcRowCuts & operator=(const CbcRowCuts &rhs)
CbcCountRowCut::CbcCountRowCut
CbcCountRowCut(const OsiRowCut &)
‘Copy’ constructor using an OsiRowCut
CbcCountRowCut::~CbcCountRowCut
virtual ~CbcCountRowCut()
Destructor.
CbcCountRowCut::whichCutGenerator
int whichCutGenerator() const
Which generator for cuts - as user order.
Definition: CbcCountRowCut.hpp:82
CbcRowCuts::numberCuts
int numberCuts() const
Definition: CbcCountRowCut.hpp:143
CbcCountRowCut
OsiRowCut augmented with bookkeeping.
Definition: CbcCountRowCut.hpp:35
CbcCountRowCut::increment
void increment(int change=1)
Increment the number of references.
CbcRowCuts::sizeRowCuts
int sizeRowCuts() const
Definition: CbcCountRowCut.hpp:145
CbcRowCuts::cut
OsiRowCut2 * cut(int sequence) const
Definition: CbcCountRowCut.hpp:141
CbcCountRowCut::numberPointingToThis
int numberPointingToThis()
Number of other CbcNodeInfo objects pointing to this row cut.
Definition: CbcCountRowCut.hpp:77
CbcRowCuts::addCutIfNotDuplicate
int addCutIfNotDuplicate(const OsiRowCut &cut, int whichType=0)
CbcCountRowCut::CbcCountRowCut
CbcCountRowCut()
Default Constructor.
CbcRowCuts::~CbcRowCuts
~CbcRowCuts()
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
CbcRowCuts::CbcRowCuts
CbcRowCuts(const CbcRowCuts &rhs)
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)
CbcRowCuts
Definition: CbcCountRowCut.hpp:134
CbcCountRowCut::setInfo
void setInfo(CbcNodeInfo *, int whichOne)
Set the information associating this cut with a node.
CbcRowCuts::addCuts
void addCuts(OsiCuts &cs)
CbcRowCuts::rowCutPtr
OsiRowCut * rowCutPtr(int sequence)
Definition: CbcCountRowCut.hpp:147
CbcRowCuts::eraseRowCut
void eraseRowCut(int sequence)