1 | // Copyright (C) 2002, International Business Machines |
---|
2 | // Corporation and others. All Rights Reserved. |
---|
3 | /* |
---|
4 | Authors |
---|
5 | |
---|
6 | Jeremy Omer, Mehdi Towhidi |
---|
7 | |
---|
8 | Last update: april 10, 2015 |
---|
9 | |
---|
10 | */ |
---|
11 | |
---|
12 | |
---|
13 | #ifndef ClpPEPrimalColumnSteepest_H |
---|
14 | #define ClpPEPrimalColumnSteepest_H |
---|
15 | |
---|
16 | #include "ClpPrimalColumnSteepest.hpp" |
---|
17 | #include "ClpFactorization.hpp" |
---|
18 | #include "ClpPESimplex.hpp" |
---|
19 | #include <bitset> |
---|
20 | |
---|
21 | //############################################################################# |
---|
22 | class CoinIndexedVector; |
---|
23 | |
---|
24 | |
---|
25 | /** Primal Column Pivot Steepest Edge Algorithm Class |
---|
26 | |
---|
27 | See Forrest-Goldfarb paper for algorithm |
---|
28 | |
---|
29 | */ |
---|
30 | |
---|
31 | |
---|
32 | class ClpPEPrimalColumnSteepest : public ClpPrimalColumnSteepest { |
---|
33 | public: |
---|
34 | |
---|
35 | ///@name Constructors and destructors |
---|
36 | //@{ |
---|
37 | /** Default Constructor |
---|
38 | 0 is exact devex, 1 full steepest, 2 is partial exact devex |
---|
39 | 3 switches between 0 and 2 depending on factorization |
---|
40 | 4 starts as partial dantzig/devex but then may switch between 0 and 2. |
---|
41 | By partial exact devex is meant that the weights are updated as normal |
---|
42 | but only part of the nonbasic variables are scanned. |
---|
43 | This can be faster on very easy problems. |
---|
44 | */ |
---|
45 | ClpPEPrimalColumnSteepest(double psi = 0.5, int mode = 3); |
---|
46 | |
---|
47 | /// Copy constructor |
---|
48 | ClpPEPrimalColumnSteepest(const ClpPEPrimalColumnSteepest & rhs); |
---|
49 | |
---|
50 | /// Assignment operator |
---|
51 | ClpPEPrimalColumnSteepest & operator=(const ClpPEPrimalColumnSteepest& rhs); |
---|
52 | |
---|
53 | /// Destructor |
---|
54 | virtual ~ClpPEPrimalColumnSteepest (); |
---|
55 | |
---|
56 | /// Clone |
---|
57 | virtual ClpPrimalColumnPivot * clone(bool copyData = true) const; |
---|
58 | |
---|
59 | public: |
---|
60 | |
---|
61 | ///@name Algorithmic methods |
---|
62 | //@{ |
---|
63 | |
---|
64 | /** Returns pivot column, -1 if none. |
---|
65 | The Packed CoinIndexedVector updates has cost updates - for normal LP |
---|
66 | that is just +-weight where a feasibility changed. It also has |
---|
67 | reduced cost from last iteration in pivot row |
---|
68 | Parts of operation split out into separate functions for |
---|
69 | profiling and speed |
---|
70 | */ |
---|
71 | virtual int pivotColumn(CoinIndexedVector * updates, |
---|
72 | CoinIndexedVector * spareRow1, |
---|
73 | CoinIndexedVector * spareRow2, |
---|
74 | CoinIndexedVector * spareColumn1, |
---|
75 | CoinIndexedVector * spareColumn2); |
---|
76 | |
---|
77 | //@} |
---|
78 | /** Save weights - this may initialize weights as well |
---|
79 | This is as parent but may initialize ClpPESimplex |
---|
80 | */ |
---|
81 | virtual void saveWeights(ClpSimplex * model, int mode); |
---|
82 | /// Updates weights - as ordinary but checks for zero moves |
---|
83 | virtual void updateWeights(CoinIndexedVector * input); |
---|
84 | //--------------------------------------------------------------------------- |
---|
85 | // Psi |
---|
86 | inline double psi() const |
---|
87 | { return psi_;} |
---|
88 | |
---|
89 | private: |
---|
90 | /* this PESimplex object is used to identify the compatible variables */ |
---|
91 | ClpPESimplex *modelPE_; |
---|
92 | |
---|
93 | /* psi is the factor used in the bi-dimensional pricing, it is < 1 and |
---|
94 | 1/psi grows with the priority given to compatible variables */ |
---|
95 | double psi_; |
---|
96 | |
---|
97 | /* useful counters for the update of the set of compatible variables */ |
---|
98 | int iCurrent_; |
---|
99 | int iInterval_; |
---|
100 | |
---|
101 | /* record if previous iterations concluded that compatibles should not be checked */ |
---|
102 | int coDegenCompatibles_; |
---|
103 | int coConsecutiveCompatibles_; |
---|
104 | bool updateCompatibles_; |
---|
105 | }; |
---|
106 | |
---|
107 | #endif |
---|