Cgl
trunk
|
#include <CglLandPSimplex.hpp>
Public Member Functions | |
CglLandPSimplex (const OsiSolverInterface &si, const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms, const Validator &validator) | |
Usefull onstructor. | |
~CglLandPSimplex () | |
Destructor. | |
void | cacheUpdate (const CglLandP::CachedData &cached, bool reducedSpace=0) |
Update cached information in case of basis change in a round. | |
bool | resetSolver (const CoinWarmStartBasis *basis) |
reset the solver to optimal basis | |
bool | optimize (int var, OsiRowCut &cut, const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms) |
Perfom pivots to find the best cuts. | |
bool | generateMig (int row, OsiRowCut &cut, const CglLandP::Parameters ¶ms) const |
Find Gomory cut (i.e. | |
int | generateExtraCuts (const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms) |
Find extra constraints in current tableau. | |
int | generateExtraCut (int i, const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms) |
Generate a constrainte for a row of the tableau different from the source row. | |
void | genThisBasisMigs (const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms) |
int | insertAllExtr (OsiCuts &cs, CoinRelFltEq eq) |
insert all extra cuts in cs. | |
void | setLogLevel (int level) |
void | setSi (OsiSolverInterface *si) |
void | freeSi () |
Cuts & | extraCuts () |
void | loadBasis (const OsiSolverInterface &si, std::vector< int > &M1, std::vector< int > &M2, int k) |
int | getNumCols () const |
int | getNumRows () const |
const CoinWarmStartBasis * | getBasis () const |
const int * | getNonBasics () const |
const int * | getBasics () const |
void | outPivInfo (int ncuts) |
Protected Member Functions | |
bool | changeBasis (int incoming, int leaving, int direction, bool modularize) |
Perform a change in the basis (direction is 1 if leaving variable is going to ub, 0 otherwise) | |
int | fastFindCutImprovingPivotRow (int &direction, int &gammaSign, double tolerance, bool flagPositiveRows) |
Find a row which can be used to perform an improving pivot the fast way (i.e., find the leaving variable). | |
int | rescanReducedCosts (int &direction, int &gammaSign, double tolerance) |
Rescan reduced costs tables. | |
int | fastFindBestPivotColumn (int direction, int gammaSign, double pivotTol, double rhsTol, bool reducedSpace, bool allowNonImproving, double &bestSigma, bool modularize) |
Find the column which leads to the best cut (i.e., find incoming variable). | |
int | findBestPivot (int &leaving, int &direction, const CglLandP::Parameters ¶ms) |
Find incoming and leaving variables which lead to the most violated adjacent normalized lift-and-project cut. | |
double | computeCglpObjective (const TabRow &row, bool modularize=false) const |
Compute the objective value of the Cglp for given row and rhs (if strengthening shall be applied row should have been modularized). | |
double | strengthenedIntersectionCutCoef (int i, double alpha_i, double beta) const |
return the coefficients of the strengthened intersection cut takes one extra argument seens needs to consider variable type. | |
double | newRowCoefficient (int j, double gamma) const |
return the coefficient of the new row (combining row_k + gamma row_i). | |
void | createIntersectionCut (TabRow &row, OsiRowCut &cut) const |
Create the intersection cut of row k. | |
double | normalizationFactor (const TabRow &row) const |
Compute the normalization factor of the cut. | |
void | scaleCut (OsiRowCut &cut, double factor) const |
Scale the cut by factor. | |
void | createMIG (TabRow &row, OsiRowCut &cut) const |
Create strenghtened row. | |
void | pullTableauRow (TabRow &row) const |
Get the row i of the tableau. | |
void | adjustTableauRow (int var, TabRow &row, int direction) |
Adjust the row of the tableau to reflect leaving variable direction. | |
void | resetOriginalTableauRow (int var, TabRow &row, int direction) |
reset the tableau row after a call to adjustTableauRow | |
double | getLoBound (int index) const |
Get lower bound for variable or constraint. | |
double | getUpBound (int index) const |
Get upper bound for variable or constraint. | |
double | getColsolToCut (int index) const |
Access to value in solution to cut (indexed in reduced problem) | |
bool | isGtConst (int index) const |
void | setColsolToCut (int index, double value) |
Access to value in solution to cut (indexed in reduced problem) | |
CoinWarmStartBasis::Status | getStatus (int index) const |
Get the basic status of a variable (structural or slack). | |
bool | isInteger (int index) const |
Say if variable index by i in current tableau is integer. | |
void | computeWeights (CglLandP::LHSnorm norm, CglLandP::Normalization type, CglLandP::RhsWeightType rhs) |
Compute normalization weights. | |
double | normedCoef (double a, int ii) const |
Evenutaly multiply a by w if normed_weights_ is not empty. | |
void | printTableau (std::ostream &os) |
print the tableau of current basis. | |
void | printEverything () |
Print everything . | |
void | printTableauLateX (std::ostream &os) |
print the tableau of current basis. | |
void | printRowLateX (std::ostream &os, int i) |
void | printCutLateX (std::ostream &os, int i) |
void | printCglpBasis (std::ostream &os=std::cout) |
Print CGLP basis corresponding to current tableau and source row. | |
void | get_M1_M2_M3 (const TabRow &row, std::vector< int > &M1, std::vector< int > &M2, std::vector< int > &M3) |
Put variables in M1 M2 and M3 according to their sign. | |
void | eliminate_slacks (double *vec) const |
Put a vector in structural sapce. | |
Slow versions of the function (old versions do not work). | |
double | computeCglpRedCost (int direction, int gammaSign, double tau) |
Compute the reduced cost of Cglp. | |
double | computeRedCostConstantsInRow () |
Compute the value of sigma and thau (which are constants for a row i as defined in Mike Perregaard thesis. | |
double | computeCglpObjective (double gamma, bool strengthen, TabRow &row) |
Compute the objective value of the Cglp with linear combintation of the two rows by gamma. | |
double | computeCglpObjective (double gamma, bool strengthen) |
Compute the objective value of the Cglp with linear combintation of the row_k_ and gamma row_i_. | |
int | findCutImprovingPivotRow (int &direction, int &gammaSign, double tolerance) |
Find a row which can be used to perform an improving pivot return index of the cut or -1 if none exists (i.e., find the leaving variable). | |
int | findBestPivotColumn (int direction, double pivotTol, bool reducedSpace, bool allowDegeneratePivot, bool modularize) |
Find the column which leads to the best cut (i.e., find incoming variable). | |
int | plotCGLPobj (int direction, double gammaTolerance, double pivotTol, bool reducedSpace, bool allowDegenerate, bool modularize) |
Definition at line 42 of file CglLandPSimplex.hpp.
LAP::CglLandPSimplex::CglLandPSimplex | ( | const OsiSolverInterface & | si, |
const CglLandP::CachedData & | cached, | ||
const CglLandP::Parameters & | params, | ||
const Validator & | validator | ||
) |
Usefull onstructor.
Destructor.
void LAP::CglLandPSimplex::cacheUpdate | ( | const CglLandP::CachedData & | cached, |
bool | reducedSpace = 0 |
||
) |
Update cached information in case of basis change in a round.
bool LAP::CglLandPSimplex::resetSolver | ( | const CoinWarmStartBasis * | basis | ) |
reset the solver to optimal basis
bool LAP::CglLandPSimplex::optimize | ( | int | var, |
OsiRowCut & | cut, | ||
const CglLandP::CachedData & | cached, | ||
const CglLandP::Parameters & | params | ||
) |
Perfom pivots to find the best cuts.
bool LAP::CglLandPSimplex::generateMig | ( | int | row, |
OsiRowCut & | cut, | ||
const CglLandP::Parameters & | params | ||
) | const |
Find Gomory cut (i.e.
don't do extra setup required for pivots).
int LAP::CglLandPSimplex::generateExtraCuts | ( | const CglLandP::CachedData & | cached, |
const CglLandP::Parameters & | params | ||
) |
Find extra constraints in current tableau.
int LAP::CglLandPSimplex::generateExtraCut | ( | int | i, |
const CglLandP::CachedData & | cached, | ||
const CglLandP::Parameters & | params | ||
) |
Generate a constrainte for a row of the tableau different from the source row.
void LAP::CglLandPSimplex::genThisBasisMigs | ( | const CglLandP::CachedData & | cached, |
const CglLandP::Parameters & | params | ||
) |
int LAP::CglLandPSimplex::insertAllExtr | ( | OsiCuts & | cs, |
CoinRelFltEq | eq | ||
) |
insert all extra cuts in cs.
void LAP::CglLandPSimplex::setLogLevel | ( | int | level | ) | [inline] |
Definition at line 73 of file CglLandPSimplex.hpp.
void LAP::CglLandPSimplex::setSi | ( | OsiSolverInterface * | si | ) | [inline] |
Definition at line 79 of file CglLandPSimplex.hpp.
void LAP::CglLandPSimplex::freeSi | ( | ) | [inline] |
Definition at line 90 of file CglLandPSimplex.hpp.
Cuts& LAP::CglLandPSimplex::extraCuts | ( | ) | [inline] |
Definition at line 100 of file CglLandPSimplex.hpp.
void LAP::CglLandPSimplex::loadBasis | ( | const OsiSolverInterface & | si, |
std::vector< int > & | M1, | ||
std::vector< int > & | M2, | ||
int | k | ||
) |
int LAP::CglLandPSimplex::getNumCols | ( | ) | const [inline] |
Definition at line 109 of file CglLandPSimplex.hpp.
int LAP::CglLandPSimplex::getNumRows | ( | ) | const [inline] |
Definition at line 114 of file CglLandPSimplex.hpp.
const CoinWarmStartBasis* LAP::CglLandPSimplex::getBasis | ( | ) | const [inline] |
Definition at line 119 of file CglLandPSimplex.hpp.
const int* LAP::CglLandPSimplex::getNonBasics | ( | ) | const [inline] |
Definition at line 123 of file CglLandPSimplex.hpp.
const int* LAP::CglLandPSimplex::getBasics | ( | ) | const [inline] |
Definition at line 128 of file CglLandPSimplex.hpp.
void LAP::CglLandPSimplex::outPivInfo | ( | int | ncuts | ) | [inline] |
Definition at line 133 of file CglLandPSimplex.hpp.
bool LAP::CglLandPSimplex::changeBasis | ( | int | incoming, |
int | leaving, | ||
int | direction, | ||
bool | modularize | ||
) | [protected] |
Perform a change in the basis (direction is 1 if leaving variable is going to ub, 0 otherwise)
int LAP::CglLandPSimplex::fastFindCutImprovingPivotRow | ( | int & | direction, |
int & | gammaSign, | ||
double | tolerance, | ||
bool | flagPositiveRows | ||
) | [protected] |
Find a row which can be used to perform an improving pivot the fast way (i.e., find the leaving variable).
int LAP::CglLandPSimplex::rescanReducedCosts | ( | int & | direction, |
int & | gammaSign, | ||
double | tolerance | ||
) | [protected] |
Rescan reduced costs tables.
int LAP::CglLandPSimplex::fastFindBestPivotColumn | ( | int | direction, |
int | gammaSign, | ||
double | pivotTol, | ||
double | rhsTol, | ||
bool | reducedSpace, | ||
bool | allowNonImproving, | ||
double & | bestSigma, | ||
bool | modularize | ||
) | [protected] |
Find the column which leads to the best cut (i.e., find incoming variable).
int LAP::CglLandPSimplex::findBestPivot | ( | int & | leaving, |
int & | direction, | ||
const CglLandP::Parameters & | params | ||
) | [protected] |
Find incoming and leaving variables which lead to the most violated adjacent normalized lift-and-project cut.
leaving | variable |
direction | leaving direction |
double LAP::CglLandPSimplex::computeCglpObjective | ( | const TabRow & | row, |
bool | modularize = false |
||
) | const [protected] |
Compute the objective value of the Cglp for given row and rhs (if strengthening shall be applied row should have been modularized).
double LAP::CglLandPSimplex::strengthenedIntersectionCutCoef | ( | int | i, |
double | alpha_i, | ||
double | beta | ||
) | const [inline, protected] |
return the coefficients of the strengthened intersection cut takes one extra argument seens needs to consider variable type.
return the coefficients of the strengthened intersection cut
Definition at line 426 of file CglLandPSimplex.hpp.
double LAP::CglLandPSimplex::newRowCoefficient | ( | int | j, |
double | gamma | ||
) | const [inline, protected] |
return the coefficient of the new row (combining row_k + gamma row_i).
Definition at line 444 of file CglLandPSimplex.hpp.
void LAP::CglLandPSimplex::createIntersectionCut | ( | TabRow & | row, |
OsiRowCut & | cut | ||
) | const [protected] |
Create the intersection cut of row k.
double LAP::CglLandPSimplex::normalizationFactor | ( | const TabRow & | row | ) | const [protected] |
Compute the normalization factor of the cut.
void LAP::CglLandPSimplex::scaleCut | ( | OsiRowCut & | cut, |
double | factor | ||
) | const [protected] |
Scale the cut by factor.
void LAP::CglLandPSimplex::createMIG | ( | TabRow & | row, |
OsiRowCut & | cut | ||
) | const [protected] |
Create strenghtened row.
Create MIG cut from row k
void LAP::CglLandPSimplex::pullTableauRow | ( | TabRow & | row | ) | const [protected] |
Get the row i of the tableau.
void LAP::CglLandPSimplex::adjustTableauRow | ( | int | var, |
TabRow & | row, | ||
int | direction | ||
) | [protected] |
Adjust the row of the tableau to reflect leaving variable direction.
void LAP::CglLandPSimplex::resetOriginalTableauRow | ( | int | var, |
TabRow & | row, | ||
int | direction | ||
) | [protected] |
reset the tableau row after a call to adjustTableauRow
double LAP::CglLandPSimplex::getLoBound | ( | int | index | ) | const [inline, protected] |
Get lower bound for variable or constraint.
Definition at line 205 of file CglLandPSimplex.hpp.
double LAP::CglLandPSimplex::getUpBound | ( | int | index | ) | const [inline, protected] |
Get upper bound for variable or constraint.
Definition at line 210 of file CglLandPSimplex.hpp.
double LAP::CglLandPSimplex::getColsolToCut | ( | int | index | ) | const [inline, protected] |
Access to value in solution to cut (indexed in reduced problem)
Definition at line 215 of file CglLandPSimplex.hpp.
bool LAP::CglLandPSimplex::isGtConst | ( | int | index | ) | const [inline, protected] |
Definition at line 219 of file CglLandPSimplex.hpp.
void LAP::CglLandPSimplex::setColsolToCut | ( | int | index, |
double | value | ||
) | [inline, protected] |
Access to value in solution to cut (indexed in reduced problem)
Definition at line 224 of file CglLandPSimplex.hpp.
CoinWarmStartBasis::Status LAP::CglLandPSimplex::getStatus | ( | int | index | ) | const [inline, protected] |
Get the basic status of a variable (structural or slack).
Definition at line 229 of file CglLandPSimplex.hpp.
bool LAP::CglLandPSimplex::isInteger | ( | int | index | ) | const [inline, protected] |
Say if variable index by i in current tableau is integer.
Definition at line 235 of file CglLandPSimplex.hpp.
void LAP::CglLandPSimplex::computeWeights | ( | CglLandP::LHSnorm | norm, |
CglLandP::Normalization | type, | ||
CglLandP::RhsWeightType | rhs | ||
) | [protected] |
Compute normalization weights.
double LAP::CglLandPSimplex::normedCoef | ( | double | a, |
int | ii | ||
) | const [inline, protected] |
Evenutaly multiply a by w if normed_weights_ is not empty.
Definition at line 243 of file CglLandPSimplex.hpp.
void LAP::CglLandPSimplex::printTableau | ( | std::ostream & | os | ) | [protected] |
print the tableau of current basis.
void LAP::CglLandPSimplex::printEverything | ( | ) | [protected] |
Print everything .
void LAP::CglLandPSimplex::printTableauLateX | ( | std::ostream & | os | ) | [protected] |
print the tableau of current basis.
void LAP::CglLandPSimplex::printRowLateX | ( | std::ostream & | os, |
int | i | ||
) | [protected] |
void LAP::CglLandPSimplex::printCutLateX | ( | std::ostream & | os, |
int | i | ||
) | [protected] |
void LAP::CglLandPSimplex::printCglpBasis | ( | std::ostream & | os = std::cout | ) | [protected] |
Print CGLP basis corresponding to current tableau and source row.
void LAP::CglLandPSimplex::get_M1_M2_M3 | ( | const TabRow & | row, |
std::vector< int > & | M1, | ||
std::vector< int > & | M2, | ||
std::vector< int > & | M3 | ||
) | [protected] |
Put variables in M1 M2 and M3 according to their sign.
void LAP::CglLandPSimplex::eliminate_slacks | ( | double * | vec | ) | const [protected] |
Put a vector in structural sapce.
double LAP::CglLandPSimplex::computeCglpRedCost | ( | int | direction, |
int | gammaSign, | ||
double | tau | ||
) | [protected] |
Compute the reduced cost of Cglp.
double LAP::CglLandPSimplex::computeRedCostConstantsInRow | ( | ) | [protected] |
Compute the value of sigma and thau (which are constants for a row i as defined in Mike Perregaard thesis.
double LAP::CglLandPSimplex::computeCglpObjective | ( | double | gamma, |
bool | strengthen, | ||
TabRow & | row | ||
) | [protected] |
Compute the objective value of the Cglp with linear combintation of the two rows by gamma.
double LAP::CglLandPSimplex::computeCglpObjective | ( | double | gamma, |
bool | strengthen | ||
) | [protected] |
Compute the objective value of the Cglp with linear combintation of the row_k_ and gamma row_i_.
int LAP::CglLandPSimplex::findCutImprovingPivotRow | ( | int & | direction, |
int & | gammaSign, | ||
double | tolerance | ||
) | [protected] |
Find a row which can be used to perform an improving pivot return index of the cut or -1 if none exists (i.e., find the leaving variable).
int LAP::CglLandPSimplex::findBestPivotColumn | ( | int | direction, |
double | pivotTol, | ||
bool | reducedSpace, | ||
bool | allowDegeneratePivot, | ||
bool | modularize | ||
) | [protected] |
Find the column which leads to the best cut (i.e., find incoming variable).
int LAP::CglLandPSimplex::plotCGLPobj | ( | int | direction, |
double | gammaTolerance, | ||
double | pivotTol, | ||
bool | reducedSpace, | ||
bool | allowDegenerate, | ||
bool | modularize | ||
) | [protected] |