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

Last change on this file since 1899 was 1899, checked in by stefan, 5 years ago

fixup svn properties

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