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