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 OsiIndexedVector; |
---|
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 (may be empty) |
---|
30 | virtual void updateWeights(OsiIndexedVector * input, |
---|
31 | OsiIndexedVector * spare, |
---|
32 | OsiIndexedVector * updatedColumn); |
---|
33 | |
---|
34 | /** Updates primal solution (and maybe list of candidates) |
---|
35 | Uses input vector which it deletes |
---|
36 | Computes change in objective function |
---|
37 | Would be faster if we kept basic regions, but on other hand it |
---|
38 | means everything is always in sync |
---|
39 | */ |
---|
40 | virtual void updatePrimalSolution(OsiIndexedVector * input, |
---|
41 | double theta, |
---|
42 | double & changeInObjective)=0; |
---|
43 | /** Saves any weights round factorization as pivot rows may change |
---|
44 | Will be empty unless steepest edge (will save model) |
---|
45 | May also recompute infeasibility stuff |
---|
46 | 1) before factorization |
---|
47 | 2) after good factorization (if weights empty may initialize) |
---|
48 | 3) after something happened but no factorization |
---|
49 | (e.g. check for infeasible) |
---|
50 | 4) as 2 but restore weights from previous snapshot |
---|
51 | */ |
---|
52 | virtual void saveWeights(ClpSimplex * model,int mode); |
---|
53 | /// checks accuracy and may re-initialize (may be empty) |
---|
54 | virtual void checkAccuracy(); |
---|
55 | /// Gets rid of last update (may be empty) |
---|
56 | virtual void unrollWeights(); |
---|
57 | //@} |
---|
58 | |
---|
59 | |
---|
60 | ///@name Constructors and destructors |
---|
61 | //@{ |
---|
62 | /// Default Constructor |
---|
63 | ClpDualRowPivot(); |
---|
64 | |
---|
65 | /// Copy constructor |
---|
66 | ClpDualRowPivot(const ClpDualRowPivot &); |
---|
67 | |
---|
68 | /// Assignment operator |
---|
69 | ClpDualRowPivot & operator=(const ClpDualRowPivot& rhs); |
---|
70 | |
---|
71 | /// Destructor |
---|
72 | virtual ~ClpDualRowPivot (); |
---|
73 | |
---|
74 | /// Clone |
---|
75 | virtual ClpDualRowPivot * clone(bool copyData = true) const = 0; |
---|
76 | |
---|
77 | //@} |
---|
78 | |
---|
79 | ///@name Other |
---|
80 | //@{ |
---|
81 | /// Returns model |
---|
82 | inline ClpSimplex * model() |
---|
83 | { return model_;}; |
---|
84 | |
---|
85 | /// Returns type |
---|
86 | inline int type() |
---|
87 | { return type_;}; |
---|
88 | |
---|
89 | //@} |
---|
90 | |
---|
91 | //--------------------------------------------------------------------------- |
---|
92 | |
---|
93 | protected: |
---|
94 | ///@name Protected member data |
---|
95 | //@{ |
---|
96 | /// Pointer to model |
---|
97 | ClpSimplex * model_; |
---|
98 | /// Type of row pivot algorithm |
---|
99 | int type_; |
---|
100 | //@} |
---|
101 | }; |
---|
102 | |
---|
103 | #endif |
---|