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

- File List
- File Members

ClpSimplexOther.hpp
Go to the documentation of this file.
1 /* $Id: ClpSimplexOther.hpp 2070 2014-11-18 11:12:54Z forrest $ */
2 // Copyright (C) 2004, 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 Authors
7
8 John Forrest
9
10 */
11 #ifndef ClpSimplexOther_H
12 #define ClpSimplexOther_H
13
14 #include "ClpSimplex.hpp"
15
23 class ClpSimplexOther : public ClpSimplex {
24
25 public:
26
49 void dualRanging(int numberCheck, const int * which,
50 double * costIncrease, int * sequenceIncrease,
51 double * costDecrease, int * sequenceDecrease,
52 double * valueIncrease = NULL, double * valueDecrease = NULL);
67 void primalRanging(int numberCheck, const int * which,
68 double * valueIncrease, int * sequenceIncrease,
69 double * valueDecrease, int * sequenceDecrease);
83 int parametrics(double startingTheta, double & endingTheta, double reportIncrement,
84 const double * changeLowerBound, const double * changeUpperBound,
85 const double * changeLowerRhs, const double * changeUpperRhs,
86 const double * changeObjective);
90 int parametrics(const char * dataFile);
100 int parametrics(double startingTheta, double & endingTheta,
101 const double * changeLowerBound, const double * changeUpperBound,
102 const double * changeLowerRhs, const double * changeUpperRhs);
103 int parametricsObj(double startingTheta, double & endingTheta,
104 const double * changeObjective);
106 double bestPivot(bool justColumns=false);
107 typedef struct {
108 double startingTheta;
109 double endingTheta;
110 double maxTheta;
111 double acceptableMaxTheta; // if this far then within tolerances
112 double * lowerChange; // full array of lower bound changes
113 int * lowerList; // list of lower bound changes
114 double * upperChange; // full array of upper bound changes
115 int * upperList; // list of upper bound changes
116 char * markDone; // mark which ones looked at
117 int * backwardBasic; // from sequence to pivot row
118 int * lowerActive;
119 double * lowerGap;
120 double * lowerCoefficient;
121 int * upperActive;
122 double * upperGap;
123 double * upperCoefficient;
124 int unscaledChangesOffset;
125 bool firstIteration; // so can update rhs for accuracy
126 } parametricsData;
127
128 private:
137 int parametricsLoop(parametricsData & paramData, double reportIncrement,
138 const double * changeLower, const double * changeUpper,
139 const double * changeObjective, ClpDataSave & data,
140 bool canTryQuick);
141 int parametricsLoop(parametricsData & paramData,
142 ClpDataSave & data,bool canSkipFactorization=false);
143 int parametricsObjLoop(parametricsData & paramData,
144 ClpDataSave & data,bool canSkipFactorization=false);
152 void statusOfProblemInParametrics(int type, ClpDataSave & saveData);
153 void statusOfProblemInParametricsObj(int type, ClpDataSave & saveData);
164 int whileIterating(parametricsData & paramData, double reportIncrement,
165 const double * changeObjective);
170 int nextTheta(int type, double maxTheta, parametricsData & paramData,
171 const double * changeObjective);
172 int whileIteratingObj(parametricsData & paramData);
173 int nextThetaObj(double maxTheta, parametricsData & paramData);
175 void originalBound(int iSequence, double theta, const double * changeLower,
176 const double * changeUpper);
178 double computeRhsEtc(parametricsData & paramData);
180 void redoInternalArrays();
186 void checkDualRatios(CoinIndexedVector * rowArray,
187 CoinIndexedVector * columnArray,
188 double & costIncrease, int & sequenceIncrease, double & alphaIncrease,
189 double & costDecrease, int & sequenceDecrease, double & alphaDecrease);
194 void checkPrimalRatios(CoinIndexedVector * rowArray,
195 int direction);
197 double primalRanging1(int whichIn, int whichOther);
198
199 public:
214 int writeBasis(const char *filename,
215 bool writeValues = false,
216 int formatType = 0) const;
218 int readBasis(const char *filename);
224 ClpSimplex * dualOfModel(double fractionRowRanges = 1.0, double fractionColumnRanges = 1.0) const;
228 int restoreFromDual(const ClpSimplex * dualProblem,
229 bool checkAccuracy=false);
233 int setInDual(ClpSimplex * dualProblem);
237 ClpSimplex * crunch(double * rhs, int * whichRows, int * whichColumns,
238 int & nBound, bool moreBounds = false, bool tightenBounds = false);
242 void afterCrunch(const ClpSimplex & small,
243 const int * whichRows, const int * whichColumns,
244 int nBound);
248 ClpSimplex * gubVersion(int * whichRows, int * whichColumns,
249 int neededGub,
250 int factorizationFrequency=50);
252 void setGubBasis(ClpSimplex &original,const int * whichRows,
253 const int * whichColumns);
255 void getGubBasis(ClpSimplex &original,const int * whichRows,
256 const int * whichColumns) const;
258 void cleanupAfterPostsolve();
261 int tightenIntegerBounds(double * rhsSpace);
272 int expandKnapsack(int knapsackRow, int & numberOutput,
273 double * buildObj, CoinBigIndex * buildStart,
274 int * buildRow, double * buildElement, int reConstruct = -1) const;
276 };
277 #endif
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:105
ClpSimplexOther::checkPrimalRatios
void checkPrimalRatios(CoinIndexedVector *rowArray, int direction)
Row array has pivot column This is used in primal ranging.
ClpSimplexOther::parametricsData::upperActive
int * upperActive
Definition: ClpSimplexOther.hpp:121
ClpSimplexOther::statusOfProblemInParametricsObj
void statusOfProblemInParametricsObj(int type, ClpDataSave &saveData)
Dual ranging.
ClpSimplexOther::parametricsData::startingTheta
double startingTheta
Definition: ClpSimplexOther.hpp:108
ClpSimplex::saveData
ClpDataSave saveData()
Save data.
ClpSimplexOther::getGubBasis
void getGubBasis(ClpSimplex &original, const int *whichRows, const int *whichColumns) const
Restores basis to original.
ClpDataSave
This is a tiny class where data can be saved round calls.
Definition: ClpModel.hpp:1269
ClpSimplexOther::parametricsData::lowerActive
int * lowerActive
Definition: ClpSimplexOther.hpp:118
ClpSimplexOther::computeRhsEtc
double computeRhsEtc(parametricsData &paramData)
Compute new rowLower_ etc (return negative if infeasible - otherwise largest change) ...
ClpSimplexOther::parametricsData::upperCoefficient
double * upperCoefficient
Definition: ClpSimplexOther.hpp:123
ClpSimplexOther::setInDual
int setInDual(ClpSimplex *dualProblem)
Sets solution in dualized problem non-zero return code indicates minor problems.
ClpSimplexOther::cleanupAfterPostsolve
void cleanupAfterPostsolve()
Quick try at cleaning up duals if postsolve gets wrong.
ClpSimplexOther::parametricsObjLoop
int parametricsObjLoop(parametricsData &paramData, ClpDataSave &data, bool canSkipFactorization=false)
Dual ranging.
ClpSimplexOther::parametricsObj
int parametricsObj(double startingTheta, double &endingTheta, const double *changeObjective)
Dual ranging.
ClpSimplexOther::parametricsData::firstIteration
bool firstIteration
Definition: ClpSimplexOther.hpp:125
ClpSimplexOther::parametricsData::maxTheta
double maxTheta
Definition: ClpSimplexOther.hpp:110
ClpSimplexOther::parametricsData::upperList
int * upperList
Definition: ClpSimplexOther.hpp:115
ClpSimplex.hpp
ClpSimplexOther::parametricsData::acceptableMaxTheta
double acceptableMaxTheta
Definition: ClpSimplexOther.hpp:111
ClpSimplexOther::parametricsData::upperChange
double * upperChange
Definition: ClpSimplexOther.hpp:114
ClpSimplexOther::parametricsLoop
int parametricsLoop(parametricsData &paramData, double reportIncrement, const double *changeLower, const double *changeUpper, const double *changeObjective, ClpDataSave &data, bool canTryQuick)
Parametrics - inner loop This first attempt is when reportIncrement non zero and may not report endin...
ClpSimplexOther::whileIterating
int whileIterating(parametricsData &paramData, double reportIncrement, const double *changeObjective)
This has the flow between re-factorizations.
ClpSimplexOther::parametricsData::upperGap
double * upperGap
Definition: ClpSimplexOther.hpp:122
ClpSimplexOther::gubVersion
ClpSimplex * gubVersion(int *whichRows, int *whichColumns, int neededGub, int factorizationFrequency=50)
Returns gub version of model or NULL whichRows has to be numberRows whichColumns has to be numberRows...
ClpSimplexOther::parametricsData::lowerGap
double * lowerGap
Definition: ClpSimplexOther.hpp:119
ClpSimplexOther::parametricsData::markDone
char * markDone
Definition: ClpSimplexOther.hpp:116
ClpSimplex::columnArray
CoinIndexedVector * columnArray(int index) const
Useful column length arrays (0,1,2,3,4,5)
Definition: ClpSimplex.hpp:731
ClpSimplexOther::parametricsData::lowerChange
double * lowerChange
Definition: ClpSimplexOther.hpp:112
ClpSimplex::theta
double theta() const
Theta (pivot change)
Definition: ClpSimplex.hpp:1182
ClpSimplexOther::parametricsData::lowerCoefficient
double * lowerCoefficient
Definition: ClpSimplexOther.hpp:120
ClpSimplexOther::originalBound
void originalBound(int iSequence, double theta, const double *changeLower, const double *changeUpper)
Restores bound to original bound.
ClpSimplexOther::parametricsData::endingTheta
double endingTheta
Definition: ClpSimplexOther.hpp:109
ClpSimplexOther::crunch
ClpSimplex * crunch(double *rhs, int *whichRows, int *whichColumns, int &nBound, bool moreBounds=false, bool tightenBounds=false)
Does very cursory presolve.
ClpSimplexOther::dualRanging
void dualRanging(int numberCheck, const int *which, double *costIncrease, int *sequenceIncrease, double *costDecrease, int *sequenceDecrease, double *valueIncrease=NULL, double *valueDecrease=NULL)
Dual ranging.
ClpSimplexOther::bestPivot
double bestPivot(bool justColumns=false)
Finds best possible pivot.
ClpSimplexOther::primalRanging
void primalRanging(int numberCheck, const int *which, double *valueIncrease, int *sequenceIncrease, double *valueDecrease, int *sequenceDecrease)
Primal ranging.
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
ClpSimplexOther::primalRanging1
double primalRanging1(int whichIn, int whichOther)
Returns new value of whichOther when whichIn enters basis.
ClpSimplexOther::writeBasis
int writeBasis(const char *filename, bool writeValues=false, int formatType=0) const
Write the basis in MPS format to the specified file.
ClpSimplexOther::afterCrunch
void afterCrunch(const ClpSimplex &small, const int *whichRows, const int *whichColumns, int nBound)
After very cursory presolve.
ClpSimplexOther::parametricsData::backwardBasic
int * backwardBasic
Definition: ClpSimplexOther.hpp:117
ClpSimplexOther::dualOfModel
ClpSimplex * dualOfModel(double fractionRowRanges=1.0, double fractionColumnRanges=1.0) const
Creates dual of a problem if looks plausible (defaults will always create model) fractionRowRanges is...
ClpSimplex::factorizationFrequency
int factorizationFrequency() const
Factorization frequency.
ClpSimplexOther::tightenIntegerBounds
int tightenIntegerBounds(double *rhsSpace)
Tightens integer bounds - returns number tightened or -1 if infeasible.
ClpSimplexOther::restoreFromDual
int restoreFromDual(const ClpSimplex *dualProblem, bool checkAccuracy=false)
Restores solution from dualized problem non-zero return code indicates minor problems.
ClpSimplex::rowArray
CoinIndexedVector * rowArray(int index) const
Useful row length arrays (0,1,2,3,4,5)
Definition: ClpSimplex.hpp:727
ClpSimplexOther::parametricsData
Definition: ClpSimplexOther.hpp:107
ClpSimplexOther::nextThetaObj
int nextThetaObj(double maxTheta, parametricsData &paramData)
Dual ranging.
ClpSimplexOther::parametrics
int parametrics(double startingTheta, double &endingTheta, double reportIncrement, const double *changeLowerBound, const double *changeUpperBound, const double *changeLowerRhs, const double *changeUpperRhs, const double *changeObjective)
Parametrics This is an initial slow version.
ClpSimplexOther::redoInternalArrays
void redoInternalArrays()
Redo lower_ from rowLower_ etc.
ClpSimplexOther::expandKnapsack
int expandKnapsack(int knapsackRow, int &numberOutput, double *buildObj, CoinBigIndex *buildStart, int *buildRow, double *buildElement, int reConstruct=-1) const
Expands out all possible combinations for a knapsack If buildObj NULL then just computes space needed...
ClpSimplexOther::statusOfProblemInParametrics
void statusOfProblemInParametrics(int type, ClpDataSave &saveData)
Refactorizes if necessary Checks if finished.
ClpSimplexOther::nextTheta
int nextTheta(int type, double maxTheta, parametricsData &paramData, const double *changeObjective)
Computes next theta and says if objective or bounds (0= bounds, 1 objective, -1 none).
ClpSimplexOther
This is for Simplex stuff which is neither dual nor primal.
Definition: ClpSimplexOther.hpp:23
ClpSimplexOther::readBasis
int readBasis(const char *filename)
Read a basis from the given filename.
ClpSimplexOther::parametricsData::unscaledChangesOffset
int unscaledChangesOffset
Definition: ClpSimplexOther.hpp:124
ClpSimplexOther::parametricsData::lowerList
int * lowerList
Definition: ClpSimplexOther.hpp:113
ClpSimplexOther::setGubBasis
void setGubBasis(ClpSimplex &original, const int *whichRows, const int *whichColumns)
Sets basis from original.
ClpSimplexOther::checkDualRatios
void checkDualRatios(CoinIndexedVector *rowArray, CoinIndexedVector *columnArray, double &costIncrease, int &sequenceIncrease, double &alphaIncrease, double &costDecrease, int &sequenceDecrease, double &alphaDecrease)
Row array has row part of pivot row Column array has column part.
ClpSimplexOther::whileIteratingObj
int whileIteratingObj(parametricsData &paramData)
Dual ranging.