source: trunk/Cbc/src/CbcFullNodeInfo.hpp

Last change on this file was 2465, checked in by unxusr, 12 months ago

script to format sources

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1// $Id: CbcFullNodeInfo.hpp 2465 2019-01-03 19:26:52Z 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// 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/** \brief Holds complete information for recreating a subproblem.
70
71  A CbcFullNodeInfo object contains all necessary information (bounds, basis,
72  and cuts) required to recreate a subproblem.
73
74  \todo While there's no explicit statement, the code often makes the implicit
75        assumption that an CbcFullNodeInfo structure will appear only at the
76        root node of the search tree. Things will break if this assumption
77        is violated.
78*/
79
80class CbcFullNodeInfo : public CbcNodeInfo {
81
82public:
83  /** \brief Modify model according to information at node
84
85        The routine modifies the model according to bound information at node,
86        creates a new basis according to information at node, but with the size
87        passed in through basis, and adds any cuts to the addCuts array.
88
89      \note The basis passed in via basis is solely a vehicle for passing in
90        the desired basis size. It will be deleted and a new basis returned.
91    */
92  virtual void applyToModel(CbcModel *model, CoinWarmStartBasis *&basis,
93    CbcCountRowCut **addCuts,
94    int &currentNumberCuts) const;
95
96  /// Just apply bounds to one variable - force means overwrite by lower,upper (1=>infeasible)
97  virtual int applyBounds(int iColumn, double &lower, double &upper, int force);
98
99  /** Builds up row basis backwards (until original model).
100        Returns NULL or previous one to apply .
101        Depends on Free being 0 and impossible for cuts
102    */
103  virtual CbcNodeInfo *buildRowBasis(CoinWarmStartBasis &basis) const;
104  // Default Constructor
105  CbcFullNodeInfo();
106
107  /** Constructor from continuous or satisfied
108    */
109  CbcFullNodeInfo(CbcModel *model,
110    int numberRowsAtContinuous);
111
112  // Copy constructor
113  CbcFullNodeInfo(const CbcFullNodeInfo &);
114
115  // Destructor
116  ~CbcFullNodeInfo();
117
118  /// Clone
119  virtual CbcNodeInfo *clone() const;
120  /// Lower bounds
121  inline const double *lower() const
122  {
123    return lower_;
124  }
125  /// Set a bound
126  inline void setColLower(int sequence, double value)
127  {
128    lower_[sequence] = value;
129  }
130  /// Mutable lower bounds
131  inline double *mutableLower() const
132  {
133    return lower_;
134  }
135  /// Upper bounds
136  inline const double *upper() const
137  {
138    return upper_;
139  }
140  /// Set a bound
141  inline void setColUpper(int sequence, double value)
142  {
143    upper_[sequence] = value;
144  }
145  /// Mutable upper bounds
146  inline double *mutableUpper() const
147  {
148    return upper_;
149  }
150
151protected:
152  // Data
153  /** Full basis
154
155      This MUST BE A POINTER to avoid cutting extra information in derived
156      warm start classes.
157    */
158  CoinWarmStartBasis *basis_;
159  int numberIntegers_;
160  // Bounds stored in full
161  double *lower_;
162  double *upper_;
163
164private:
165  /// Illegal Assignment operator
166  CbcFullNodeInfo &operator=(const CbcFullNodeInfo &rhs);
167};
168#endif //CbcFullNodeInfo_H
169
170/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
171*/
Note: See TracBrowser for help on using the repository browser.