source: trunk/Cbc/src/CbcCountRowCut.hpp @ 1121

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

compiler warnings, deterministic parallel and stability

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 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,int numberPointingToThis=0); 
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  inline int whichCutGenerator() const
79  { return whichCutGenerator_;}
80 
81  /// Returns true if can drop cut if slack basic
82  bool canDropCut(const OsiSolverInterface * solver, int row) const;
83
84#ifdef CHECK_CUT_COUNTS
85  // Just for printing sanity checks
86  int tempNumber_;
87#endif
88
89private:
90
91  /// Standard copy is illegal (reference counts would be incorrect)
92  CbcCountRowCut(const CbcCountRowCut &);
93 
94  /// Standard assignment is illegal (reference counts would be incorrect)
95  CbcCountRowCut & operator=(const CbcCountRowCut& rhs);
96
97  /// Backward pointer to owning CbcNodeInfo
98  CbcNodeInfo * owner_;
99 
100  /// Index of cut in owner's cut set
101  /// (\link CbcNodeInfo::cuts_ cuts_ \endlink).
102  int ownerCut_;
103 
104  /// Number of other CbcNodeInfo objects pointing to this cut
105  int numberPointingToThis_;
106
107  /// Which generator created this cut
108  int whichCutGenerator_;
109
110};
111
112#endif
Note: See TracBrowser for help on using the repository browser.