1/* $Id: ClpDualRowPivot.hpp 1753 2011-06-19 16:27:26Z stefan $ */
2// Copyright (C) 2002, International Business Machines
3// Corporation and others. All Rights Reserved.
4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
6#ifndef ClpDualRowPivot_H
7#define ClpDualRowPivot_H
8
9class ClpSimplex;
10class CoinIndexedVector;
11
12//#############################################################################
13
14/** Dual Row Pivot Abstract Base Class
15
16Abstract Base Class for describing an interface to an algorithm
17to choose row pivot in dual simplex algorithm. For some algorithms
18e.g. Dantzig choice then some functions may be null.
19
20*/
21
22class ClpDualRowPivot {
23
24public:
25
26 ///@name Algorithmic methods
27 //@{
28
29 /// Returns pivot row, -1 if none
30 virtual int pivotRow() = 0;
31
32 /** Updates weights and returns pivot alpha.
33 Also does FT update */
34 virtual double updateWeights(CoinIndexedVector * input,
35 CoinIndexedVector * spare,
36 CoinIndexedVector * spare2,
37 CoinIndexedVector * updatedColumn) = 0;
38
39 /** Updates primal solution (and maybe list of candidates)
40 Uses input vector which it deletes
41 Computes change in objective function
42 Would be faster if we kept basic regions, but on other hand it
43 means everything is always in sync
44 */
45 /* FIXME: this was pure virtul (=0). Why? */
46 virtual void updatePrimalSolution(CoinIndexedVector * input,
47 double theta,
48 double & changeInObjective) = 0;
49 /** Saves any weights round factorization as pivot rows may change
50 Will be empty unless steepest edge (will save model)
51 May also recompute infeasibility stuff
52 1) before factorization
53 2) after good factorization (if weights empty may initialize)
54 3) after something happened but no factorization
55 (e.g. check for infeasible)
56 4) as 2 but restore weights from previous snapshot
57 5) for strong branching - initialize , infeasibilities
58 */
59 virtual void saveWeights(ClpSimplex * model, int mode);
60 /// checks accuracy and may re-initialize (may be empty)
61 virtual void checkAccuracy();
62 /// Gets rid of last update (may be empty)
63 virtual void unrollWeights();
64 /// Gets rid of all arrays (may be empty)
65 virtual void clearArrays();
66 /// Returns true if would not find any row
67 virtual bool looksOptimal() const {
68 return false;
69 }
70 /// Called when maximum pivots changes
71 virtual void maximumPivotsChanged() {}
72 //@}
73
74
75 ///@name Constructors and destructors
76 //@{
77 /// Default Constructor
78 ClpDualRowPivot();
79
80 /// Copy constructor
81 ClpDualRowPivot(const ClpDualRowPivot &);
82
83 /// Assignment operator
84 ClpDualRowPivot & operator=(const ClpDualRowPivot& rhs);
85
86 /// Destructor
87 virtual ~ClpDualRowPivot ();
88
89 /// Clone
90 virtual ClpDualRowPivot * clone(bool copyData = true) const = 0;
91
92 //@}
93
94 ///@name Other
95 //@{
96 /// Returns model
97 inline ClpSimplex * model() {
98 return model_;
99 }
100
101 /// Sets model (normally to NULL)
102 inline void setModel(ClpSimplex * newmodel) {
103 model_ = newmodel;
104 }
105
106 /// Returns type (above 63 is extra information)
107 inline int type() {
108 return type_;
109 }
110
111 //@}
112
113 //---------------------------------------------------------------------------
114
115protected:
116 ///@name Protected member data
117 //@{
118 /// Pointer to model
119 ClpSimplex * model_;
120 /// Type of row pivot algorithm
121 int type_;
122 //@}
123};
124#ifndef CLP_DUAL_COLUMN_MULTIPLIER
125//#define CLP_DUAL_COLUMN_MULTIPLIER 0.99999
126#endif
127#endif
128