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

- File List
- File Members

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
9 #include "ClpPrimalColumnPivot.hpp"
10 #include <bitset>
11
12 //#############################################################################
13 class CoinIndexedVector;
14
15
23 class ClpPrimalColumnSteepest : public ClpPrimalColumnPivot {
24
25 public:
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
102 void initializeWeights();
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
125 inline int mode() const {
127 return mode_;
128 }
132 virtual int numberSprintColumns(int & numberIterations) const;
134 virtual void switchOffSprint();
135
137
140 enum Persistence {
141 normal = 0x00, // create (if necessary) and destroy
142 keep = 0x01 // create (if necessary) and leave
143 };
144
146
147
155 ClpPrimalColumnSteepest(int mode = 3);
156
158 ClpPrimalColumnSteepest(const ClpPrimalColumnSteepest & rhs);
159
161 ClpPrimalColumnSteepest & operator=(const ClpPrimalColumnSteepest& rhs);
162
164 virtual ~ClpPrimalColumnSteepest ();
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
197 private:
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
ClpPrimalColumnSteepest::persistence_
Persistence persistence_
Life of weights.
Definition: ClpPrimalColumnSteepest.hpp:231
ClpPrimalColumnSteepest::pivotSequence_
int pivotSequence_
weight array
Definition: ClpPrimalColumnSteepest.hpp:235
ClpPrimalColumnSteepest::partialPricing
int partialPricing(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, int numberWanted, int numberLook)
Update djs doing partial pricing (dantzig)
ClpPrimalColumnSteepest::devex_
double devex_
weight array
Definition: ClpPrimalColumnSteepest.hpp:200
ClpPrimalColumnSteepest::infeasible_
CoinIndexedVector * infeasible_
square of infeasibility array (just for infeasible columns)
Definition: ClpPrimalColumnSteepest.hpp:204
ClpPrimalColumnSteepest::numberSprintColumns
virtual int numberSprintColumns(int &numberIterations) const
Returns number of extra columns for sprint algorithm - 0 means off.
ClpPrimalColumnSteepest::unrollWeights
virtual void unrollWeights()
Gets rid of last update.
ClpPrimalColumnSteepest::djsAndSteepest2
void djsAndSteepest2(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Steepest using pivot row.
ClpPrimalColumnSteepest::clone
virtual ClpPrimalColumnPivot * clone(bool copyData=true) const
Clone.
ClpPrimalColumnSteepest::operator=
ClpPrimalColumnSteepest & operator=(const ClpPrimalColumnSteepest &rhs)
Assignment operator.
ClpPrimalColumnSteepest::savedPivotSequence_
int savedPivotSequence_
weight array
Definition: ClpPrimalColumnSteepest.hpp:237
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() const
Mode.
Definition: ClpPrimalColumnSteepest.hpp:126
ClpPrimalColumnSteepest::djsAndDevex
void djsAndDevex(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Devex using djs.
ClpPrimalColumnSteepest::maximumPivotsChanged
virtual void maximumPivotsChanged()
Called when maximum pivots changes.
ClpPrimalColumnSteepest::justDjs
void justDjs(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Just update djs.
ClpPrimalColumnSteepest::persistence
Persistence persistence() const
reference would be faster using ClpSimplex&#39;s status_, but I prefer to keep modularity.
Definition: ClpPrimalColumnSteepest.hpp:190
ClpPrimalColumnSteepest::initializeWeights
void initializeWeights()
Initialize weights.
ClpPrimalColumnPivot
Primal Column Pivot Abstract Base Class.
Definition: ClpPrimalColumnPivot.hpp:25
ClpPrimalColumnSteepest::updateWeights
virtual void updateWeights(CoinIndexedVector *input)
Updates weights - part 1 - also checks accuracy.
ClpPrimalColumnSteepest::lastRectified_
int lastRectified_
weight array
Definition: ClpPrimalColumnSteepest.hpp:241
ClpPrimalColumnSteepest::pivotColumnOldMethod
int pivotColumnOldMethod(CoinIndexedVector *updates, CoinIndexedVector *spareRow1, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
For quadratic or funny nonlinearities.
ClpPrimalColumnSteepest::numberSwitched_
int numberSwitched_
Number of times switched from partial dantzig to 0/2.
Definition: ClpPrimalColumnSteepest.hpp:233
ClpPrimalColumnPivot.hpp
ClpPrimalColumnSteepest::djsAndSteepest
void djsAndSteepest(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Steepest using djs.
ClpPrimalColumnSteepest::justDevex
void justDevex(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update weights for Devex.
ClpPrimalColumnSteepest::checkAccuracy
void checkAccuracy(int sequence, double relativeTolerance, CoinIndexedVector *rowArray1, CoinIndexedVector *rowArray2)
Checks accuracy - just for debug.
ClpPrimalColumnSteepest::~ClpPrimalColumnSteepest
virtual ~ClpPrimalColumnSteepest()
Destructor.
ClpPrimalColumnSteepest::reference_
unsigned int * reference_
weight array
Definition: ClpPrimalColumnSteepest.hpp:210
ClpPrimalColumnSteepest::djsAndDevex2
void djsAndDevex2(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Devex using pivot row.
ClpPrimalColumnSteepest::Persistence
Persistence
enums for persistence
Definition: ClpPrimalColumnSteepest.hpp:140
ClpPrimalColumnSteepest::transposeTimes2
void transposeTimes2(const CoinIndexedVector *pi1, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *dj2, CoinIndexedVector *spare, double scaleFactor)
Updates two arrays for steepest.
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
ClpPrimalColumnSteepest::keep
Definition: ClpPrimalColumnSteepest.hpp:142
ClpPrimalColumnSteepest::clearArrays
virtual void clearArrays()
Gets rid of all arrays.
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
ClpPrimalColumnSteepest::alternateWeights_
CoinIndexedVector * alternateWeights_
alternate weight array (so we can unroll)
Definition: ClpPrimalColumnSteepest.hpp:206
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:175
ClpPrimalColumnSteepest::switchOffSprint
virtual void switchOffSprint()
Switch off sprint idea.
ClpPrimalColumnSteepest::pivotColumn
virtual int pivotColumn(CoinIndexedVector *updates, CoinIndexedVector *spareRow1, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Returns pivot column, -1 if none.
ClpPrimalColumnPivot::model
ClpSimplex * model()
Returns model.
Definition: ClpPrimalColumnPivot.hpp:115
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:229
ClpPrimalColumnSteepest::weights_
double * weights_
weight array
Definition: ClpPrimalColumnSteepest.hpp:202
ClpPrimalColumnSteepest::justSteepest
void justSteepest(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update weights for Steepest.
ClpPrimalColumnSteepest::setReference
void setReference(int i, bool trueFalse)
reference would be faster using ClpSimplex&#39;s status_, but I prefer to keep modularity.
Definition: ClpPrimalColumnSteepest.hpp:178
ClpPrimalColumnSteepest::savedWeights_
double * savedWeights_
save weight array (so we can use checkpoint)
Definition: ClpPrimalColumnSteepest.hpp:208
ClpPrimalColumnSteepest::sizeFactorization_
int sizeFactorization_
weight array
Definition: ClpPrimalColumnSteepest.hpp:243
ClpPrimalColumnSteepest::setPersistence
void setPersistence(Persistence life)
Set/ get persistence.
Definition: ClpPrimalColumnSteepest.hpp:187
ClpPrimalColumnSteepest::looksOptimal
virtual bool looksOptimal() const
Returns true if would not find any column.
ClpPrimalColumnSteepest::state_
int state_
Status 0) Normal -1) Needs initialization 1) Weights are stored by sequence number.
Definition: ClpPrimalColumnSteepest.hpp:216
ClpPrimalColumnSteepest
Primal Column Pivot Steepest Edge Algorithm Class.
Definition: ClpPrimalColumnSteepest.hpp:23
ClpPrimalColumnSteepest::normal
Definition: ClpPrimalColumnSteepest.hpp:141
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::savedSequenceOut_
int savedSequenceOut_
weight array
Definition: ClpPrimalColumnSteepest.hpp:239