Clp 1.17.5
Loading...
Searching...
No Matches
ClpSimplexOther.hpp
Go to the documentation of this file.
1/* $Id: ClpSimplexOther.hpp 2385 2019-01-06 19:43:06Z unxusr $ */
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
24
25public:
48 void dualRanging(int numberCheck, const int *which,
49 double *costIncrease, int *sequenceIncrease,
50 double *costDecrease, int *sequenceDecrease,
51 double *valueIncrease = NULL, double *valueDecrease = NULL);
66 void primalRanging(int numberCheck, const int *which,
67 double *valueIncrease, int *sequenceIncrease,
68 double *valueDecrease, int *sequenceDecrease);
82 int parametrics(double startingTheta, double &endingTheta, double reportIncrement,
83 const double *changeLowerBound, const double *changeUpperBound,
84 const double *changeLowerRhs, const double *changeUpperRhs,
85 const double *changeObjective);
89 int parametrics(const char *dataFile);
99 int parametrics(double startingTheta, double &endingTheta,
100 const double *changeLowerBound, const double *changeUpperBound,
101 const double *changeLowerRhs, const double *changeUpperRhs);
102 int parametricsObj(double startingTheta, double &endingTheta,
103 const double *changeObjective);
105 double bestPivot(bool justColumns = false);
106 typedef struct {
109 double maxTheta;
110 double acceptableMaxTheta; // if this far then within tolerances
111 double *lowerChange; // full array of lower bound changes
112 int *lowerList; // list of lower bound changes
113 double *upperChange; // full array of upper bound changes
114 int *upperList; // list of upper bound changes
115 char *markDone; // mark which ones looked at
116 int *backwardBasic; // from sequence to pivot row
118 double *lowerGap;
121 double *upperGap;
124 bool firstIteration; // so can update rhs for accuracy
126
127private:
136 int parametricsLoop(parametricsData &paramData, double reportIncrement,
137 const double *changeLower, const double *changeUpper,
138 const double *changeObjective, ClpDataSave &data,
139 bool canTryQuick);
141 ClpDataSave &data, bool canSkipFactorization = false);
143 ClpDataSave &data, bool canSkipFactorization = false);
163 int whileIterating(parametricsData &paramData, double reportIncrement,
164 const double *changeObjective);
169 int nextTheta(int type, double maxTheta, parametricsData &paramData,
170 const double *changeObjective);
172 int nextThetaObj(double maxTheta, parametricsData &paramData);
174 void originalBound(int iSequence, double theta, const double *changeLower,
175 const double *changeUpper);
177 double computeRhsEtc(parametricsData &paramData);
185 void checkDualRatios(CoinIndexedVector *rowArray,
186 CoinIndexedVector *columnArray,
187 double &costIncrease, int &sequenceIncrease, double &alphaIncrease,
188 double &costDecrease, int &sequenceDecrease, double &alphaDecrease);
193 void checkPrimalRatios(CoinIndexedVector *rowArray,
194 int direction);
196 double primalRanging1(int whichIn, int whichOther);
197
198public:
213 int writeBasis(const char *filename,
214 bool writeValues = false,
215 int formatType = 0) const;
217 int readBasis(const char *filename);
223 ClpSimplex *dualOfModel(double fractionRowRanges = 1.0, double fractionColumnRanges = 1.0) const;
227 int restoreFromDual(const ClpSimplex *dualProblem,
228 bool checkAccuracy = false);
232 int setInDual(ClpSimplex *dualProblem);
236 ClpSimplex *crunch(double *rhs, int *whichRows, int *whichColumns,
237 int &nBound, bool moreBounds = false, bool tightenBounds = false);
241 void afterCrunch(const ClpSimplex &small,
242 const int *whichRows, const int *whichColumns,
243 int nBound);
247 ClpSimplex *gubVersion(int *whichRows, int *whichColumns,
248 int neededGub,
249 int factorizationFrequency = 50);
251 void setGubBasis(ClpSimplex &original, const int *whichRows,
252 const int *whichColumns);
254 void getGubBasis(ClpSimplex &original, const int *whichRows,
255 const int *whichColumns) const;
260 int tightenIntegerBounds(double *rhsSpace);
271 int expandKnapsack(int knapsackRow, int &numberOutput,
272 double *buildObj, CoinBigIndex *buildStart,
273 int *buildRow, double *buildElement, int reConstruct = -1) const;
276 char *guess(int mode) const;
278};
279#endif
280
281/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
282*/
This is a tiny class where data can be saved round calls.
This is for Simplex stuff which is neither dual nor primal.
void dualRanging(int numberCheck, const int *which, double *costIncrease, int *sequenceIncrease, double *costDecrease, int *sequenceDecrease, double *valueIncrease=NULL, double *valueDecrease=NULL)
Dual ranging.
void redoInternalArrays()
Redo lower_ from rowLower_ etc.
int setInDual(ClpSimplex *dualProblem)
Sets solution in dualized problem non-zero return code indicates minor problems.
char * guess(int mode) const
Create a string of commands to guess at best strategy for model At present mode is ignored.
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...
void originalBound(int iSequence, double theta, const double *changeLower, const double *changeUpper)
Restores bound to original bound.
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.
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...
int parametricsObj(double startingTheta, double &endingTheta, const double *changeObjective)
void setGubBasis(ClpSimplex &original, const int *whichRows, const int *whichColumns)
Sets basis from original.
void checkPrimalRatios(CoinIndexedVector *rowArray, int direction)
Row array has pivot column This is used in primal ranging.
void cleanupAfterPostsolve()
Quick try at cleaning up duals if postsolve gets wrong.
int parametrics(const char *dataFile)
Version of parametrics which reads from file See CbcClpParam.cpp for details of format Returns -2 if ...
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).
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...
ClpSimplex * crunch(double *rhs, int *whichRows, int *whichColumns, int &nBound, bool moreBounds=false, bool tightenBounds=false)
Does very cursory presolve.
void statusOfProblemInParametrics(int type, ClpDataSave &saveData)
Refactorizes if necessary Checks if finished.
int restoreFromDual(const ClpSimplex *dualProblem, bool checkAccuracy=false)
Restores solution from dualized problem non-zero return code indicates minor problems.
void statusOfProblemInParametricsObj(int type, ClpDataSave &saveData)
double computeRhsEtc(parametricsData &paramData)
Compute new rowLower_ etc (return negative if infeasible - otherwise largest change)
int whileIteratingObj(parametricsData &paramData)
int tightenIntegerBounds(double *rhsSpace)
Tightens integer bounds - returns number tightened or -1 if infeasible.
int nextThetaObj(double maxTheta, parametricsData &paramData)
int parametrics(double startingTheta, double &endingTheta, const double *changeLowerBound, const double *changeUpperBound, const double *changeLowerRhs, const double *changeUpperRhs)
Parametrics This is an initial slow version.
int whileIterating(parametricsData &paramData, double reportIncrement, const double *changeObjective)
This has the flow between re-factorizations.
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.
int parametricsLoop(parametricsData &paramData, ClpDataSave &data, bool canSkipFactorization=false)
int parametricsObjLoop(parametricsData &paramData, ClpDataSave &data, bool canSkipFactorization=false)
void primalRanging(int numberCheck, const int *which, double *valueIncrease, int *sequenceIncrease, double *valueDecrease, int *sequenceDecrease)
Primal ranging.
double primalRanging1(int whichIn, int whichOther)
Returns new value of whichOther when whichIn enters basis.
void getGubBasis(ClpSimplex &original, const int *whichRows, const int *whichColumns) const
Restores basis to original.
int readBasis(const char *filename)
Read a basis from the given filename.
double bestPivot(bool justColumns=false)
Finds best possible pivot.
void afterCrunch(const ClpSimplex &small, const int *whichRows, const int *whichColumns, int nBound)
After very cursory presolve.
int writeBasis(const char *filename, bool writeValues=false, int formatType=0) const
Write the basis in MPS format to the specified file.
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...
This solves LPs using the simplex method.
double theta() const
Theta (pivot change)
ClpDataSave saveData()
Save data.
CoinIndexedVector * rowArray(int index) const
Useful row length arrays (0,1,2,3,4,5)
CoinIndexedVector * columnArray(int index) const
Useful column length arrays (0,1,2,3,4,5)
int factorizationFrequency() const
Factorization frequency.