1 | // Copyright (C) 2002, International Business Machines |
---|
2 | // Corporation and others. All Rights Reserved. |
---|
3 | #ifndef ClpDualRowSteepest_H |
---|
4 | #define ClpDualRowSteepest_H |
---|
5 | |
---|
6 | #include "ClpDualRowPivot.hpp" |
---|
7 | |
---|
8 | //############################################################################# |
---|
9 | |
---|
10 | /** Dual Row Pivot Steepest Edge Algorithm Class |
---|
11 | |
---|
12 | See Forrest-Goldfarb paper for algorithm |
---|
13 | |
---|
14 | */ |
---|
15 | |
---|
16 | class OsiIndexedVector; |
---|
17 | |
---|
18 | class ClpDualRowSteepest : public ClpDualRowPivot { |
---|
19 | |
---|
20 | public: |
---|
21 | |
---|
22 | ///@name Algorithmic methods |
---|
23 | //@{ |
---|
24 | |
---|
25 | /// Returns pivot row, -1 if none |
---|
26 | virtual int pivotRow(); |
---|
27 | |
---|
28 | /// Updates weights (may be empty) |
---|
29 | virtual void updateWeights(OsiIndexedVector * input, |
---|
30 | OsiIndexedVector * spare, |
---|
31 | OsiIndexedVector * updatedColumn); |
---|
32 | |
---|
33 | /** Updates primal solution (and maybe list of candidates) |
---|
34 | Uses input vector which it deletes |
---|
35 | Computes change in objective function |
---|
36 | */ |
---|
37 | virtual void updatePrimalSolution(OsiIndexedVector * input, |
---|
38 | double theta, |
---|
39 | double & changeInObjective); |
---|
40 | |
---|
41 | /** Saves any weights round factorization as pivot rows may change |
---|
42 | Save model |
---|
43 | May also recompute infeasibility stuff |
---|
44 | 1) before factorization |
---|
45 | 2) after good factorization (if weights empty may initialize) |
---|
46 | 3) after something happened but no factorization |
---|
47 | (e.g. check for infeasible) |
---|
48 | 4) as 2 but restore weights from previous snapshot |
---|
49 | */ |
---|
50 | virtual void saveWeights(ClpSimplex * model, int mode); |
---|
51 | /// Gets rid of last update |
---|
52 | virtual void unrollWeights(); |
---|
53 | //@} |
---|
54 | |
---|
55 | |
---|
56 | ///@name Constructors and destructors |
---|
57 | //@{ |
---|
58 | /** Default Constructor |
---|
59 | 0 is unintialized, 1 full |
---|
60 | */ |
---|
61 | ClpDualRowSteepest(int mode=0); |
---|
62 | |
---|
63 | /// Copy constructor |
---|
64 | ClpDualRowSteepest(const ClpDualRowSteepest &); |
---|
65 | |
---|
66 | /// Assignment operator |
---|
67 | ClpDualRowSteepest & operator=(const ClpDualRowSteepest& rhs); |
---|
68 | |
---|
69 | /// Destructor |
---|
70 | virtual ~ClpDualRowSteepest (); |
---|
71 | |
---|
72 | /// Clone |
---|
73 | virtual ClpDualRowPivot * clone(bool copyData = true) const; |
---|
74 | |
---|
75 | //@} |
---|
76 | |
---|
77 | //--------------------------------------------------------------------------- |
---|
78 | |
---|
79 | private: |
---|
80 | ///@name Private member data |
---|
81 | /** Status |
---|
82 | 0) Normal |
---|
83 | -1) Needs initialization |
---|
84 | 1) Weights are stored by sequence number |
---|
85 | */ |
---|
86 | int state_; |
---|
87 | /// If 0 then we are using uninitialized weights, 1 then full |
---|
88 | int mode_; |
---|
89 | /// weight array |
---|
90 | double * weights_; |
---|
91 | /// square of infeasibility array (just for infeasible rows) |
---|
92 | OsiIndexedVector * infeasible_; |
---|
93 | /// alternate weight array (so we can unroll) |
---|
94 | OsiIndexedVector * alternateWeights_; |
---|
95 | /// save weight array (so we can use checkpoint) |
---|
96 | OsiIndexedVector * savedWeights_; |
---|
97 | //@} |
---|
98 | }; |
---|
99 | |
---|
100 | #endif |
---|