source: branches/devel/Cbc/src/CbcCountRowCut.hpp @ 545

Last change on this file since 545 was 2, checked in by ladanyi, 15 years ago

Import of Coin Branch-and-Cut (formerly known as Sbb)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1// Copyright (C) 2002, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef CbcCountRowCut_H
4#define CbcCountRowCut_H
5
6
7class OsiCuts;
8class OsiRowCut;
9class CbcNodeInfo;
10
11//#############################################################################
12/** \brief OsiRowCut augmented with bookkeeping
13
14  CbcCountRowCut is an OsiRowCut object augmented with bookkeeping
15  information: a reference count and information that specifies the
16  the generator that created the cut and the node to which it's associated.
17
18  The general principles for handling the reference count are as follows:
19  <ul>
20    <li> Once it's determined how the node will branch, increment the
21         reference count under the assumption that all children will use
22         all cuts currently tight at the node and will survive to be placed
23         in the search tree.
24    <li> As this assumption is proven incorrect (a cut becomes loose, or a
25         child is fathomed), decrement the reference count accordingly.
26  </ul>
27  When all possible uses of a cut have been demonstrated to be unnecessary,
28  the reference count (#numberPointingToThis_) will fall to zero. The
29  CbcCountRowCut object (and its included OsiRowCut object) are then deleted.
30*/
31
32class CbcCountRowCut : public OsiRowCut {
33
34public:
35 
36  /** @name Constructors & destructors */
37  //@{
38
39    /// Default Constructor
40    CbcCountRowCut ();
41
42    /// `Copy' constructor using an OsiRowCut
43    CbcCountRowCut ( const OsiRowCut &); 
44
45    /// `Copy' constructor using an OsiRowCut and an CbcNodeInfo
46    CbcCountRowCut(const OsiRowCut &, CbcNodeInfo *, int whichOne,
47                   int whichGenerator=-1); 
48
49    /** Destructor
50
51      \note The destructor will reach out (via #owner_) and NULL the
52      reference to the cut in the owner's
53      \link CbcNodeInfo::cuts_ cuts_ \endlink list.
54    */
55    virtual ~CbcCountRowCut ();
56  //@}
57
58  /// Increment the number of references
59  void increment(int change=1);
60
61  /// Decrement the number of references and return the number left.
62  int decrement(int change=1);
63
64  /** \brief Set the information associating this cut with a node
65
66    An CbcNodeInfo object and an index in the cut set of the node.
67    For locally valid cuts, the node will be the  search tree node where the
68    cut was generated. For globally valid cuts, it's the node where the cut
69    was activated.
70  */
71  void setInfo(CbcNodeInfo *, int whichOne);
72
73  /// Number of other CbcNodeInfo objects pointing to this row cut
74  inline int numberPointingToThis()
75  { return numberPointingToThis_;};
76
77  /// Which generator for cuts - as user order
78   int whichCutGenerator() const
79  { return whichCutGenerator_;};
80
81#ifdef CHECK_CUT_COUNTS
82  // Just for printing sanity checks
83  int tempNumber_;
84#endif
85
86private:
87
88  /// Standard copy is illegal (reference counts would be incorrect)
89  CbcCountRowCut(const CbcCountRowCut &);
90 
91  /// Standard assignment is illegal (reference counts would be incorrect)
92  CbcCountRowCut & operator=(const CbcCountRowCut& rhs);
93
94  /// Backward pointer to owning CbcNodeInfo
95  CbcNodeInfo * owner_;
96 
97  /// Index of cut in owner's cut set
98  /// (\link CbcNodeInfo::cuts_ cuts_ \endlink).
99  int ownerCut_;
100 
101  /// Number of other CbcNodeInfo objects pointing to this cut
102  int numberPointingToThis_;
103
104  /// Which generator created this cut
105  int whichCutGenerator_;
106
107};
108
109#endif
Note: See TracBrowser for help on using the repository browser.