Clp 1.17.5
Loading...
Searching...
No Matches
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
28double PEdot(CoinIndexedVector &v1, const double *v2);
29
32double PEdot(CoinIndexedVector &v1, CoinIndexedVector &v2);
33
35void 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
43
44public:
47
50
52public:
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();
69public:
72
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
90public:
91#if PE_DEBUG >= 1
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_; }
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
126 void updateDualDegeneratesAvg(int coPivots);
127 inline double coDualDegeneratesAvg() { return coDualDegeneratesAvg_; }
128 void updatePrimalDegeneratesAvg(int coPivots);
130 inline double coCompatibleRowsAvg() { return coCompatibleRowsAvg_; }
131 void updateCompatibleRowsAvg(int coPivots);
132 inline double coCompatibleColsAvg() { return coCompatibleColsAvg_; }
133 void updateCompatibleColsAvg(int coPivots);
138
139 /* Get and update the number of compatible pivots that were done because of the priority factor */
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
151protected:
157
163
169
175
176private:
179
183
187
191 // now passed in CoinIndexedVector *wPrimal_;
192 // now passed in CoinIndexedVector *wDual_;
193
196 // not usedCoinIndexedVector *tempColumn_;
197 double *tempRandom_;
198
210
215
219
225 double timeTmp_;
226};
227
228#endif
229
230/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
231*/
#define COIN_RESTRICT
double PEdot(CoinIndexedVector &v1, const double *v2)
SHARED METHODS FOR USEFUL ALGEBRAIC OPERATIONS.
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 "which" of [A I]
double dualTolerance() const
Dual tolerance to use.
Definition ClpModel.hpp:343
double objectiveValue() const
Objective value.
Definition ClpModel.hpp:841
BASE CLASS FOR THE IMPROVED SIMPLEX.
int coDegenerateCompatiblePivots()
int coDegeneratePivotsConsecutive_
ClpSimplex * clpModel()
double timeLinearSystem_
void resetDegeneratePivotsConsecutive()
void setDoStatistics(int value)
void addDegeneratePivotConsecutive()
void updateDualDegenerates()
Updates the set of dual degenerate variables.
int coDegenerateCompatiblePivots_
bool checkSize()
int coPrimalDegenerates()
BASIC GET METHODS.
void updatePrimalDegenerates()
PUBLIC METHODS RELATED TO COMPATIBILITY.
int coCompatibleRows()
bool isLastPivotCompatible_
bool * isPrimalDegenerate_
void printTimer(std::ostream &out)
void updateCompatibleRows(int sequence)
Update the dual compatible rows.
int doStatistics() const
double epsDegeneracy_
tolerance used for the tests of degeneracy and compatibility (resp.)
double timeLinearSystem()
int coPriorityPivots_
number of compatible pivots that were done because of the priority factor
bool checkCompatibilityRow(int pivotRow)
DEBUG AND DISPLAY METHODS.
int coDualDegenerates()
double lastObjectiveValue_
tracking the degenerate iterations after compatible pivots
void addDegeneratePivot()
Update and return the number of degenerate pivots and variables.
void addCompatiblePivot()
bool * isCompatibleRow_
bool * isCompatibleCol_
int coCompatibleCols_
Table of booleans indicating whether each variable is primal compatible (true) or not (false)
int * primalDegenerates_
void identifyCompatibleRows(CoinIndexedVector *spare, CoinIndexedVector *wDual)
Identify the dual compatible rows.
void updateCompatibleRowsAvg(int coPivots)
void updateDualDegeneratesAvg(int coPivots)
int coCompatiblePivots()
int coPrimalDegeneratesAvg_
number of degenerate pivots and variables
void updateCompatibleColsAvg(int coPivots)
void isLastPivotCompatible(bool yesOrNo)
bool * isDualDegenerate_
void updatePrimalDegeneratesAvg(int coPivots)
int doStatistics_
Do statistics.
int coPrimalDegenerates_
Indices of the variables that were not at one of their bounds during the last update (non primal dege...
double coCompatibleRowsAvg()
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...
double timeCompatibility_
Timer attribute recording the additional time spent in identifying compatible variables.
bool isLastPivotCompatible()
bool isCompatibleCol(int sequence)
int numberRows_
size of the original model
void updateLastObjectiveValue()
double timeMultRandom()
double epsCompatibility_
double coPrimalDegeneratesAvg()
double timeCompatibility()
double lastObjectiveValue()
Tracking the degenerate iterations after compatible pivots.
double coDualDegeneratesAvg()
double coCompatibleColsAvg()
double * tempRandom_
w vectors that are used to identify the compatible columns and rows.
void addDegenerateCompatiblePivot()
int coCompatibleRows_
Table of booleans indicating whether each constraint is dual compatible (true) or not (false)
double * compatibilityRow_
void startTimer()
Start and stop the timer, and print the total recorded time.
int coDegeneratePivots()
int coDegeneratePivotsConsecutive()
int coDualDegenerates_
Indices of the non basic variables with a zero reduced cost during the last update (ndual-degenerate ...
double * compatibilityCol_
ClpSimplex * model_
pointer to the original model that shall be solved
void addPriorityPivot()
int coCompatibleCols()
ClpPESimplex(ClpSimplex *model)
Constructor.
bool isDegeneratePivot()
double timeMultRandom_
bool isCompatibleRow(int row)
~ClpPESimplex()
Destructor.
This solves LPs using the simplex method.