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

Last change on this file since 1433 was 1432, checked in by bjarni, 10 years ago

Added extra return at end of each source file where needed, to remove possible linefeed conflicts (NightlyBuild? errors)

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