1 | // Copyright (C) 2002, International Business Machines |
---|
2 | // Corporation and others. All Rights Reserved. |
---|
3 | #ifndef ClpPrimalcolumnPivot_H |
---|
4 | #define ClpPrimalcolumnPivot_H |
---|
5 | |
---|
6 | class ClpSimplex; |
---|
7 | class OsiIndexedVector; |
---|
8 | |
---|
9 | //############################################################################# |
---|
10 | |
---|
11 | /** Primal Column Pivot Abstract Base Class |
---|
12 | |
---|
13 | Abstract Base Class for describing an interface to an algorithm |
---|
14 | to choose column pivot in primal simplex algorithm. For some algorithms |
---|
15 | e.g. Dantzig choice then some functions may be null. |
---|
16 | |
---|
17 | */ |
---|
18 | |
---|
19 | class ClpPrimalColumnPivot { |
---|
20 | |
---|
21 | public: |
---|
22 | |
---|
23 | ///@name Algorithmic methods |
---|
24 | //@{ |
---|
25 | |
---|
26 | /** Returns pivot column, -1 if none |
---|
27 | updateArray has cost updates (also use pivotRow_ from last iteration) |
---|
28 | We can use other arrays to help updates |
---|
29 | */ |
---|
30 | virtual int pivotColumn(OsiIndexedVector * updates, |
---|
31 | OsiIndexedVector * spareRow1, |
---|
32 | OsiIndexedVector * spareRow2, |
---|
33 | OsiIndexedVector * spareColumn1, |
---|
34 | OsiIndexedVector * spareColumn2) = 0; |
---|
35 | |
---|
36 | /// Updates weights - part 1 (may be empty) |
---|
37 | virtual void updateWeights(OsiIndexedVector * input); |
---|
38 | |
---|
39 | /** Saves any weights round factorization as pivot rows may change |
---|
40 | Will be empty unless steepest edge (will save model) |
---|
41 | May also recompute infeasibility stuff |
---|
42 | 1) before factorization |
---|
43 | 2) after good factorization (if weights empty may initialize) |
---|
44 | 3) after something happened but no factorization |
---|
45 | (e.g. check for infeasible) |
---|
46 | 4) as 2 but restore weights from previous snapshot |
---|
47 | 5) forces some initialization e.g. weights |
---|
48 | Also sets model |
---|
49 | */ |
---|
50 | virtual void saveWeights(ClpSimplex * model,int mode)=0; |
---|
51 | /** Signals pivot row choice: |
---|
52 | -2 (default) - use normal pivot row choice |
---|
53 | -1 to numberRows-1 - use this (will be checked) |
---|
54 | way should be -1 to go to lower bound, +1 to upper bound |
---|
55 | */ |
---|
56 | virtual int pivotRow(double & way) |
---|
57 | {way=0;return -2;}; |
---|
58 | //@} |
---|
59 | |
---|
60 | |
---|
61 | ///@name Constructors and destructors |
---|
62 | //@{ |
---|
63 | /// Default Constructor |
---|
64 | ClpPrimalColumnPivot(); |
---|
65 | |
---|
66 | /// Copy constructor |
---|
67 | ClpPrimalColumnPivot(const ClpPrimalColumnPivot &); |
---|
68 | |
---|
69 | /// Assignment operator |
---|
70 | ClpPrimalColumnPivot & operator=(const ClpPrimalColumnPivot& rhs); |
---|
71 | |
---|
72 | /// Destructor |
---|
73 | virtual ~ClpPrimalColumnPivot (); |
---|
74 | |
---|
75 | /// Clone |
---|
76 | virtual ClpPrimalColumnPivot * clone(bool copyData = true) const = 0; |
---|
77 | |
---|
78 | //@} |
---|
79 | |
---|
80 | ///@name Other |
---|
81 | //@{ |
---|
82 | /// Returns model |
---|
83 | inline ClpSimplex * model() |
---|
84 | { return model_;}; |
---|
85 | |
---|
86 | /// Returns type |
---|
87 | inline int type() |
---|
88 | { return type_;}; |
---|
89 | |
---|
90 | //@} |
---|
91 | |
---|
92 | //--------------------------------------------------------------------------- |
---|
93 | |
---|
94 | protected: |
---|
95 | ///@name Protected member data |
---|
96 | //@{ |
---|
97 | /// Pointer to model |
---|
98 | ClpSimplex * model_; |
---|
99 | /// Type of column pivot algorithm |
---|
100 | int type_; |
---|
101 | //@} |
---|
102 | }; |
---|
103 | |
---|
104 | #endif |
---|