source: stable/2.7/Cbc/src/CbcCountRowCut.hpp @ 2081

Last change on this file since 2081 was 1573, checked in by lou, 9 years ago

Change to EPL license notice.

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