Clp 1.17.6

- 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
ClpPrimalColumnSteepest.hpp
Go to the documentation of this file.
1 /* $Id: ClpPrimalColumnSteepest.hpp 2385 2019-01-06 19:43:06Z unxusr $ */
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 ClpPrimalColumnSteepest_H
7 #define ClpPrimalColumnSteepest_H
8
9 #include "ClpPrimalColumnPivot.hpp"
10 #include <bitset>
11
12 //#############################################################################
13 class CoinIndexedVector;
14
21 class ClpPrimalColumnSteepest : public ClpPrimalColumnPivot {
22
23 public:
25
26
34 virtual int pivotColumn(CoinIndexedVector *updates,
35 CoinIndexedVector *spareRow1,
36 CoinIndexedVector *spareRow2,
37 CoinIndexedVector *spareColumn1,
38 CoinIndexedVector *spareColumn2);
40 int pivotColumnOldMethod(CoinIndexedVector *updates,
41 CoinIndexedVector *spareRow1,
42 CoinIndexedVector *spareRow2,
43 CoinIndexedVector *spareColumn1,
44 CoinIndexedVector *spareColumn2);
46 void justDjs(CoinIndexedVector *updates,
47 CoinIndexedVector *spareRow2,
48 CoinIndexedVector *spareColumn1,
49 CoinIndexedVector *spareColumn2);
51 int partialPricing(CoinIndexedVector *updates,
52 CoinIndexedVector *spareRow2,
53 int numberWanted,
54 int numberLook);
56 void djsAndDevex(CoinIndexedVector *updates,
57 CoinIndexedVector *spareRow2,
58 CoinIndexedVector *spareColumn1,
59 CoinIndexedVector *spareColumn2);
62 void djsAndSteepest(CoinIndexedVector *updates,
63 CoinIndexedVector *spareRow2,
64 CoinIndexedVector *spareColumn1,
65 CoinIndexedVector *spareColumn2);
67 void djsAndDevex2(CoinIndexedVector *updates,
68 CoinIndexedVector *spareRow2,
69 CoinIndexedVector *spareColumn1,
70 CoinIndexedVector *spareColumn2);
72 void djsAndSteepest2(CoinIndexedVector *updates,
73 CoinIndexedVector *spareRow2,
74 CoinIndexedVector *spareColumn1,
75 CoinIndexedVector *spareColumn2);
77 void justDevex(CoinIndexedVector *updates,
78 CoinIndexedVector *spareRow2,
79 CoinIndexedVector *spareColumn1,
80 CoinIndexedVector *spareColumn2);
82 void justSteepest(CoinIndexedVector *updates,
83 CoinIndexedVector *spareRow2,
84 CoinIndexedVector *spareColumn1,
85 CoinIndexedVector *spareColumn2);
87 int transposeTimes2(const CoinIndexedVector *pi1, CoinIndexedVector *dj1,
88 const CoinIndexedVector *pi2, CoinIndexedVector *dj2,
89 CoinIndexedVector *spare, double scaleFactor);
90
92 virtual void updateWeights(CoinIndexedVector *input);
93
95 void checkAccuracy(int sequence, double relativeTolerance,
96 CoinIndexedVector *rowArray1,
97 CoinIndexedVector *rowArray2);
98
100 void initializeWeights();
101
110 virtual void saveWeights(ClpSimplex *model, int mode);
112 void redoInfeasibilities();
114 virtual void unrollWeights();
116 virtual void clearArrays();
118 virtual bool looksOptimal() const;
120 virtual void maximumPivotsChanged();
122
125 inline int mode() const
127 {
128 return mode_;
129 }
131 inline void setMode(int mode)
132 {
133 mode_ = mode;
134 }
136 inline CoinIndexedVector *infeasible() const
137 {
138 return infeasible_;
139 }
141 inline const double *weights() const
142 {
143 return weights_;
144 }
146 inline CoinIndexedVector *alternateWeights() const
147 {
148 return alternateWeights_;
149 }
153 virtual int numberSprintColumns(int &numberIterations) const;
155 virtual void switchOffSprint();
156
158
161 enum Persistence {
162 normal = 0x00, // create (if necessary) and destroy
163 keep = 0x01 // create (if necessary) and leave
164 };
165
167
168
176 ClpPrimalColumnSteepest(int mode = 3);
177
179 ClpPrimalColumnSteepest(const ClpPrimalColumnSteepest &rhs);
180
182 ClpPrimalColumnSteepest &operator=(const ClpPrimalColumnSteepest &rhs);
183
185 virtual ~ClpPrimalColumnSteepest();
186
188 virtual ClpPrimalColumnPivot *clone(bool copyData = true) const;
189
191
193
196 inline bool reference(int i) const
197 {
198 return ((reference_[i >> 5] >> (i & 31)) & 1) != 0;
199 }
200 inline void setReference(int i, bool trueFalse)
201 {
202 unsigned int &value = reference_[i >> 5];
203 int bit = i & 31;
204 if (trueFalse)
205 value |= (1 << bit);
206 else
207 value &= ~(1 << bit);
208 }
210 inline void setPersistence(Persistence life)
211 {
212 persistence_ = life;
213 }
214 inline Persistence persistence() const
215 {
216 return persistence_;
217 }
218
220 //---------------------------------------------------------------------------
221
222 protected:
224 // Update weight
225 double devex_;
227 double *weights_;
229 CoinIndexedVector *infeasible_;
231 CoinIndexedVector *alternateWeights_;
233 double *savedWeights_;
234 // Array for exact devex to say what is in reference framework
235 unsigned int *reference_;
241 int state_;
254 int mode_;
255 /* Infeasibility state i.e. array of infeasibilities and sequenceIn-
256 0 - correct
257 1 - needs correcting
258 2 - not known but column sequence has been chosen
259 */
260 int infeasibilitiesState_;
262 Persistence persistence_;
264 int numberSwitched_;
265 // This is pivot row (or pivot sequence round re-factorization)
266 int pivotSequence_;
267 // This is saved pivot sequence
268 int savedPivotSequence_;
269 // This is saved outgoing variable
270 int savedSequenceOut_;
271 // Iteration when last rectified
272 int lastRectified_;
273 // Size of factorization at invert (used to decide algorithm)
274 int sizeFactorization_;
276 };
277
278 #endif
279
280 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
281 */
ClpPrimalColumnSteepest::sizeFactorization_
int sizeFactorization_
Definition: ClpPrimalColumnSteepest.hpp:274
ClpPrimalColumnSteepest::looksOptimal
virtual bool looksOptimal() const
Returns true if would not find any column.
ClpPrimalColumnSteepest::djsAndDevex
void djsAndDevex(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Devex using djs.
ClpPrimalColumnSteepest::transposeTimes2
int transposeTimes2(const CoinIndexedVector *pi1, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *dj2, CoinIndexedVector *spare, double scaleFactor)
Updates two arrays for steepest.
ClpPrimalColumnSteepest::saveWeights
virtual void saveWeights(ClpSimplex *model, int mode)
Save weights - this may initialize weights as well mode is - 1) before factorization 2) after factori...
ClpPrimalColumnSteepest::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: ClpPrimalColumnSteepest.hpp:254
ClpPrimalColumnPivot
Primal Column Pivot Abstract Base Class.
Definition: ClpPrimalColumnPivot.hpp:25
ClpPrimalColumnSteepest::partialPricing
int partialPricing(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, int numberWanted, int numberLook)
Update djs doing partial pricing (dantzig)
ClpPrimalColumnSteepest::justSteepest
void justSteepest(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update weights for Steepest.
ClpPrimalColumnSteepest::savedWeights_
double * savedWeights_
save weight array (so we can use checkpoint)
Definition: ClpPrimalColumnSteepest.hpp:233
ClpPrimalColumnSteepest::weights_
double * weights_
weight array
Definition: ClpPrimalColumnSteepest.hpp:227
ClpPrimalColumnSteepest::reference_
unsigned int * reference_
Definition: ClpPrimalColumnSteepest.hpp:235
ClpPrimalColumnSteepest::savedPivotSequence_
int savedPivotSequence_
Definition: ClpPrimalColumnSteepest.hpp:268
ClpPrimalColumnSteepest::djsAndDevex2
void djsAndDevex2(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Devex using pivot row.
ClpPrimalColumnSteepest
Primal Column Pivot Steepest Edge Algorithm Class.
Definition: ClpPrimalColumnSteepest.hpp:21
ClpPrimalColumnSteepest::initializeWeights
void initializeWeights()
Initialize weights.
ClpPrimalColumnSteepest::infeasible_
CoinIndexedVector * infeasible_
square of infeasibility array (just for infeasible columns)
Definition: ClpPrimalColumnSteepest.hpp:229
ClpPrimalColumnSteepest::setPersistence
void setPersistence(Persistence life)
Set/ get persistence.
Definition: ClpPrimalColumnSteepest.hpp:210
ClpPrimalColumnSteepest::redoInfeasibilities
void redoInfeasibilities()
redo infeasibilities
ClpPrimalColumnSteepest::clone
virtual ClpPrimalColumnPivot * clone(bool copyData=true) const
Clone.
ClpPrimalColumnSteepest::pivotSequence_
int pivotSequence_
Definition: ClpPrimalColumnSteepest.hpp:266
ClpPrimalColumnSteepest::checkAccuracy
void checkAccuracy(int sequence, double relativeTolerance, CoinIndexedVector *rowArray1, CoinIndexedVector *rowArray2)
Checks accuracy - just for debug.
ClpPrimalColumnSteepest::reference
bool reference(int i) const
reference would be faster using ClpSimplex&#39;s status_, but I prefer to keep modularity.
Definition: ClpPrimalColumnSteepest.hpp:196
ClpPrimalColumnSteepest::justDjs
void justDjs(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Just update djs.
ClpPrimalColumnSteepest::pivotColumnOldMethod
int pivotColumnOldMethod(CoinIndexedVector *updates, CoinIndexedVector *spareRow1, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
For quadratic or funny nonlinearities.
ClpPrimalColumnSteepest::numberSprintColumns
virtual int numberSprintColumns(int &numberIterations) const
Returns number of extra columns for sprint algorithm - 0 means off.
ClpPrimalColumnSteepest::switchOffSprint
virtual void switchOffSprint()
Switch off sprint idea.
ClpPrimalColumnSteepest::lastRectified_
int lastRectified_
Definition: ClpPrimalColumnSteepest.hpp:272
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
ClpPrimalColumnSteepest::devex_
double devex_
Definition: ClpPrimalColumnSteepest.hpp:225
ClpPrimalColumnSteepest::djsAndSteepest2
void djsAndSteepest2(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Steepest using pivot row.
ClpPrimalColumnSteepest::operator=
ClpPrimalColumnSteepest & operator=(const ClpPrimalColumnSteepest &rhs)
Assignment operator.
ClpPrimalColumnSteepest::persistence
Persistence persistence() const
Definition: ClpPrimalColumnSteepest.hpp:214
ClpPrimalColumnSteepest::normal
Definition: ClpPrimalColumnSteepest.hpp:162
ClpPrimalColumnSteepest::alternateWeights
CoinIndexedVector * alternateWeights() const
alternate weight array
Definition: ClpPrimalColumnSteepest.hpp:146
ClpPrimalColumnSteepest::savedSequenceOut_
int savedSequenceOut_
Definition: ClpPrimalColumnSteepest.hpp:270
ClpPrimalColumnSteepest::justDevex
void justDevex(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update weights for Devex.
ClpPrimalColumnSteepest::clearArrays
virtual void clearArrays()
Gets rid of all arrays.
ClpPrimalColumnPivot::model
ClpSimplex * model()
Returns model.
Definition: ClpPrimalColumnPivot.hpp:117
ClpPrimalColumnSteepest::unrollWeights
virtual void unrollWeights()
Gets rid of last update.
ClpPrimalColumnSteepest::updateWeights
virtual void updateWeights(CoinIndexedVector *input)
Updates weights - part 1 - also checks accuracy.
ClpPrimalColumnSteepest::mode
int mode() const
Mode.
Definition: ClpPrimalColumnSteepest.hpp:126
ClpPrimalColumnSteepest::persistence_
Persistence persistence_
Life of weights.
Definition: ClpPrimalColumnSteepest.hpp:262
ClpPrimalColumnSteepest::setReference
void setReference(int i, bool trueFalse)
Definition: ClpPrimalColumnSteepest.hpp:200
ClpPrimalColumnSteepest::weights
const double * weights() const
Weights.
Definition: ClpPrimalColumnSteepest.hpp:141
ClpPrimalColumnSteepest::alternateWeights_
CoinIndexedVector * alternateWeights_
alternate weight array (so we can unroll)
Definition: ClpPrimalColumnSteepest.hpp:231
ClpPrimalColumnPivot.hpp
ClpPrimalColumnSteepest::infeasible
CoinIndexedVector * infeasible() const
square of infeasibility array (just for infeasible columns)
Definition: ClpPrimalColumnSteepest.hpp:136
ClpPrimalColumnSteepest::Persistence
Persistence
enums for persistence
Definition: ClpPrimalColumnSteepest.hpp:161
ClpPrimalColumnSteepest::infeasibilitiesState_
int infeasibilitiesState_
Definition: ClpPrimalColumnSteepest.hpp:260
ClpPrimalColumnSteepest::maximumPivotsChanged
virtual void maximumPivotsChanged()
Called when maximum pivots changes.
ClpPrimalColumnSteepest::keep
Definition: ClpPrimalColumnSteepest.hpp:163
ClpPrimalColumnSteepest::state_
int state_
Status 0) Normal -1) Needs initialization 1) Weights are stored by sequence number.
Definition: ClpPrimalColumnSteepest.hpp:241
ClpPrimalColumnSteepest::djsAndSteepest
void djsAndSteepest(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Steepest using djs sets best sequence (possibly)
ClpPrimalColumnSteepest::ClpPrimalColumnSteepest
ClpPrimalColumnSteepest(int mode=3)
Default Constructor 0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 ...
ClpPrimalColumnSteepest::setMode
void setMode(int mode)
Set mode.
Definition: ClpPrimalColumnSteepest.hpp:131
ClpPrimalColumnSteepest::~ClpPrimalColumnSteepest
virtual ~ClpPrimalColumnSteepest()
Destructor.
ClpPrimalColumnSteepest::numberSwitched_
int numberSwitched_
Number of times switched from partial dantzig to 0/2.
Definition: ClpPrimalColumnSteepest.hpp:264
ClpPrimalColumnSteepest::pivotColumn
virtual int pivotColumn(CoinIndexedVector *updates, CoinIndexedVector *spareRow1, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Returns pivot column, -1 if none.