Cgl 0.60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbcPrimalColumnSteepest.hpp
Go to the documentation of this file.
1 /* $Id: AbcPrimalColumnSteepest.hpp 2385 2019-01-06 19:43:06Z unxusr $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5
6 #ifndef AbcPrimalColumnSteepest_H
7 #define AbcPrimalColumnSteepest_H
8
9 #include "AbcPrimalColumnPivot.hpp"
10 #include <bitset>
11
12 //#############################################################################
13 class CoinIndexedVector;
14
21 class AbcPrimalColumnSteepest : public AbcPrimalColumnPivot {
22
23 public:
25
26
34 virtual int pivotColumn(CoinPartitionedVector *updates,
35 CoinPartitionedVector *spareRow2,
36 CoinPartitionedVector *spareColumn1);
38 void justDjs(CoinIndexedVector *updates,
39 CoinIndexedVector *spareColumn1);
41 int partialPricing(CoinIndexedVector *updates,
42 int numberWanted,
43 int numberLook);
45 void djsAndDevex(CoinIndexedVector *updates,
46 CoinIndexedVector *spareRow2,
47 CoinIndexedVector *spareColumn1);
49 void djsAndDevex2(CoinIndexedVector *updates,
50 CoinIndexedVector *spareColumn1);
52 void justDevex(CoinIndexedVector *updates,
53 CoinIndexedVector *spareColumn1);
61 int doSteepestWork(CoinPartitionedVector *updates,
62 CoinPartitionedVector *spareRow2,
63 CoinPartitionedVector *spareColumn1,
64 int type);
65
67 virtual void updateWeights(CoinIndexedVector *input);
68
70 void checkAccuracy(int sequence, double relativeTolerance,
71 CoinIndexedVector *rowArray1);
72
74 void initializeWeights();
75
84 virtual void saveWeights(AbcSimplex *model, int mode);
86 virtual void unrollWeights();
88 virtual void clearArrays();
90 virtual bool looksOptimal() const;
92 virtual void maximumPivotsChanged();
94
97 inline int mode() const
99 {
100 return mode_;
101 }
103
106 enum Persistence {
107 normal = 0x00, // create (if necessary) and destroy
108 keep = 0x01 // create (if necessary) and leave
109 };
110
112
113
121 AbcPrimalColumnSteepest(int mode = 3);
122
124 AbcPrimalColumnSteepest(const AbcPrimalColumnSteepest &rhs);
125
127 AbcPrimalColumnSteepest &operator=(const AbcPrimalColumnSteepest &rhs);
128
130 virtual ~AbcPrimalColumnSteepest();
131
133 virtual AbcPrimalColumnPivot *clone(bool copyData = true) const;
134
136
138
141 inline bool reference(int i) const
142 {
143 return ((reference_[i >> 5] >> (i & 31)) & 1) != 0;
144 }
145 inline void setReference(int i, bool trueFalse)
146 {
147 unsigned int &value = reference_[i >> 5];
148 int bit = i & 31;
149 if (trueFalse)
150 value |= (1 << bit);
151 else
152 value &= ~(1 << bit);
153 }
155 inline void setPersistence(Persistence life)
156 {
157 persistence_ = life;
158 }
159 inline Persistence persistence() const
160 {
161 return persistence_;
162 }
163
165 //---------------------------------------------------------------------------
166
167 private:
169 // Update weight
170 double devex_;
172 double *weights_;
174 CoinIndexedVector *infeasible_;
176 CoinIndexedVector *alternateWeights_;
178 double *savedWeights_;
179 // Array for exact devex to say what is in reference framework
180 unsigned int *reference_;
186 int state_;
199 int mode_;
201 Persistence persistence_;
203 int numberSwitched_;
204 // This is pivot row (or pivot sequence round re-factorization)
205 int pivotSequence_;
206 // This is saved pivot sequence
207 int savedPivotSequence_;
208 // This is saved outgoing variable
209 int savedSequenceOut_;
210 // Iteration when last rectified
211 int lastRectified_;
212 // Size of factorization at invert (used to decide algorithm)
213 int sizeFactorization_;
215 };
216
217 #endif
218
219 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
220 */
AbcPrimalColumnSteepest::checkAccuracy
void checkAccuracy(int sequence, double relativeTolerance, CoinIndexedVector *rowArray1)
Checks accuracy - just for debug.
AbcPrimalColumnSteepest::updateWeights
virtual void updateWeights(CoinIndexedVector *input)
Updates weights - part 1 - also checks accuracy.
AbcPrimalColumnSteepest::djsAndDevex
void djsAndDevex(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1)
Update djs, weights for Devex using djs.
AbcPrimalColumnSteepest::Persistence
Persistence
enums for persistence
Definition: AbcPrimalColumnSteepest.hpp:106
AbcPrimalColumnSteepest::mode_
int mode_
0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 and 2 depending on f...
Definition: AbcPrimalColumnSteepest.hpp:199
AbcPrimalColumnSteepest::normal
Definition: AbcPrimalColumnSteepest.hpp:107
AbcPrimalColumnSteepest::AbcPrimalColumnSteepest
AbcPrimalColumnSteepest(int mode=3)
Default Constructor 0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 ...
AbcPrimalColumnSteepest::operator=
AbcPrimalColumnSteepest & operator=(const AbcPrimalColumnSteepest &rhs)
Assignment operator.
AbcPrimalColumnSteepest::~AbcPrimalColumnSteepest
virtual ~AbcPrimalColumnSteepest()
Destructor.
AbcPrimalColumnSteepest::setReference
void setReference(int i, bool trueFalse)
Definition: AbcPrimalColumnSteepest.hpp:145
AbcPrimalColumnSteepest::looksOptimal
virtual bool looksOptimal() const
Returns true if would not find any column.
AbcPrimalColumnSteepest::alternateWeights_
CoinIndexedVector * alternateWeights_
alternate weight array (so we can unroll)
Definition: AbcPrimalColumnSteepest.hpp:176
AbcPrimalColumnPivot
Primal Column Pivot Abstract Base Class.
Definition: AbcPrimalColumnPivot.hpp:26
AbcSimplex
Definition: AbcSimplex.hpp:62
AbcPrimalColumnSteepest::justDjs
void justDjs(CoinIndexedVector *updates, CoinIndexedVector *spareColumn1)
Just update djs.
AbcPrimalColumnSteepest::maximumPivotsChanged
virtual void maximumPivotsChanged()
Called when maximum pivots changes.
AbcPrimalColumnSteepest::keep
Definition: AbcPrimalColumnSteepest.hpp:108
AbcPrimalColumnSteepest::djsAndDevex2
void djsAndDevex2(CoinIndexedVector *updates, CoinIndexedVector *spareColumn1)
Update djs, weights for Devex using pivot row.
AbcPrimalColumnSteepest::infeasible_
CoinIndexedVector * infeasible_
square of infeasibility array (just for infeasible columns)
Definition: AbcPrimalColumnSteepest.hpp:174
AbcPrimalColumnSteepest::partialPricing
int partialPricing(CoinIndexedVector *updates, int numberWanted, int numberLook)
Update djs doing partial pricing (dantzig)
AbcPrimalColumnSteepest::initializeWeights
void initializeWeights()
Initialize weights.
AbcPrimalColumnSteepest::savedWeights_
double * savedWeights_
save weight array (so we can use checkpoint)
Definition: AbcPrimalColumnSteepest.hpp:178
AbcPrimalColumnSteepest::clone
virtual AbcPrimalColumnPivot * clone(bool copyData=true) const
Clone.
AbcPrimalColumnSteepest::saveWeights
virtual void saveWeights(AbcSimplex *model, int mode)
Save weights - this may initialize weights as well mode is - 1) before factorization 2) after factori...
AbcPrimalColumnSteepest::reference_
unsigned int * reference_
Definition: AbcPrimalColumnSteepest.hpp:180
AbcPrimalColumnSteepest::reference
bool reference(int i) const
reference would be faster using AbcSimplex&#39;s status_, but I prefer to keep modularity.
Definition: AbcPrimalColumnSteepest.hpp:141
AbcPrimalColumnSteepest::setPersistence
void setPersistence(Persistence life)
Set/ get persistence.
Definition: AbcPrimalColumnSteepest.hpp:155
AbcPrimalColumnSteepest::savedSequenceOut_
int savedSequenceOut_
Definition: AbcPrimalColumnSteepest.hpp:209
CoinPartitionedVector
Definition: CoinIndexedVector.hpp:1303
AbcPrimalColumnSteepest
Primal Column Pivot Steepest Edge Algorithm Class.
Definition: AbcPrimalColumnSteepest.hpp:21
AbcPrimalColumnSteepest::weights_
double * weights_
weight array
Definition: AbcPrimalColumnSteepest.hpp:172
AbcPrimalColumnSteepest::numberSwitched_
int numberSwitched_
Number of times switched from partial dantzig to 0/2.
Definition: AbcPrimalColumnSteepest.hpp:203
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
AbcPrimalColumnSteepest::savedPivotSequence_
int savedPivotSequence_
Definition: AbcPrimalColumnSteepest.hpp:207
AbcPrimalColumnSteepest::pivotColumn
virtual int pivotColumn(CoinPartitionedVector *updates, CoinPartitionedVector *spareRow2, CoinPartitionedVector *spareColumn1)
Returns pivot column, -1 if none.
AbcPrimalColumnSteepest::justDevex
void justDevex(CoinIndexedVector *updates, CoinIndexedVector *spareColumn1)
Update weights for Devex.
AbcPrimalColumnSteepest::devex_
double devex_
Definition: AbcPrimalColumnSteepest.hpp:170
AbcPrimalColumnSteepest::lastRectified_
int lastRectified_
Definition: AbcPrimalColumnSteepest.hpp:211
AbcPrimalColumnSteepest::persistence_
Persistence persistence_
Life of weights.
Definition: AbcPrimalColumnSteepest.hpp:201
AbcPrimalColumnSteepest::clearArrays
virtual void clearArrays()
Gets rid of all arrays.
AbcPrimalColumnSteepest::sizeFactorization_
int sizeFactorization_
Definition: AbcPrimalColumnSteepest.hpp:213
AbcPrimalColumnSteepest::state_
int state_
Status 0) Normal -1) Needs initialization 1) Weights are stored by sequence number.
Definition: AbcPrimalColumnSteepest.hpp:186
AbcPrimalColumnPivot::type
int type()
Returns type (above 63 is extra information)
Definition: AbcPrimalColumnPivot.hpp:127
AbcPrimalColumnPivot.hpp
AbcPrimalColumnPivot::model
AbcSimplex * model()
Returns model.
Definition: AbcPrimalColumnPivot.hpp:116
AbcPrimalColumnSteepest::unrollWeights
virtual void unrollWeights()
Gets rid of last update.
AbcPrimalColumnSteepest::persistence
Persistence persistence() const
Definition: AbcPrimalColumnSteepest.hpp:159
AbcPrimalColumnSteepest::mode
int mode() const
Mode.
Definition: AbcPrimalColumnSteepest.hpp:98
AbcPrimalColumnSteepest::pivotSequence_
int pivotSequence_
Definition: AbcPrimalColumnSteepest.hpp:205
AbcPrimalColumnSteepest::doSteepestWork
int doSteepestWork(CoinPartitionedVector *updates, CoinPartitionedVector *spareRow2, CoinPartitionedVector *spareColumn1, int type)
Does steepest work type - 0 - just djs 1 - just steepest 2 - both using scaleFactor 3 - both using ex...