1 | /* $Id: ClpDualRowPivot.hpp 2385 2019-01-06 19:43:06Z 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 | #ifndef ClpDualRowPivot_H |
---|
7 | #define ClpDualRowPivot_H |
---|
8 | |
---|
9 | class ClpSimplex; |
---|
10 | class CoinIndexedVector; |
---|
11 | |
---|
12 | //############################################################################# |
---|
13 | |
---|
14 | /** Dual Row Pivot Abstract Base Class |
---|
15 | |
---|
16 | Abstract Base Class for describing an interface to an algorithm |
---|
17 | to choose row pivot in dual simplex algorithm. For some algorithms |
---|
18 | e.g. Dantzig choice then some functions may be null. |
---|
19 | |
---|
20 | */ |
---|
21 | |
---|
22 | class ClpDualRowPivot { |
---|
23 | |
---|
24 | public: |
---|
25 | ///@name Algorithmic methods |
---|
26 | //@{ |
---|
27 | |
---|
28 | /// Returns pivot row, -1 if none |
---|
29 | virtual int pivotRow() = 0; |
---|
30 | |
---|
31 | /** Updates weights and returns pivot alpha. |
---|
32 | Also does FT update */ |
---|
33 | virtual double updateWeights(CoinIndexedVector *input, |
---|
34 | CoinIndexedVector *spare, |
---|
35 | CoinIndexedVector *spare2, |
---|
36 | CoinIndexedVector *updatedColumn) |
---|
37 | = 0; |
---|
38 | |
---|
39 | /** Updates primal solution (and maybe list of candidates) |
---|
40 | Uses input vector which it deletes |
---|
41 | Computes change in objective function |
---|
42 | Would be faster if we kept basic regions, but on other hand it |
---|
43 | means everything is always in sync |
---|
44 | */ |
---|
45 | /* FIXME: this was pure virtul (=0). Why? */ |
---|
46 | virtual void updatePrimalSolution(CoinIndexedVector *input, |
---|
47 | double theta, |
---|
48 | double &changeInObjective) |
---|
49 | = 0; |
---|
50 | /** Saves any weights round factorization as pivot rows may change |
---|
51 | Will be empty unless steepest edge (will save model) |
---|
52 | May also recompute infeasibility stuff |
---|
53 | 1) before factorization |
---|
54 | 2) after good factorization (if weights empty may initialize) |
---|
55 | 3) after something happened but no factorization |
---|
56 | (e.g. check for infeasible) |
---|
57 | 4) as 2 but restore weights from previous snapshot |
---|
58 | 5) for strong branching - initialize to 1 , infeasibilities |
---|
59 | 6) scale back |
---|
60 | 7) for strong branching - initialize full weights , infeasibilities |
---|
61 | */ |
---|
62 | virtual void saveWeights(ClpSimplex *model, int mode); |
---|
63 | /// checks accuracy and may re-initialize (may be empty) |
---|
64 | virtual void checkAccuracy(); |
---|
65 | /// Gets rid of last update (may be empty) |
---|
66 | virtual void unrollWeights(); |
---|
67 | /// Gets rid of all arrays (may be empty) |
---|
68 | virtual void clearArrays(); |
---|
69 | /// Returns true if would not find any row |
---|
70 | virtual bool looksOptimal() const |
---|
71 | { |
---|
72 | return false; |
---|
73 | } |
---|
74 | /// Called when maximum pivots changes |
---|
75 | virtual void maximumPivotsChanged() {} |
---|
76 | //@} |
---|
77 | |
---|
78 | ///@name Constructors and destructors |
---|
79 | //@{ |
---|
80 | /// Default Constructor |
---|
81 | ClpDualRowPivot(); |
---|
82 | |
---|
83 | /// Copy constructor |
---|
84 | ClpDualRowPivot(const ClpDualRowPivot &); |
---|
85 | |
---|
86 | /// Assignment operator |
---|
87 | ClpDualRowPivot &operator=(const ClpDualRowPivot &rhs); |
---|
88 | |
---|
89 | /// Destructor |
---|
90 | virtual ~ClpDualRowPivot(); |
---|
91 | |
---|
92 | /// Clone |
---|
93 | virtual ClpDualRowPivot *clone(bool copyData = true) const = 0; |
---|
94 | |
---|
95 | //@} |
---|
96 | |
---|
97 | ///@name Other |
---|
98 | //@{ |
---|
99 | /// Returns model |
---|
100 | inline ClpSimplex *model() |
---|
101 | { |
---|
102 | return model_; |
---|
103 | } |
---|
104 | |
---|
105 | /// Sets model (normally to NULL) |
---|
106 | inline void setModel(ClpSimplex *newmodel) |
---|
107 | { |
---|
108 | model_ = newmodel; |
---|
109 | } |
---|
110 | |
---|
111 | /// Returns type (above 63 is extra information) |
---|
112 | inline int type() |
---|
113 | { |
---|
114 | return type_; |
---|
115 | } |
---|
116 | |
---|
117 | //@} |
---|
118 | |
---|
119 | //--------------------------------------------------------------------------- |
---|
120 | |
---|
121 | protected: |
---|
122 | ///@name Protected member data |
---|
123 | //@{ |
---|
124 | /// Pointer to model |
---|
125 | ClpSimplex *model_; |
---|
126 | /// Type of row pivot algorithm |
---|
127 | int type_; |
---|
128 | //@} |
---|
129 | }; |
---|
130 | #ifndef CLP_DUAL_COLUMN_MULTIPLIER |
---|
131 | //#define CLP_DUAL_COLUMN_MULTIPLIER 0.99999 |
---|
132 | #endif |
---|
133 | #endif |
---|
134 | |
---|
135 | /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 |
---|
136 | */ |
---|