source: trunk/Cbc/src/CbcFullNodeInfo.hpp @ 1461

Last change on this file since 1461 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)

File size: 4.7 KB
Line 
1// Edwin 11/24/09 carved from CbcNode
2#ifndef CbcFullNodeInfo_H
3#define CbcFullNodeInfo_H
4
5#include <string>
6#include <vector>
7
8#include "CoinWarmStartBasis.hpp"
9#include "CoinSearchTree.hpp"
10#include "CbcBranchBase.hpp"
11#include "CbcNodeInfo.hpp"
12
13class OsiSolverInterface;
14class OsiSolverBranch;
15
16class OsiCuts;
17class OsiRowCut;
18class OsiRowCutDebugger;
19class CoinWarmStartBasis;
20class CbcCountRowCut;
21class CbcModel;
22class CbcNode;
23class CbcSubProblem;
24class CbcGeneralBranchingObject;
25
26//#############################################################################
27/** Information required to recreate the subproblem at this node
28
29  When a subproblem is initially created, it is represented by a CbcNode
30  object and an attached CbcNodeInfo object.
31
32  The CbcNode contains information needed while the subproblem remains live.
33  The CbcNode is deleted when the last branch arm has been evaluated.
34
35  The CbcNodeInfo contains information required to maintain the branch-and-cut
36  search tree structure (links and reference counts) and to recreate the
37  subproblem for this node (basis, variable bounds, cutting planes). A
38  CbcNodeInfo object remains in existence until all nodes have been pruned from
39  the subtree rooted at this node.
40
41  The principle used to maintain the reference count is that the reference
42  count is always the sum of all potential and actual children of the node.
43  Specifically,
44  <ul>
45    <li> Once it's determined how the node will branch, the reference count
46         is set to the number of potential children (<i>i.e.</i>, the number
47         of arms of the branch).
48    <li> As each child is created by CbcNode::branch() (converting a potential
49         child to the active subproblem), the reference count is decremented.
50    <li> If the child survives and will become a node in the search tree
51         (converting the active subproblem into an actual child), increment the
52         reference count.
53  </ul>
54  Notice that the active subproblem lives in a sort of limbo, neither a
55  potential or an actual node in the branch-and-cut tree.
56
57  CbcNodeInfo objects come in two flavours. A CbcFullNodeInfo object contains
58  a full record of the information required to recreate a subproblem.
59  A CbcPartialNodeInfo object expresses this information in terms of
60  differences from the parent.
61*/
62
63
64/** \brief Holds complete information for recreating a subproblem.
65
66  A CbcFullNodeInfo object contains all necessary information (bounds, basis,
67  and cuts) required to recreate a subproblem.
68
69  \todo While there's no explicit statement, the code often makes the implicit
70        assumption that an CbcFullNodeInfo structure will appear only at the
71        root node of the search tree. Things will break if this assumption
72        is violated.
73*/
74
75class CbcFullNodeInfo : public CbcNodeInfo {
76
77public:
78
79    /** \brief Modify model according to information at node
80
81        The routine modifies the model according to bound information at node,
82        creates a new basis according to information at node, but with the size
83        passed in through basis, and adds any cuts to the addCuts array.
84
85      \note The basis passed in via basis is solely a vehicle for passing in
86        the desired basis size. It will be deleted and a new basis returned.
87    */
88    virtual void applyToModel (CbcModel *model, CoinWarmStartBasis *&basis,
89                               CbcCountRowCut **addCuts,
90                               int &currentNumberCuts) const ;
91
92    /// Just apply bounds to one variable - force means overwrite by lower,upper (1=>infeasible)
93    virtual int applyBounds(int iColumn, double & lower, double & upper, int force) ;
94
95    /** Builds up row basis backwards (until original model).
96        Returns NULL or previous one to apply .
97        Depends on Free being 0 and impossible for cuts
98    */
99    virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis & basis) const ;
100    // Default Constructor
101    CbcFullNodeInfo ();
102
103    /** Constructor from continuous or satisfied
104    */
105    CbcFullNodeInfo (CbcModel * model,
106                     int numberRowsAtContinuous);
107
108    // Copy constructor
109    CbcFullNodeInfo ( const CbcFullNodeInfo &);
110
111    // Destructor
112    ~CbcFullNodeInfo ();
113
114    /// Clone
115    virtual CbcNodeInfo * clone() const;
116    /// Lower bounds
117    inline const double * lower() const {
118        return lower_;
119    }
120    /// Upper bounds
121    inline const double * upper() const {
122        return upper_;
123    }
124protected:
125    // Data
126    /** Full basis
127
128      This MUST BE A POINTER to avoid cutting extra information in derived
129      warm start classes.
130    */
131    CoinWarmStartBasis *basis_;
132    int numberIntegers_;
133    // Bounds stored in full
134    double * lower_;
135    double * upper_;
136private:
137    /// Illegal Assignment operator
138    CbcFullNodeInfo & operator=(const CbcFullNodeInfo& rhs);
139};
140#endif //CbcFullNodeInfo_H
141
Note: See TracBrowser for help on using the repository browser.