This is the Clp interface to CoinPresolve. More...
#include <ClpPresolve.hpp>
Public Member Functions | |
Main Constructor, destructor | |
ClpPresolve () | |
Default constructor. | |
virtual | ~ClpPresolve () |
Virtual destructor. | |
presolve - presolves a model, transforming the model | |
and saving information in the ClpPresolve object needed for postsolving. This underlying (protected) method is virtual; the idea is that in the future, one could override this method to customize how the various presolve techniques are applied. This version of presolve returns a pointer to a new presolved model. NULL if infeasible or unbounded. This should be paired with postsolve below. The advantage of going back to original model is that it will be exactly as it was i.e. 0.0 will not become 1.0e-19. If keepIntegers is true then bounds may be tightened in original. Bounds will be moved by up to feasibilityTolerance to try and stay feasible. Names will be dropped in presolved model if asked | |
ClpSimplex * | presolvedModel (ClpSimplex &si, double feasibilityTolerance=0.0, bool keepIntegers=true, int numberPasses=5, bool dropNames=false, bool doRowObjective=false) |
This version saves data in a file. | |
int | presolvedModelToFile (ClpSimplex &si, std::string fileName, double feasibilityTolerance=0.0, bool keepIntegers=true, int numberPasses=5, bool doRowObjective=false) |
This version saves data in a file. | |
ClpSimplex * | model () const |
Return pointer to presolved model, Up to user to destroy. | |
ClpSimplex * | originalModel () const |
Return pointer to original model. | |
void | setOriginalModel (ClpSimplex *model) |
Set pointer to original model. | |
const int * | originalColumns () const |
return pointer to original columns | |
const int * | originalRows () const |
return pointer to original rows | |
void | setNonLinearValue (double value) |
"Magic" number. | |
double | nonLinearValue () const |
This version saves data in a file. | |
bool | doDual () const |
Whether we want to do dual part of presolve. | |
void | setDoDual (bool doDual) |
This version saves data in a file. | |
bool | doSingleton () const |
Whether we want to do singleton part of presolve. | |
void | setDoSingleton (bool doSingleton) |
This version saves data in a file. | |
bool | doDoubleton () const |
Whether we want to do doubleton part of presolve. | |
void | setDoDoubleton (bool doDoubleton) |
This version saves data in a file. | |
bool | doTripleton () const |
Whether we want to do tripleton part of presolve. | |
void | setDoTripleton (bool doTripleton) |
This version saves data in a file. | |
bool | doTighten () const |
Whether we want to do tighten part of presolve. | |
void | setDoTighten (bool doTighten) |
This version saves data in a file. | |
bool | doForcing () const |
Whether we want to do forcing part of presolve. | |
void | setDoForcing (bool doForcing) |
This version saves data in a file. | |
bool | doImpliedFree () const |
Whether we want to do impliedfree part of presolve. | |
void | setDoImpliedFree (bool doImpliedfree) |
This version saves data in a file. | |
bool | doDupcol () const |
Whether we want to do dupcol part of presolve. | |
void | setDoDupcol (bool doDupcol) |
This version saves data in a file. | |
bool | doDuprow () const |
Whether we want to do duprow part of presolve. | |
void | setDoDuprow (bool doDuprow) |
This version saves data in a file. | |
bool | doSingletonColumn () const |
Whether we want to do singleton column part of presolve. | |
void | setDoSingletonColumn (bool doSingleton) |
This version saves data in a file. | |
int | presolveActions () const |
Set whole group. | |
void | setPresolveActions (int action) |
This version saves data in a file. | |
void | setSubstitution (int value) |
Substitution level. | |
void | statistics () |
Asks for statistics. | |
postsolve - postsolve the problem. If the problem | |
has not been solved to optimality, there are no guarantees. If you are using an algorithm like simplex that has a concept of "basic" rows/cols, then set updateStatus Note that if you modified the original problem after presolving, then you must ``undo'' these modifications before calling postsolve. This version updates original | |
virtual void | postsolve (bool updateStatus=true) |
Gets rid of presolve actions (e.g.when infeasible). | |
void | destroyPresolve () |
Gets rid of presolve actions (e.g.when infeasible). | |
private or protected data | |
| |
ClpSimplex * | originalModel_ |
Original model - must not be destroyed before postsolve. | |
ClpSimplex * | presolvedModel_ |
ClpPresolved model - up to user to destroy by deleteClpPresolvedModel. | |
double | nonLinearValue_ |
"Magic" number. | |
int * | originalColumn_ |
Original column numbers. | |
int * | originalRow_ |
Original row numbers. | |
double * | rowObjective_ |
Row objective. | |
const CoinPresolveAction * | paction_ |
The list of transformations applied. | |
int | ncols_ |
The postsolved problem will expand back to its former size as postsolve transformations are applied. | |
int | nrows_ |
Original model - must not be destroyed before postsolve. | |
CoinBigIndex | nelems_ |
Original model - must not be destroyed before postsolve. | |
int | numberPasses_ |
Number of major passes. | |
int | substitution_ |
Substitution level. | |
std::string | saveFile_ |
Name of saved model file. | |
int | presolveActions_ |
Whether we want to skip dual part of presolve etc. | |
virtual const CoinPresolveAction * | presolve (CoinPresolveMatrix *prob) |
If you want to apply the individual presolve routines differently, or perhaps add your own to the mix, define a derived class and override this method. | |
virtual void | postsolve (CoinPostsolveMatrix &prob) |
Postsolving is pretty generic; just apply the transformations in reverse order. | |
virtual ClpSimplex * | gutsOfPresolvedModel (ClpSimplex *originalModel, double feasibilityTolerance, bool keepIntegers, int numberPasses, bool dropNames, bool doRowObjective) |
This is main part of Presolve. |
This is the Clp interface to CoinPresolve.
Definition at line 13 of file ClpPresolve.hpp.
ClpPresolve::ClpPresolve | ( | ) |
Default constructor.
virtual ClpPresolve::~ClpPresolve | ( | ) | [virtual] |
Virtual destructor.
ClpSimplex* ClpPresolve::presolvedModel | ( | ClpSimplex & | si, | |
double | feasibilityTolerance = 0.0 , |
|||
bool | keepIntegers = true , |
|||
int | numberPasses = 5 , |
|||
bool | dropNames = false , |
|||
bool | doRowObjective = false | |||
) |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
int ClpPresolve::presolvedModelToFile | ( | ClpSimplex & | si, | |
std::string | fileName, | |||
double | feasibilityTolerance = 0.0 , |
|||
bool | keepIntegers = true , |
|||
int | numberPasses = 5 , |
|||
bool | doRowObjective = false | |||
) |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
ClpSimplex* ClpPresolve::model | ( | ) | const |
Return pointer to presolved model, Up to user to destroy.
ClpSimplex* ClpPresolve::originalModel | ( | ) | const |
Return pointer to original model.
void ClpPresolve::setOriginalModel | ( | ClpSimplex * | model | ) |
Set pointer to original model.
const int* ClpPresolve::originalColumns | ( | ) | const |
return pointer to original columns
const int* ClpPresolve::originalRows | ( | ) | const |
return pointer to original rows
void ClpPresolve::setNonLinearValue | ( | double | value | ) | [inline] |
"Magic" number.
If this is non-zero then any elements with this value may change and so presolve is very limited in what can be done to the row and column. This is for non-linear problems.
Definition at line 71 of file ClpPresolve.hpp.
double ClpPresolve::nonLinearValue | ( | ) | const [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 73 of file ClpPresolve.hpp.
bool ClpPresolve::doDual | ( | ) | const [inline] |
Whether we want to do dual part of presolve.
Definition at line 76 of file ClpPresolve.hpp.
void ClpPresolve::setDoDual | ( | bool | doDual | ) | [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 78 of file ClpPresolve.hpp.
bool ClpPresolve::doSingleton | ( | ) | const [inline] |
Whether we want to do singleton part of presolve.
Definition at line 81 of file ClpPresolve.hpp.
void ClpPresolve::setDoSingleton | ( | bool | doSingleton | ) | [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 83 of file ClpPresolve.hpp.
bool ClpPresolve::doDoubleton | ( | ) | const [inline] |
Whether we want to do doubleton part of presolve.
Definition at line 86 of file ClpPresolve.hpp.
void ClpPresolve::setDoDoubleton | ( | bool | doDoubleton | ) | [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 88 of file ClpPresolve.hpp.
bool ClpPresolve::doTripleton | ( | ) | const [inline] |
Whether we want to do tripleton part of presolve.
Definition at line 91 of file ClpPresolve.hpp.
void ClpPresolve::setDoTripleton | ( | bool | doTripleton | ) | [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 93 of file ClpPresolve.hpp.
bool ClpPresolve::doTighten | ( | ) | const [inline] |
Whether we want to do tighten part of presolve.
Definition at line 96 of file ClpPresolve.hpp.
void ClpPresolve::setDoTighten | ( | bool | doTighten | ) | [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 98 of file ClpPresolve.hpp.
bool ClpPresolve::doForcing | ( | ) | const [inline] |
Whether we want to do forcing part of presolve.
Definition at line 101 of file ClpPresolve.hpp.
void ClpPresolve::setDoForcing | ( | bool | doForcing | ) | [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 103 of file ClpPresolve.hpp.
bool ClpPresolve::doImpliedFree | ( | ) | const [inline] |
Whether we want to do impliedfree part of presolve.
Definition at line 106 of file ClpPresolve.hpp.
void ClpPresolve::setDoImpliedFree | ( | bool | doImpliedfree | ) | [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 108 of file ClpPresolve.hpp.
bool ClpPresolve::doDupcol | ( | ) | const [inline] |
Whether we want to do dupcol part of presolve.
Definition at line 111 of file ClpPresolve.hpp.
void ClpPresolve::setDoDupcol | ( | bool | doDupcol | ) | [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 113 of file ClpPresolve.hpp.
bool ClpPresolve::doDuprow | ( | ) | const [inline] |
Whether we want to do duprow part of presolve.
Definition at line 116 of file ClpPresolve.hpp.
void ClpPresolve::setDoDuprow | ( | bool | doDuprow | ) | [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 118 of file ClpPresolve.hpp.
bool ClpPresolve::doSingletonColumn | ( | ) | const [inline] |
Whether we want to do singleton column part of presolve.
Definition at line 121 of file ClpPresolve.hpp.
void ClpPresolve::setDoSingletonColumn | ( | bool | doSingleton | ) | [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 123 of file ClpPresolve.hpp.
int ClpPresolve::presolveActions | ( | ) | const [inline] |
Set whole group.
Definition at line 126 of file ClpPresolve.hpp.
void ClpPresolve::setPresolveActions | ( | int | action | ) | [inline] |
This version saves data in a file.
The passed in model is updated to be presolved model. names are always dropped. Returns non-zero if infeasible
Definition at line 128 of file ClpPresolve.hpp.
void ClpPresolve::setSubstitution | ( | int | value | ) | [inline] |
Substitution level.
Definition at line 131 of file ClpPresolve.hpp.
void ClpPresolve::statistics | ( | ) | [inline] |
Asks for statistics.
Definition at line 134 of file ClpPresolve.hpp.
virtual void ClpPresolve::postsolve | ( | bool | updateStatus = true |
) | [virtual] |
Gets rid of presolve actions (e.g.when infeasible).
void ClpPresolve::destroyPresolve | ( | ) |
Gets rid of presolve actions (e.g.when infeasible).
virtual const CoinPresolveAction* ClpPresolve::presolve | ( | CoinPresolveMatrix * | prob | ) | [protected, virtual] |
If you want to apply the individual presolve routines differently, or perhaps add your own to the mix, define a derived class and override this method.
virtual void ClpPresolve::postsolve | ( | CoinPostsolveMatrix & | prob | ) | [protected, virtual] |
Postsolving is pretty generic; just apply the transformations in reverse order.
You will probably only be interested in overriding this method if you want to add code to test for consistency while debugging new presolve techniques.
virtual ClpSimplex* ClpPresolve::gutsOfPresolvedModel | ( | ClpSimplex * | originalModel, | |
double | feasibilityTolerance, | |||
bool | keepIntegers, | |||
int | numberPasses, | |||
bool | dropNames, | |||
bool | doRowObjective | |||
) | [protected, virtual] |
This is main part of Presolve.
ClpSimplex* ClpPresolve::originalModel_ [private] |
Original model - must not be destroyed before postsolve.
Definition at line 153 of file ClpPresolve.hpp.
ClpSimplex* ClpPresolve::presolvedModel_ [private] |
ClpPresolved model - up to user to destroy by deleteClpPresolvedModel.
Definition at line 156 of file ClpPresolve.hpp.
double ClpPresolve::nonLinearValue_ [private] |
"Magic" number.
If this is non-zero then any elements with this value may change and so presolve is very limited in what can be done to the row and column. This is for non-linear problems. One could also allow for cases where sign of coefficient is known.
Definition at line 162 of file ClpPresolve.hpp.
int* ClpPresolve::originalColumn_ [private] |
Original column numbers.
Definition at line 164 of file ClpPresolve.hpp.
int* ClpPresolve::originalRow_ [private] |
Original row numbers.
Definition at line 166 of file ClpPresolve.hpp.
double* ClpPresolve::rowObjective_ [private] |
Row objective.
Definition at line 168 of file ClpPresolve.hpp.
const CoinPresolveAction* ClpPresolve::paction_ [private] |
The list of transformations applied.
Definition at line 170 of file ClpPresolve.hpp.
int ClpPresolve::ncols_ [private] |
The postsolved problem will expand back to its former size as postsolve transformations are applied.
It is efficient to allocate data structures for the final size of the problem rather than expand them as needed. These fields give the size of the original problem.
Definition at line 177 of file ClpPresolve.hpp.
int ClpPresolve::nrows_ [private] |
Original model - must not be destroyed before postsolve.
Definition at line 178 of file ClpPresolve.hpp.
CoinBigIndex ClpPresolve::nelems_ [private] |
Original model - must not be destroyed before postsolve.
Definition at line 179 of file ClpPresolve.hpp.
int ClpPresolve::numberPasses_ [private] |
Number of major passes.
Definition at line 181 of file ClpPresolve.hpp.
int ClpPresolve::substitution_ [private] |
Substitution level.
Definition at line 183 of file ClpPresolve.hpp.
std::string ClpPresolve::saveFile_ [private] |
Name of saved model file.
Definition at line 186 of file ClpPresolve.hpp.
int ClpPresolve::presolveActions_ [private] |
Whether we want to skip dual part of presolve etc.
512 bit allows duplicate column processing on integer columns and dual stuff on integers
Definition at line 192 of file ClpPresolve.hpp.