source: branches/sandbox/Cbc/src/CbcCountRowCut.hpp @ 1273

Last change on this file since 1273 was 1271, checked in by forrest, 10 years ago

Creating new stable branch 2.4 from trunk (rev 1270)

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