Clp 1.16.9
Loading...
Searching...
No Matches
ClpPrimalColumnSteepest.hpp
Go to the documentation of this file.
1/* $Id: ClpPrimalColumnSteepest.hpp 1665 2011-01-04 17:55:54Z lou $ */
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
10#include <bitset>
11
12//#############################################################################
13class CoinIndexedVector;
14
15
24
25public:
26
28
29
37 virtual int pivotColumn(CoinIndexedVector * updates,
38 CoinIndexedVector * spareRow1,
39 CoinIndexedVector * spareRow2,
40 CoinIndexedVector * spareColumn1,
41 CoinIndexedVector * spareColumn2);
43 int pivotColumnOldMethod(CoinIndexedVector * updates,
44 CoinIndexedVector * spareRow1,
45 CoinIndexedVector * spareRow2,
46 CoinIndexedVector * spareColumn1,
47 CoinIndexedVector * spareColumn2);
49 void justDjs(CoinIndexedVector * updates,
50 CoinIndexedVector * spareRow2,
51 CoinIndexedVector * spareColumn1,
52 CoinIndexedVector * spareColumn2);
54 int partialPricing(CoinIndexedVector * updates,
55 CoinIndexedVector * spareRow2,
56 int numberWanted,
57 int numberLook);
59 void djsAndDevex(CoinIndexedVector * updates,
60 CoinIndexedVector * spareRow2,
61 CoinIndexedVector * spareColumn1,
62 CoinIndexedVector * spareColumn2);
64 void djsAndSteepest(CoinIndexedVector * updates,
65 CoinIndexedVector * spareRow2,
66 CoinIndexedVector * spareColumn1,
67 CoinIndexedVector * spareColumn2);
69 void djsAndDevex2(CoinIndexedVector * updates,
70 CoinIndexedVector * spareRow2,
71 CoinIndexedVector * spareColumn1,
72 CoinIndexedVector * spareColumn2);
74 void djsAndSteepest2(CoinIndexedVector * updates,
75 CoinIndexedVector * spareRow2,
76 CoinIndexedVector * spareColumn1,
77 CoinIndexedVector * spareColumn2);
79 void justDevex(CoinIndexedVector * updates,
80 CoinIndexedVector * spareRow2,
81 CoinIndexedVector * spareColumn1,
82 CoinIndexedVector * spareColumn2);
84 void justSteepest(CoinIndexedVector * updates,
85 CoinIndexedVector * spareRow2,
86 CoinIndexedVector * spareColumn1,
87 CoinIndexedVector * spareColumn2);
89 void transposeTimes2(const CoinIndexedVector * pi1, CoinIndexedVector * dj1,
90 const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
91 CoinIndexedVector * spare, double scaleFactor);
92
94 virtual void updateWeights(CoinIndexedVector * input);
95
97 void checkAccuracy(int sequence, double relativeTolerance,
98 CoinIndexedVector * rowArray1,
99 CoinIndexedVector * rowArray2);
100
103
112 virtual void saveWeights(ClpSimplex * model, int mode);
114 virtual void unrollWeights();
116 virtual void clearArrays();
118 virtual bool looksOptimal() const;
120 virtual void maximumPivotsChanged();
122
126 inline int mode() const {
127 return mode_;
128 }
132 virtual int numberSprintColumns(int & numberIterations) const;
134 virtual void switchOffSprint();
135
137
141 normal = 0x00, // create (if necessary) and destroy
142 keep = 0x01 // create (if necessary) and leave
143 };
144
146
147
156
159
162
165
167 virtual ClpPrimalColumnPivot * clone(bool copyData = true) const;
168
170
172
175 inline bool reference(int i) const {
176 return ((reference_[i>>5] >> (i & 31)) & 1) != 0;
177 }
178 inline void setReference(int i, bool trueFalse) {
179 unsigned int & value = reference_[i>>5];
180 int bit = i & 31;
181 if (trueFalse)
182 value |= (1 << bit);
183 else
184 value &= ~(1 << bit);
185 }
187 inline void setPersistence(Persistence life) {
188 persistence_ = life;
189 }
190 inline Persistence persistence() const {
191 return persistence_ ;
192 }
193
195 //---------------------------------------------------------------------------
196
197private:
199 // Update weight
200 double devex_;
202 double * weights_;
204 CoinIndexedVector * infeasible_;
206 CoinIndexedVector * alternateWeights_;
208 double * savedWeights_;
209 // Array for exact devex to say what is in reference framework
210 unsigned int * reference_;
216 int state_;
229 int mode_;
231 Persistence persistence_;
233 int numberSwitched_;
234 // This is pivot row (or pivot sequence round re-factorization)
235 int pivotSequence_;
236 // This is saved pivot sequence
237 int savedPivotSequence_;
238 // This is saved outgoing variable
239 int savedSequenceOut_;
240 // Iteration when last rectified
241 int lastRectified_;
242 // Size of factorization at invert (used to decide algorithm)
243 int sizeFactorization_;
245};
246
247#endif
Primal Column Pivot Abstract Base Class.
ClpSimplex * model()
Returns model.
Primal Column Pivot Steepest Edge Algorithm Class.
int pivotColumnOldMethod(CoinIndexedVector *updates, CoinIndexedVector *spareRow1, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
For quadratic or funny nonlinearities.
virtual void updateWeights(CoinIndexedVector *input)
Updates weights - part 1 - also checks accuracy.
virtual ClpPrimalColumnPivot * clone(bool copyData=true) const
Clone.
bool reference(int i) const
reference would be faster using ClpSimplex's status_, but I prefer to keep modularity.
ClpPrimalColumnSteepest & operator=(const ClpPrimalColumnSteepest &rhs)
Assignment operator.
void justDevex(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update weights for Devex.
virtual bool looksOptimal() const
Returns true if would not find any column.
virtual ~ClpPrimalColumnSteepest()
Destructor.
virtual void clearArrays()
Gets rid of all arrays.
void djsAndSteepest(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Steepest using djs.
void justDjs(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Just update djs.
virtual int numberSprintColumns(int &numberIterations) const
Returns number of extra columns for sprint algorithm - 0 means off.
void justSteepest(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update weights for Steepest.
virtual void switchOffSprint()
Switch off sprint idea.
virtual void saveWeights(ClpSimplex *model, int mode)
Save weights - this may initialize weights as well mode is - 1) before factorization 2) after factori...
void djsAndDevex2(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Devex using pivot row.
void setPersistence(Persistence life)
Set/ get persistence.
virtual void maximumPivotsChanged()
Called when maximum pivots changes.
ClpPrimalColumnSteepest(int mode=3)
Default Constructor 0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 ...
void djsAndSteepest2(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Steepest using pivot row.
void setReference(int i, bool trueFalse)
void initializeWeights()
Initialize weights.
int partialPricing(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, int numberWanted, int numberLook)
Update djs doing partial pricing (dantzig)
void checkAccuracy(int sequence, double relativeTolerance, CoinIndexedVector *rowArray1, CoinIndexedVector *rowArray2)
Checks accuracy - just for debug.
virtual void unrollWeights()
Gets rid of last update.
ClpPrimalColumnSteepest(const ClpPrimalColumnSteepest &rhs)
Copy constructor.
virtual int pivotColumn(CoinIndexedVector *updates, CoinIndexedVector *spareRow1, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Returns pivot column, -1 if none.
void transposeTimes2(const CoinIndexedVector *pi1, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *dj2, CoinIndexedVector *spare, double scaleFactor)
Updates two arrays for steepest.
void djsAndDevex(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Devex using djs.
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70