Cgl
0.59.9
|
Gomory Reduce-and-Split Cut Generator Class; See method generateCuts(). More...
#include <CglRedSplit.hpp>
Public Member Functions | |
generateCuts | |
virtual void | generateCuts (const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo()) |
Generate Reduce-and-Split Mixed Integer Gomory cuts for the model of the solver interface si. More... | |
virtual bool | needsOptimalBasis () const |
Return true if needs optimal basis to do cuts (will return true) More... | |
Public Methods | |
void | setParam (const CglRedSplitParam &source) |
CglRedSplitParam | getParam () const |
void | compute_is_lub () |
void | compute_is_integer () |
void | set_given_optsol (const double *given_sol, const int card_sol) |
Set given_optsol to the given optimal solution given_sol. More... | |
void | print () const |
Print some of the data members. More... | |
void | printOptTab (OsiSolverInterface *solver) const |
Print the current simplex tableau. More... | |
Public Methods (soon to be obsolete) | |
void | setLimit (int limit) |
Set limit, the maximum number of non zero coefficients in generated cut; Default: 50. More... | |
int | getLimit () const |
Get value of limit. More... | |
void | setAway (double value) |
Set away, the minimum distance from being integer used for selecting rows for cut generation; all rows whose pivot variable should be integer but is more than away from integrality will be selected; Default: 0.05. More... | |
double | getAway () const |
Get value of away. More... | |
void | setLUB (double value) |
Set the value of LUB, value considered large for the absolute value of a lower or upper bound on a variable; Default: 1000. More... | |
double | getLUB () const |
Get the value of LUB. More... | |
void | setEPS (double value) |
Set the value of EPS, epsilon for double computations; Default: 1e-7. More... | |
double | getEPS () const |
Get the value of EPS. More... | |
void | setEPS_COEFF (double value) |
Set the value of EPS_COEFF, epsilon for values of coefficients; Default: 1e-8. More... | |
double | getEPS_COEFF () const |
Get the value of EPS_COEFF. More... | |
void | setEPS_COEFF_LUB (double value) |
Set the value of EPS_COEFF_LUB, epsilon for values of coefficients for variables with absolute value of lower or upper bound larger than LUB; Default: 1e-13. More... | |
double | getEPS_COEFF_LUB () const |
Get the value of EPS_COEFF_LUB. More... | |
void | setEPS_RELAX (double value) |
Set the value of EPS_RELAX, value used for relaxing the right hand side of each generated cut; Default: 1e-8. More... | |
double | getEPS_RELAX () const |
Get the value of EPS_RELAX. More... | |
void | setNormIsZero (double value) |
Set the value of normIsZero, the threshold for considering a norm to be 0; Default: 1e-5. More... | |
double | getNormIsZero () const |
Get the value of normIsZero. More... | |
void | setMinReduc (double value) |
Set the value of minReduc, threshold for relative norm improvement for performing a reduction; Default: 0.05. More... | |
double | getMinReduc () const |
Get the value of minReduc. More... | |
void | setMaxTab (double value) |
Set the maximum allowed value for (mTab * mTab * CoinMax(mTab, nTab)) where mTab is the number of rows used in the combinations and nTab is the number of continuous non basic variables. More... | |
double | getMaxTab () const |
Get the value of maxTab. More... | |
Constructors and destructors | |
CglRedSplit () | |
Default constructor. More... | |
CglRedSplit (const CglRedSplitParam &RS_param) | |
Constructor with specified parameters. More... | |
CglRedSplit (const CglRedSplit &) | |
Copy constructor. More... | |
virtual CglCutGenerator * | clone () const |
Clone. More... | |
CglRedSplit & | operator= (const CglRedSplit &rhs) |
Assignment operator. More... | |
virtual | ~CglRedSplit () |
Destructor. More... | |
virtual std::string | generateCpp (FILE *fp) |
Create C++ lines to get to current state. More... | |
![]() | |
CglCutGenerator () | |
Default constructor. More... | |
CglCutGenerator (const CglCutGenerator &) | |
Copy constructor. More... | |
CglCutGenerator & | operator= (const CglCutGenerator &rhs) |
Assignment operator. More... | |
virtual | ~CglCutGenerator () |
Destructor. More... | |
virtual void | refreshSolver (OsiSolverInterface *) |
This can be used to refresh any information. More... | |
int | getAggressiveness () const |
Get Aggressiveness - 0 = neutral, 100 is normal root node. More... | |
void | setAggressiveness (int value) |
Set Aggressiveness - 0 = neutral, 100 is normal root node. More... | |
void | setGlobalCuts (bool trueOrFalse) |
Set whether can do global cuts. More... | |
bool | canDoGlobalCuts () const |
Say whether can do global cuts. More... | |
virtual bool | mayGenerateRowCutsInTree () const |
Returns true if may generate Row cuts in tree (rather than root node). More... | |
virtual int | maximumLengthOfCutInTree () const |
Return maximum length of cut in tree. More... | |
Friends | |
void | CglRedSplitUnitTest (const OsiSolverInterface *siP, const std::string mpdDir) |
A function that tests the methods in the CglRedSplit class. More... | |
Additional Inherited Members | |
![]() | |
int | aggressive_ |
Aggressiveness - 0 = neutral, 100 is normal root node. More... | |
bool | canDoGlobalCuts_ |
True if can do global cuts i.e. no general integers. More... | |
Gomory Reduce-and-Split Cut Generator Class; See method generateCuts().
Based on the paper by K. Anderson, G. Cornuejols, Yanjun Li, "Reduce-and-Split Cuts: Improving the Performance of Mixed Integer Gomory Cuts", Management Science 51 (2005).
Definition at line 26 of file CglRedSplit.hpp.
CglRedSplit::CglRedSplit | ( | ) |
Default constructor.
CglRedSplit::CglRedSplit | ( | const CglRedSplitParam & | RS_param | ) |
Constructor with specified parameters.
CglRedSplit::CglRedSplit | ( | const CglRedSplit & | ) |
Copy constructor.
|
virtual |
Destructor.
|
virtual |
Generate Reduce-and-Split Mixed Integer Gomory cuts for the model of the solver interface si.
Insert the generated cuts into OsiCuts cs.
Warning: This generator currently works only with the Lp solvers Clp or Cplex9.0 or higher. It requires access to the optimal tableau and optimal basis inverse and makes assumptions on the way slack variables are added by the solver. The Osi implementations for Clp and Cplex verify these assumptions.
When calling the generator, the solver interface si must contain an optimized problem and information related to the optimal basis must be available through the OsiSolverInterface methods (si->optimalBasisIsAvailable() must return 'true'). It is also essential that the integrality of structural variable i can be obtained using si->isInteger(i).
Reduce-and-Split cuts are variants of Gomory cuts: Starting from the current optimal tableau, linear combinations of the rows of the current optimal simplex tableau are used for generating Gomory cuts. The choice of the linear combinations is driven by the objective of reducing the coefficients of the non basic continuous variables in the resulting row. Note that this generator might not be able to generate cuts for some solutions violating integrality constraints.
Implements CglCutGenerator.
|
virtual |
Return true if needs optimal basis to do cuts (will return true)
Reimplemented from CglCutGenerator.
void CglRedSplit::setParam | ( | const CglRedSplitParam & | source | ) |
|
inline |
Definition at line 75 of file CglRedSplit.hpp.
void CglRedSplit::compute_is_lub | ( | ) |
void CglRedSplit::compute_is_integer | ( | ) |
void CglRedSplit::set_given_optsol | ( | const double * | given_sol, |
const int | card_sol | ||
) |
Set given_optsol to the given optimal solution given_sol.
If given_optsol is set using this method, the code will stop as soon as a generated cut is violated by the given solution; exclusively for debugging purposes.
void CglRedSplit::print | ( | ) | const |
Print some of the data members.
void CglRedSplit::printOptTab | ( | OsiSolverInterface * | solver | ) | const |
Print the current simplex tableau.
void CglRedSplit::setLimit | ( | int | limit | ) |
Set limit, the maximum number of non zero coefficients in generated cut; Default: 50.
int CglRedSplit::getLimit | ( | ) | const |
Get value of limit.
void CglRedSplit::setAway | ( | double | value | ) |
Set away, the minimum distance from being integer used for selecting rows for cut generation; all rows whose pivot variable should be integer but is more than away from integrality will be selected; Default: 0.05.
double CglRedSplit::getAway | ( | ) | const |
Get value of away.
void CglRedSplit::setLUB | ( | double | value | ) |
Set the value of LUB, value considered large for the absolute value of a lower or upper bound on a variable; Default: 1000.
double CglRedSplit::getLUB | ( | ) | const |
Get the value of LUB.
void CglRedSplit::setEPS | ( | double | value | ) |
Set the value of EPS, epsilon for double computations; Default: 1e-7.
double CglRedSplit::getEPS | ( | ) | const |
Get the value of EPS.
void CglRedSplit::setEPS_COEFF | ( | double | value | ) |
Set the value of EPS_COEFF, epsilon for values of coefficients; Default: 1e-8.
double CglRedSplit::getEPS_COEFF | ( | ) | const |
Get the value of EPS_COEFF.
void CglRedSplit::setEPS_COEFF_LUB | ( | double | value | ) |
Set the value of EPS_COEFF_LUB, epsilon for values of coefficients for variables with absolute value of lower or upper bound larger than LUB; Default: 1e-13.
double CglRedSplit::getEPS_COEFF_LUB | ( | ) | const |
Get the value of EPS_COEFF_LUB.
void CglRedSplit::setEPS_RELAX | ( | double | value | ) |
Set the value of EPS_RELAX, value used for relaxing the right hand side of each generated cut; Default: 1e-8.
double CglRedSplit::getEPS_RELAX | ( | ) | const |
Get the value of EPS_RELAX.
void CglRedSplit::setNormIsZero | ( | double | value | ) |
Set the value of normIsZero, the threshold for considering a norm to be 0; Default: 1e-5.
double CglRedSplit::getNormIsZero | ( | ) | const |
Get the value of normIsZero.
void CglRedSplit::setMinReduc | ( | double | value | ) |
Set the value of minReduc, threshold for relative norm improvement for performing a reduction; Default: 0.05.
double CglRedSplit::getMinReduc | ( | ) | const |
Get the value of minReduc.
void CglRedSplit::setMaxTab | ( | double | value | ) |
Set the maximum allowed value for (mTab * mTab * CoinMax(mTab, nTab)) where mTab is the number of rows used in the combinations and nTab is the number of continuous non basic variables.
The work of the generator is proportional to (mTab * mTab * CoinMax(mTab, nTab)). Reducing the value of maxTab makes the generator faster, but weaker. Default: 1e7.
double CglRedSplit::getMaxTab | ( | ) | const |
Get the value of maxTab.
|
virtual |
Clone.
Implements CglCutGenerator.
CglRedSplit& CglRedSplit::operator= | ( | const CglRedSplit & | rhs | ) |
Assignment operator.
|
virtual |
Create C++ lines to get to current state.
Reimplemented from CglCutGenerator.
|
friend |
A function that tests the methods in the CglRedSplit class.
The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging.