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
ClpPESimplex.hpp
Go to the documentation of this file.
1 // Copyright (C) 2002, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 /*
4 Authors
5
6 Jeremy Omer
7
8 Last update: june 10, 2014
9
10 */
11
12 #ifndef ClpPESimplex_H
13 #define ClpPESimplex_H
14
15 #include "ClpSimplex.hpp"
16 #include "CoinIndexedVector.hpp"
17 #include "ClpPackedMatrix.hpp"
18 #include "CoinTime.hpp"
19
20 #include <iostream>
21 #include <fstream>
22
23 // #define PE_DEBUG 0
24
28 double PEdot(CoinIndexedVector &v1, const double *v2);
29
32 double PEdot(CoinIndexedVector &v1, CoinIndexedVector &v2);
33
35 void PEtransposeTimesSubsetAll(ClpSimplex *model, int number, const int *which,
36 const double *COIN_RESTRICT x, double *COIN_RESTRICT y,
37 const double *COIN_RESTRICT rowScale,
38 const double *COIN_RESTRICT columnScale);
39
42 class ClpPESimplex {
43
44 public:
46 ClpPESimplex(ClpSimplex *model);
47
49 ~ClpPESimplex();
50
52 public:
53 inline int coPrimalDegenerates() { return coPrimalDegenerates_; }
54 inline int coDualDegenerates() { return coDualDegenerates_; }
55 inline int coCompatibleCols() { return coCompatibleCols_; }
56 inline int coCompatibleRows() { return coCompatibleRows_; }
57
58 inline bool isCompatibleCol(int sequence) { return isCompatibleCol_[sequence]; }
59 inline bool isCompatibleRow(int row)
60 {
61 assert(row >= 0 && row < numberRows_);
62 return isCompatibleRow_[row];
63 }
64
65 inline ClpSimplex *clpModel() { return model_; }
66 // check seems to be same model - returns false if size changed
67 bool checkSize();
69 public:
71 void updatePrimalDegenerates();
72
74 void updateDualDegenerates();
75
78 void identifyCompatibleCols(int number, const int *which,
79 CoinIndexedVector *spareRow2,
80 CoinIndexedVector *wPrimal);
81
83 void identifyCompatibleRows(CoinIndexedVector *spare,
84 CoinIndexedVector *wDual);
85
87 void updateCompatibleRows(int sequence);
88
90 public:
91 #if PE_DEBUG >= 1
92
93 void printPrimalDegenerates();
94
96 void printCompatibleCols();
97
99 bool checkCompatibilityCol(int sequence, CoinIndexedVector *spareRow2);
100 #endif
101
103 bool checkCompatibilityRow(int pivotRow);
104
106 inline double lastObjectiveValue() { return lastObjectiveValue_; }
107 inline void updateLastObjectiveValue() { lastObjectiveValue_ = model_->objectiveValue(); }
108 inline bool isDegeneratePivot() { return fabs(model_->objectiveValue() - lastObjectiveValue_) < model_->dualTolerance(); }
109 inline bool isLastPivotCompatible() { return isLastPivotCompatible_; }
110 inline void isLastPivotCompatible(bool yesOrNo) { isLastPivotCompatible_ = yesOrNo; }
111
113 inline void startTimer() { timeTmp_ = CoinCpuTime(); }
114 inline void stopTimer() { timeCompatibility_ += CoinCpuTime() - timeTmp_; }
115 void printTimer(std::ostream &out);
116 inline double timeMultRandom() { return timeMultRandom_; }
117 inline double timeLinearSystem() { return timeLinearSystem_; }
118 inline double timeCompatibility() { return timeCompatibility_; }
119
121 inline void addDegeneratePivot() { coDegeneratePivots_++; }
122 inline int coDegeneratePivots() { return coDegeneratePivots_; }
123 inline void addDegeneratePivotConsecutive() { coDegeneratePivotsConsecutive_++; }
124 inline void resetDegeneratePivotsConsecutive() { coDegeneratePivotsConsecutive_ = 0; }
125 inline int coDegeneratePivotsConsecutive() { return coDegeneratePivotsConsecutive_; }
126 void updateDualDegeneratesAvg(int coPivots);
127 inline double coDualDegeneratesAvg() { return coDualDegeneratesAvg_; }
128 void updatePrimalDegeneratesAvg(int coPivots);
129 inline double coPrimalDegeneratesAvg() { return coPrimalDegeneratesAvg_; }
130 inline double coCompatibleRowsAvg() { return coCompatibleRowsAvg_; }
131 void updateCompatibleRowsAvg(int coPivots);
132 inline double coCompatibleColsAvg() { return coCompatibleColsAvg_; }
133 void updateCompatibleColsAvg(int coPivots);
134 inline int coCompatiblePivots() { return coCompatiblePivots_; }
135 inline void addCompatiblePivot() { coCompatiblePivots_++; }
136 inline int coDegenerateCompatiblePivots() { return coDegenerateCompatiblePivots_; }
137 inline void addDegenerateCompatiblePivot() { coDegenerateCompatiblePivots_++; }
138
139 /* Get and update the number of compatible pivots that were done because of the priority factor */
140 inline void addPriorityPivot() { coPriorityPivots_++; }
141 inline int coPriorityPivots() { return coPriorityPivots_; }
142 inline int doStatistics() const
143 {
144 return doStatistics_;
145 }
146 inline void setDoStatistics(int value)
147 {
148 doStatistics_ = value;
149 }
150
151 protected:
154 int coPrimalDegenerates_;
155 int *primalDegenerates_;
156 bool *isPrimalDegenerate_;
157
160 int coDualDegenerates_;
161 int *dualDegenerates_;
162 bool *isDualDegenerate_;
163
166 int coCompatibleCols_;
167 double *compatibilityCol_;
168 bool *isCompatibleCol_;
169
172 int coCompatibleRows_;
173 double *compatibilityRow_;
174 bool *isCompatibleRow_;
175
176 private:
178 ClpSimplex *model_;
179
181 double epsDegeneracy_;
182 double epsCompatibility_;
183
185 int numberRows_;
186 int numberColumns_;
187
191 // now passed in CoinIndexedVector *wPrimal_;
192 // now passed in CoinIndexedVector *wDual_;
193
196 // not usedCoinIndexedVector *tempColumn_;
197 double *tempRandom_;
198
200 int coPrimalDegeneratesAvg_;
201 int coDualDegeneratesAvg_;
202 int coCompatibleColsAvg_;
203 int coCompatibleRowsAvg_;
204 int coUpdateDegenerates_;
205 int coIdentifyCompatibles_;
206 int coDegeneratePivots_;
207 int coCompatiblePivots_;
208 int coDegenerateCompatiblePivots_;
209 int coDegeneratePivotsConsecutive_;
210
212 int coPriorityPivots_;
214 int doStatistics_;
215
217 double lastObjectiveValue_;
218 bool isLastPivotCompatible_;
219
222 double timeCompatibility_;
223 double timeMultRandom_;
224 double timeLinearSystem_;
225 double timeTmp_;
226 };
227
228 #endif
229
230 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
231 */
ClpPESimplex::coPrimalDegenerates
int coPrimalDegenerates()
BASIC GET METHODS.
Definition: ClpPESimplex.hpp:53
ClpPESimplex::coCompatibleRowsAvg_
int coCompatibleRowsAvg_
Definition: ClpPESimplex.hpp:203
ClpPESimplex::coDualDegeneratesAvg
double coDualDegeneratesAvg()
Definition: ClpPESimplex.hpp:127
ClpPESimplex::coPriorityPivots_
int coPriorityPivots_
number of compatible pivots that were done because of the priority factor
Definition: ClpPESimplex.hpp:212
ClpSimplex.hpp
ClpPESimplex::isCompatibleCol_
bool * isCompatibleCol_
Definition: ClpPESimplex.hpp:168
ClpPESimplex::coCompatiblePivots_
int coCompatiblePivots_
Definition: ClpPESimplex.hpp:207
ClpPESimplex::isCompatibleCol
bool isCompatibleCol(int sequence)
Definition: ClpPESimplex.hpp:58
ClpModel::dualTolerance
double dualTolerance() const
Dual tolerance to use.
Definition: ClpModel.hpp:339
ClpPESimplex::timeCompatibility
double timeCompatibility()
Definition: ClpPESimplex.hpp:118
ClpPESimplex::timeMultRandom
double timeMultRandom()
Definition: ClpPESimplex.hpp:116
CoinTime.hpp
ClpPESimplex::compatibilityRow_
double * compatibilityRow_
Definition: ClpPESimplex.hpp:173
ClpPESimplex::coCompatibleRowsAvg
double coCompatibleRowsAvg()
Definition: ClpPESimplex.hpp:130
ClpPESimplex::coCompatibleColsAvg
double coCompatibleColsAvg()
Definition: ClpPESimplex.hpp:132
ClpModel::objectiveValue
double objectiveValue() const
Objective value.
Definition: ClpModel.hpp:837
ClpPESimplex::dualDegenerates_
int * dualDegenerates_
Definition: ClpPESimplex.hpp:161
ClpPESimplex::addPriorityPivot
void addPriorityPivot()
Definition: ClpPESimplex.hpp:140
ClpPESimplex::timeLinearSystem_
double timeLinearSystem_
Definition: ClpPESimplex.hpp:224
ClpPESimplex::isLastPivotCompatible
bool isLastPivotCompatible()
Definition: ClpPESimplex.hpp:109
ClpPESimplex::coDualDegeneratesAvg_
int coDualDegeneratesAvg_
Definition: ClpPESimplex.hpp:201
ClpPESimplex::primalDegenerates_
int * primalDegenerates_
Definition: ClpPESimplex.hpp:155
ClpPESimplex::coIdentifyCompatibles_
int coIdentifyCompatibles_
Definition: ClpPESimplex.hpp:205
ClpPESimplex::coCompatiblePivots
int coCompatiblePivots()
Definition: ClpPESimplex.hpp:134
ClpPESimplex::updateDualDegeneratesAvg
void updateDualDegeneratesAvg(int coPivots)
CoinCpuTime
static double CoinCpuTime()
Definition: CoinTime.hpp:106
ClpPESimplex::identifyCompatibleRows
void identifyCompatibleRows(CoinIndexedVector *spare, CoinIndexedVector *wDual)
Identify the dual compatible rows.
ClpPESimplex::isLastPivotCompatible
void isLastPivotCompatible(bool yesOrNo)
Definition: ClpPESimplex.hpp:110
ClpPESimplex::doStatistics_
int doStatistics_
Do statistics.
Definition: ClpPESimplex.hpp:214
COIN_RESTRICT
#define COIN_RESTRICT
Definition: ClpMatrixBase.hpp:21
ClpPESimplex::isCompatibleRow
bool isCompatibleRow(int row)
Definition: ClpPESimplex.hpp:59
ClpPESimplex::~ClpPESimplex
~ClpPESimplex()
Destructor.
ClpPESimplex::coDegeneratePivotsConsecutive_
int coDegeneratePivotsConsecutive_
Definition: ClpPESimplex.hpp:209
ClpPESimplex::coDegenerateCompatiblePivots
int coDegenerateCompatiblePivots()
Definition: ClpPESimplex.hpp:136
ClpPESimplex::checkCompatibilityRow
bool checkCompatibilityRow(int pivotRow)
DEBUG AND DISPLAY METHODS.
ClpPESimplex::timeCompatibility_
double timeCompatibility_
Timer attribute recording the additional time spent in identifying compatible variables.
Definition: ClpPESimplex.hpp:222
ClpPESimplex::updateDualDegenerates
void updateDualDegenerates()
Updates the set of dual degenerate variables.
PEdot
double PEdot(CoinIndexedVector &v1, const double *v2)
SHARED METHODS FOR USEFUL ALGEBRAIC OPERATIONS.
ClpPESimplex::updateCompatibleRowsAvg
void updateCompatibleRowsAvg(int coPivots)
ClpPESimplex::timeLinearSystem
double timeLinearSystem()
Definition: ClpPESimplex.hpp:117
ClpPESimplex::addDegeneratePivot
void addDegeneratePivot()
Update and return the number of degenerate pivots and variables.
Definition: ClpPESimplex.hpp:121
ClpPESimplex::ClpPESimplex
ClpPESimplex(ClpSimplex *model)
Constructor.
ClpPESimplex::numberRows_
int numberRows_
size of the original model
Definition: ClpPESimplex.hpp:185
ClpPESimplex::isDegeneratePivot
bool isDegeneratePivot()
Definition: ClpPESimplex.hpp:108
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106
ClpPESimplex::isLastPivotCompatible_
bool isLastPivotCompatible_
Definition: ClpPESimplex.hpp:218
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
ClpPESimplex::numberColumns_
int numberColumns_
Definition: ClpPESimplex.hpp:186
ClpPESimplex::coDualDegenerates_
int coDualDegenerates_
Indices of the non basic variables with a zero reduced cost during the last update (ndual-degenerate ...
Definition: ClpPESimplex.hpp:160
ClpPESimplex::coPrimalDegeneratesAvg_
int coPrimalDegeneratesAvg_
number of degenerate pivots and variables
Definition: ClpPESimplex.hpp:200
ClpPESimplex::updateCompatibleColsAvg
void updateCompatibleColsAvg(int coPivots)
ClpPESimplex::coDualDegenerates
int coDualDegenerates()
Definition: ClpPESimplex.hpp:54
ClpPESimplex::model_
ClpSimplex * model_
pointer to the original model that shall be solved
Definition: ClpPESimplex.hpp:178
ClpPESimplex::checkSize
bool checkSize()
ClpPESimplex::lastObjectiveValue
double lastObjectiveValue()
Tracking the degenerate iterations after compatible pivots.
Definition: ClpPESimplex.hpp:106
ClpPESimplex::stopTimer
void stopTimer()
Definition: ClpPESimplex.hpp:114
ClpPESimplex::coDegenerateCompatiblePivots_
int coDegenerateCompatiblePivots_
Definition: ClpPESimplex.hpp:208
ClpPESimplex::addDegeneratePivotConsecutive
void addDegeneratePivotConsecutive()
Definition: ClpPESimplex.hpp:123
ClpPESimplex::printTimer
void printTimer(std::ostream &out)
ClpPESimplex::coPrimalDegeneratesAvg
double coPrimalDegeneratesAvg()
Definition: ClpPESimplex.hpp:129
ClpPESimplex::coCompatibleCols
int coCompatibleCols()
Definition: ClpPESimplex.hpp:55
ClpPESimplex::doStatistics
int doStatistics() const
Definition: ClpPESimplex.hpp:142
ClpPESimplex::lastObjectiveValue_
double lastObjectiveValue_
tracking the degenerate iterations after compatible pivots
Definition: ClpPESimplex.hpp:217
ClpPESimplex::startTimer
void startTimer()
Start and stop the timer, and print the total recorded time.
Definition: ClpPESimplex.hpp:113
ClpPESimplex::identifyCompatibleCols
void identifyCompatibleCols(int number, const int *which, CoinIndexedVector *spareRow2, CoinIndexedVector *wPrimal)
Identify the primal compatible columns The input argument is a temporary array that is needed for the...
ClpPESimplex::compatibilityCol_
double * compatibilityCol_
Definition: ClpPESimplex.hpp:167
ClpPESimplex::epsCompatibility_
double epsCompatibility_
Definition: ClpPESimplex.hpp:182
ClpPESimplex::coUpdateDegenerates_
int coUpdateDegenerates_
Definition: ClpPESimplex.hpp:204
ClpPESimplex::isPrimalDegenerate_
bool * isPrimalDegenerate_
Definition: ClpPESimplex.hpp:156
ClpPESimplex::coCompatibleRows
int coCompatibleRows()
Definition: ClpPESimplex.hpp:56
ClpPESimplex::coDegeneratePivots
int coDegeneratePivots()
Definition: ClpPESimplex.hpp:122
ClpPESimplex::addCompatiblePivot
void addCompatiblePivot()
Definition: ClpPESimplex.hpp:135
ClpPESimplex::epsDegeneracy_
double epsDegeneracy_
tolerance used for the tests of degeneracy and compatibility (resp.)
Definition: ClpPESimplex.hpp:181
ClpPESimplex::updateCompatibleRows
void updateCompatibleRows(int sequence)
Update the dual compatible rows.
ClpPESimplex::coPrimalDegenerates_
int coPrimalDegenerates_
Indices of the variables that were not at one of their bounds during the last update (non primal dege...
Definition: ClpPESimplex.hpp:154
ClpPackedMatrix.hpp
ClpPESimplex::coDegeneratePivots_
int coDegeneratePivots_
Definition: ClpPESimplex.hpp:206
ClpPESimplex::coCompatibleColsAvg_
int coCompatibleColsAvg_
Definition: ClpPESimplex.hpp:202
ClpPESimplex::updateLastObjectiveValue
void updateLastObjectiveValue()
Definition: ClpPESimplex.hpp:107
ClpPESimplex::timeTmp_
double timeTmp_
Definition: ClpPESimplex.hpp:225
ClpPESimplex::updatePrimalDegenerates
void updatePrimalDegenerates()
PUBLIC METHODS RELATED TO COMPATIBILITY.
ClpPESimplex::coPriorityPivots
int coPriorityPivots()
Definition: ClpPESimplex.hpp:141
ClpPESimplex::addDegenerateCompatiblePivot
void addDegenerateCompatiblePivot()
Definition: ClpPESimplex.hpp:137
ClpPESimplex::isDualDegenerate_
bool * isDualDegenerate_
Definition: ClpPESimplex.hpp:162
ClpPESimplex::coCompatibleRows_
int coCompatibleRows_
Table of booleans indicating whether each constraint is dual compatible (true) or not (false) ...
Definition: ClpPESimplex.hpp:172
PEtransposeTimesSubsetAll
void PEtransposeTimesSubsetAll(ClpSimplex *model, int number, const int *which, const double *COIN_RESTRICT x, double *COIN_RESTRICT y, const double *COIN_RESTRICT rowScale, const double *COIN_RESTRICT columnScale)
compute the product x^T*[A I] for the indices &quot;which&quot; of [A I]
CoinIndexedVector.hpp
ClpPESimplex::updatePrimalDegeneratesAvg
void updatePrimalDegeneratesAvg(int coPivots)
ClpPESimplex::coCompatibleCols_
int coCompatibleCols_
Table of booleans indicating whether each variable is primal compatible (true) or not (false) ...
Definition: ClpPESimplex.hpp:166
ClpPESimplex::timeMultRandom_
double timeMultRandom_
Definition: ClpPESimplex.hpp:223
ClpPESimplex::coDegeneratePivotsConsecutive
int coDegeneratePivotsConsecutive()
Definition: ClpPESimplex.hpp:125
ClpPESimplex::setDoStatistics
void setDoStatistics(int value)
Definition: ClpPESimplex.hpp:146
ClpPESimplex::clpModel
ClpSimplex * clpModel()
Definition: ClpPESimplex.hpp:65
ClpPESimplex
BASE CLASS FOR THE IMPROVED SIMPLEX.
Definition: ClpPESimplex.hpp:42
ClpPESimplex::tempRandom_
double * tempRandom_
w vectors that are used to identify the compatible columns and rows.
Definition: ClpPESimplex.hpp:197
ClpPESimplex::resetDegeneratePivotsConsecutive
void resetDegeneratePivotsConsecutive()
Definition: ClpPESimplex.hpp:124
ClpPESimplex::isCompatibleRow_
bool * isCompatibleRow_
Definition: ClpPESimplex.hpp:174