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 CoinIndexedVector; |
---|
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(CoinIndexedVector * input, |
---|
30 | CoinIndexedVector * spare, |
---|
31 | CoinIndexedVector * 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(CoinIndexedVector * 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 | 5) for strong branching - initialize (uninitialized) , infeasibilities |
---|
50 | */ |
---|
51 | virtual void saveWeights(ClpSimplex * model, int mode); |
---|
52 | /// Gets rid of last update |
---|
53 | virtual void unrollWeights(); |
---|
54 | //@} |
---|
55 | |
---|
56 | |
---|
57 | ///@name Constructors and destructors |
---|
58 | //@{ |
---|
59 | /** Default Constructor |
---|
60 | 0 is unintialized, 1 full |
---|
61 | */ |
---|
62 | ClpDualRowSteepest(int mode=0); |
---|
63 | |
---|
64 | /// Copy constructor |
---|
65 | ClpDualRowSteepest(const ClpDualRowSteepest &); |
---|
66 | |
---|
67 | /// Assignment operator |
---|
68 | ClpDualRowSteepest & operator=(const ClpDualRowSteepest& rhs); |
---|
69 | |
---|
70 | /// Destructor |
---|
71 | virtual ~ClpDualRowSteepest (); |
---|
72 | |
---|
73 | /// Clone |
---|
74 | virtual ClpDualRowPivot * clone(bool copyData = true) const; |
---|
75 | |
---|
76 | //@} |
---|
77 | /**@name gets and sets */ |
---|
78 | //@{ |
---|
79 | /// Mode |
---|
80 | inline int mode() const |
---|
81 | { return mode_;}; |
---|
82 | //@} |
---|
83 | |
---|
84 | //--------------------------------------------------------------------------- |
---|
85 | |
---|
86 | private: |
---|
87 | ///@name Private member data |
---|
88 | /** Status |
---|
89 | 0) Normal |
---|
90 | -1) Needs initialization |
---|
91 | 1) Weights are stored by sequence number |
---|
92 | */ |
---|
93 | int state_; |
---|
94 | /// If 0 then we are using uninitialized weights, 1 then full |
---|
95 | int mode_; |
---|
96 | /// weight array |
---|
97 | double * weights_; |
---|
98 | /// square of infeasibility array (just for infeasible rows) |
---|
99 | CoinIndexedVector * infeasible_; |
---|
100 | /// alternate weight array (so we can unroll) |
---|
101 | CoinIndexedVector * alternateWeights_; |
---|
102 | /// save weight array (so we can use checkpoint) |
---|
103 | CoinIndexedVector * savedWeights_; |
---|
104 | //@} |
---|
105 | }; |
---|
106 | |
---|
107 | #endif |
---|