1 | // $Id$ |
---|
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 CbcPartialNodeInfo_H |
---|
9 | #define CbcPartialNodeInfo_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 | |
---|
19 | class OsiSolverInterface; |
---|
20 | class OsiSolverBranch; |
---|
21 | |
---|
22 | class OsiCuts; |
---|
23 | class OsiRowCut; |
---|
24 | class OsiRowCutDebugger; |
---|
25 | class CoinWarmStartBasis; |
---|
26 | class CbcCountRowCut; |
---|
27 | class CbcModel; |
---|
28 | class CbcNode; |
---|
29 | class CbcSubProblem; |
---|
30 | class CbcGeneralBranchingObject; |
---|
31 | /** \brief Holds information for recreating a subproblem by incremental change |
---|
32 | from the parent. |
---|
33 | |
---|
34 | A CbcPartialNodeInfo object contains changes to the bounds and basis, and |
---|
35 | additional cuts, required to recreate a subproblem by modifying and |
---|
36 | augmenting the parent subproblem. |
---|
37 | */ |
---|
38 | |
---|
39 | class CbcPartialNodeInfo : public CbcNodeInfo { |
---|
40 | |
---|
41 | public: |
---|
42 | |
---|
43 | /** \brief Modify model according to information at node |
---|
44 | |
---|
45 | The routine modifies the model according to bound and basis change |
---|
46 | information at node and adds any cuts to the addCuts array. |
---|
47 | */ |
---|
48 | virtual void applyToModel (CbcModel *model, CoinWarmStartBasis *&basis, |
---|
49 | CbcCountRowCut **addCuts, |
---|
50 | int ¤tNumberCuts) const ; |
---|
51 | |
---|
52 | /// Just apply bounds to one variable - force means overwrite by lower,upper (1=>infeasible) |
---|
53 | virtual int applyBounds(int iColumn, double & lower, double & upper, int force) ; |
---|
54 | /** Builds up row basis backwards (until original model). |
---|
55 | Returns NULL or previous one to apply . |
---|
56 | Depends on Free being 0 and impossible for cuts |
---|
57 | */ |
---|
58 | virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis & basis ) const ; |
---|
59 | // Default Constructor |
---|
60 | CbcPartialNodeInfo (); |
---|
61 | |
---|
62 | // Constructor from current state |
---|
63 | CbcPartialNodeInfo (CbcNodeInfo * parent, CbcNode * owner, |
---|
64 | int numberChangedBounds, const int * variables, |
---|
65 | const double * boundChanges, |
---|
66 | const CoinWarmStartDiff *basisDiff) ; |
---|
67 | |
---|
68 | // Copy constructor |
---|
69 | CbcPartialNodeInfo ( const CbcPartialNodeInfo &); |
---|
70 | |
---|
71 | // Destructor |
---|
72 | ~CbcPartialNodeInfo (); |
---|
73 | |
---|
74 | /// Clone |
---|
75 | virtual CbcNodeInfo * clone() const; |
---|
76 | /// Basis diff information |
---|
77 | inline const CoinWarmStartDiff *basisDiff() const { |
---|
78 | return basisDiff_ ; |
---|
79 | } |
---|
80 | /// Which variable (top bit if upper bound changing) |
---|
81 | inline const int * variables() const { |
---|
82 | return variables_; |
---|
83 | } |
---|
84 | // New bound |
---|
85 | inline const double * newBounds() const { |
---|
86 | return newBounds_; |
---|
87 | } |
---|
88 | /// Number of bound changes |
---|
89 | inline int numberChangedBounds() const { |
---|
90 | return numberChangedBounds_; |
---|
91 | } |
---|
92 | protected: |
---|
93 | /* Data values */ |
---|
94 | |
---|
95 | /// Basis diff information |
---|
96 | CoinWarmStartDiff *basisDiff_ ; |
---|
97 | /// Which variable (top bit if upper bound changing) |
---|
98 | int * variables_; |
---|
99 | // New bound |
---|
100 | double * newBounds_; |
---|
101 | /// Number of bound changes |
---|
102 | int numberChangedBounds_; |
---|
103 | private: |
---|
104 | |
---|
105 | /// Illegal Assignment operator |
---|
106 | CbcPartialNodeInfo & operator=(const CbcPartialNodeInfo& rhs); |
---|
107 | }; |
---|
108 | |
---|
109 | #endif //CbcPartialNodeInfo_H |
---|
110 | |
---|