Dip
0.92.4
|
#include <CglLandPSimplex.hpp>
Public Member Functions | |
CglLandPSimplex (const OsiSolverInterface &si, const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms, Validator &validator) | |
Usefull onstructor. More... | |
~CglLandPSimplex () | |
Destructor. More... | |
void | cacheUpdate (const CglLandP::CachedData &cached, bool reducedSpace=0) |
Update cached information in case of basis change in a round. More... | |
bool | resetSolver (const CoinWarmStartBasis *basis) |
reset the solver to optimal basis More... | |
bool | optimize (int var, OsiRowCut &cut, const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms) |
Perfom pivots to find the best cuts. More... | |
bool | generateMig (int row, OsiRowCut &cut, const CglLandP::Parameters ¶ms) |
Find Gomory cut (i.e. More... | |
int | generateExtraCuts (const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms) |
Find extra constraints in current tableau. More... | |
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. More... | |
void | genThisBasisMigs (const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms) |
int | insertAllExtr (OsiCuts &cs, CoinRelFltEq eq) |
insert all extra cuts in cs. More... | |
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) More... | |
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). More... | |
int | rescanReducedCosts (int &direction, int &gammaSign, double tolerance) |
Rescan reduced costs tables. More... | |
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). More... | |
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. More... | |
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). More... | |
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. More... | |
double | newRowCoefficient (int j, double gamma) const |
return the coefficient of the new row (combining row_k + gamma row_i). More... | |
void | createIntersectionCut (TabRow &row, OsiRowCut &cut) const |
Create the intersection cut of row k. More... | |
double | normalizationFactor (const TabRow &row) const |
Compute the normalization factor of the cut. More... | |
void | scaleCut (OsiRowCut &cut, double factor) const |
Scale the cut by factor. More... | |
void | createMIG (TabRow &row, OsiRowCut &cut) const |
Create strenghtened row. More... | |
void | pullTableauRow (TabRow &row) const |
Get the row i of the tableau. More... | |
void | adjustTableauRow (int var, TabRow &row, int direction) |
Adjust the row of the tableau to reflect leaving variable direction. More... | |
void | resetOriginalTableauRow (int var, TabRow &row, int direction) |
reset the tableau row after a call to adjustTableauRow More... | |
double | getLoBound (int index) const |
Get lower bound for variable or constraint. More... | |
double | getUpBound (int index) const |
Get upper bound for variable or constraint. More... | |
double | getColsolToCut (int index) const |
Access to value in solution to cut (indexed in reduced problem) More... | |
bool | isGtConst (int index) const |
void | setColsolToCut (int index, double value) |
Access to value in solution to cut (indexed in reduced problem) More... | |
CoinWarmStartBasis::Status | getStatus (int index) const |
Get the basic status of a variable (structural or slack). More... | |
bool | isInteger (int index) const |
Say if variable index by i in current tableau is integer. More... | |
void | computeWeights (CglLandP::LHSnorm norm, CglLandP::Normalization type, CglLandP::RhsWeightType rhs) |
Compute normalization weights. More... | |
double | normedCoef (double a, int ii) const |
Evenutaly multiply a by w if normed_weights_ is not empty. More... | |
void | printTableau (std::ostream &os) |
print the tableau of current basis. More... | |
void | printEverything () |
Print everything . More... | |
void | printTableauLateX (std::ostream &os) |
print the tableau of current basis. More... | |
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. More... | |
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. More... | |
void | eliminate_slacks (double *vec) const |
Put a vector in structural sapce. More... | |
Slow versions of the function (old versions do not work). | |
double | computeCglpRedCost (int direction, int gammaSign, double tau) |
Compute the reduced cost of Cglp. More... | |
double | computeRedCostConstantsInRow () |
Compute the value of sigma and thau (which are constants for a row i as defined in Mike Perregaard thesis. More... | |
double | computeCglpObjective (double gamma, bool strengthen, TabRow &row) |
Compute the objective value of the Cglp with linear combintation of the two rows by gamma. More... | |
double | computeCglpObjective (double gamma, bool strengthen) |
Compute the objective value of the Cglp with linear combintation of the row_k_ and gamma row_i_. More... | |
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). More... | |
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). More... | |
int | plotCGLPobj (int direction, double gammaTolerance, double pivotTol, bool reducedSpace, bool allowDegenerate, bool modularize) |
Compute the reduced cost of Cglp. More... | |
Private Member Functions | |
CglLandPSimplex () | |
No default constructor. More... | |
CglLandPSimplex (const CglLandPSimplex &) | |
No copy constructor. More... | |
CglLandPSimplex & | operator= (const CglLandPSimplex &) |
No assignment operator. More... | |
void | updateM1_M2_M3 (TabRow &row, double tolerance, bool alwaysComputeCheap) |
Update values in M1 M2 and M3 before an iteration. More... | |
void | removeRows (int nDelete, const int *rowsIdx) |
Remove rows from current tableau. More... | |
void | compute_p_q_r_s (double gamma, int gammaSign, double &p, double &q, double &r, double &s) |
bool | checkBasis () |
Check that the basis is correct. More... | |
Private Attributes | |
bool | own_ |
Own the data or not? More... | |
Validator & | validator_ |
A pointer to a cut validator. More... | |
std::vector< double > | norm_weights_ |
Weights for the normalization constraint. More... | |
double | rhs_weight_ |
Weight for rhs of normalization constraint.*/. More... | |
int | nNegativeRcRows_ |
number of rows with a <0 rc in current iteration More... | |
int | numPivots_ |
Record the number of pivots. More... | |
int | numSourceRowEntered_ |
Record the number of times the source row entered the basis. More... | |
int | numIncreased_ |
Record the number of times that sigma increased. More... | |
CoinMessageHandler * | handler_ |
Message handler. More... | |
CoinMessages | messages_ |
Messages. More... | |
double | bestSigma_ |
Work infos | |
TabRow | row_k_ |
Source row for cut. More... | |
TabRow | original_row_k_ |
Original version of source row (without modularization). More... | |
TabRow | row_i_ |
Row of leaving candidate. More... | |
TabRow | new_row_ |
Source row for cut. More... | |
CoinPackedVector | gammas_ |
vector to sort the gammas More... | |
std::vector< double > | rWk1_ |
first work vector in row space. More... | |
std::vector< double > | rWk2_ |
scond work vector in row space. More... | |
std::vector< double > | rWk3_ |
third work vector in row space. More... | |
std::vector< double > | rWk4_ |
fourth work vector in row space. More... | |
std::vector< int > | rIntWork_ |
integer valued work vector on the rows More... | |
bool * | rowFlags_ |
Flag rows which we don't want to try anymore. More... | |
std::vector< bool > | col_in_subspace |
Flag columns which are in the subspace (usualy remove nonbasic structurals in subspace) More... | |
bool * | colCandidateToLeave_ |
Flag columns which have to be considered for leaving the basis. More... | |
int * | basics_ |
Store the basics variable. More... | |
int * | nonBasics_ |
Stores the nonBasicVariables. More... | |
std::vector< int > | M1_ |
Stores the variables which are always in M1 for a given k. More... | |
std::vector< int > | M2_ |
Stores the variables which are always in M2 for a given k. More... | |
std::vector< int > | M3_ |
Stores the variables which could be either in M1 or M2. More... | |
double | sigma_ |
stores the cglp value of the normalized cut obtained from row k_ More... | |
CoinWarmStartBasis * | basis_ |
Keep track of basis status. More... | |
double * | colsolToCut_ |
Pointer to the solution to cut (need to be modified after each pivot because we are only considering slacks). More... | |
double * | colsol_ |
Pointer to the current basic solution. More... | |
int | ncols_orig_ |
cached numcols in original problem More... | |
int | nrows_orig_ |
cached numrows in original problem More... | |
int | ncols_ |
cached number of columns in reduced size problem More... | |
int | nrows_ |
Cached number of rows in reduced size problem. More... | |
std::vector< double > | lo_bounds_ |
Source row for cut. More... | |
std::vector< double > | up_bounds_ |
Source row for cut. More... | |
bool | inDegenerateSequence_ |
Say if we are in a sequence of degenerate pivots. More... | |
double | chosenReducedCostVal_ |
Value for the reduced cost chosen for pivoting. More... | |
const bool * | integers_ |
pointer to array of integer info for both structural and slacks More... | |
std::vector< int > | original_index_ |
Original index of variable before deletions. More... | |
Cuts | cuts_ |
Stores extra cuts which are generated along the procedure. More... | |
Interfaces to the solver | |
OsiSolverInterface * | si_ |
Pointer to the solver interface. More... | |
Definition at line 42 of file CglLandPSimplex.hpp.
LAP::CglLandPSimplex::CglLandPSimplex | ( | const OsiSolverInterface & | si, |
const CglLandP::CachedData & | cached, | ||
const CglLandP::Parameters & | params, | ||
Validator & | validator | ||
) |
Usefull onstructor.
LAP::CglLandPSimplex::~CglLandPSimplex | ( | ) |
Destructor.
|
private |
No default constructor.
|
private |
No copy constructor.
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 | ||
) |
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.
|
inline |
Definition at line 73 of file CglLandPSimplex.hpp.
References handler_, and CoinMessageHandler::setLogLevel().
|
inline |
Definition at line 79 of file CglLandPSimplex.hpp.
References si_.
|
inline |
Definition at line 90 of file CglLandPSimplex.hpp.
References si_.
|
inline |
Definition at line 100 of file CglLandPSimplex.hpp.
References cuts_.
void LAP::CglLandPSimplex::loadBasis | ( | const OsiSolverInterface & | si, |
std::vector< int > & | M1, | ||
std::vector< int > & | M2, | ||
int | k | ||
) |
|
inline |
Definition at line 109 of file CglLandPSimplex.hpp.
References ncols_.
|
inline |
Definition at line 114 of file CglLandPSimplex.hpp.
References nrows_.
|
inline |
Definition at line 119 of file CglLandPSimplex.hpp.
References basis_.
|
inline |
Definition at line 123 of file CglLandPSimplex.hpp.
References nonBasics_.
|
inline |
Definition at line 128 of file CglLandPSimplex.hpp.
References basics_.
|
inline |
Definition at line 133 of file CglLandPSimplex.hpp.
References CoinMessageEol, handler_, CoinMessageHandler::message(), messages_, numIncreased_, numPivots_, numSourceRowEntered_, and LAP::RoundStats.
|
protected |
Perform a change in the basis (direction is 1 if leaving variable is going to ub, 0 otherwise)
|
protected |
Find a row which can be used to perform an improving pivot the fast way (i.e., find the leaving variable).
|
protected |
Rescan reduced costs tables.
|
protected |
Find the column which leads to the best cut (i.e., find incoming variable).
|
protected |
Find incoming and leaving variables which lead to the most violated adjacent normalized lift-and-project cut.
leaving | variable |
direction | leaving direction |
|
protected |
Compute the objective value of the Cglp for given row and rhs (if strengthening shall be applied row should have been modularized).
|
inlineprotected |
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.
References integers_, and LAP::intersectionCutCoef().
|
inlineprotected |
return the coefficient of the new row (combining row_k + gamma row_i).
Definition at line 444 of file CglLandPSimplex.hpp.
Create the intersection cut of row k.
|
protected |
Compute the normalization factor of the cut.
|
protected |
Scale the cut by factor.
Create strenghtened row.
Create MIG cut from row k
|
protected |
Get the row i of the tableau.
|
protected |
Adjust the row of the tableau to reflect leaving variable direction.
|
protected |
reset the tableau row after a call to adjustTableauRow
|
inlineprotected |
Get lower bound for variable or constraint.
Definition at line 205 of file CglLandPSimplex.hpp.
References lo_bounds_, and original_index_.
|
inlineprotected |
Get upper bound for variable or constraint.
Definition at line 210 of file CglLandPSimplex.hpp.
References original_index_, and up_bounds_.
|
inlineprotected |
Access to value in solution to cut (indexed in reduced problem)
Definition at line 215 of file CglLandPSimplex.hpp.
References colsolToCut_, and original_index_.
|
inlineprotected |
Definition at line 219 of file CglLandPSimplex.hpp.
References lo_bounds_, ncols_, original_index_, and up_bounds_.
|
inlineprotected |
Access to value in solution to cut (indexed in reduced problem)
Definition at line 224 of file CglLandPSimplex.hpp.
References colsolToCut_, and original_index_.
|
inlineprotected |
Get the basic status of a variable (structural or slack).
Definition at line 229 of file CglLandPSimplex.hpp.
References basis_, CoinWarmStartBasis::getArtifStatus(), CoinWarmStartBasis::getStructStatus(), and ncols_.
|
inlineprotected |
Say if variable index by i in current tableau is integer.
Definition at line 235 of file CglLandPSimplex.hpp.
References integers_, and original_index_.
|
protected |
Compute normalization weights.
|
inlineprotected |
Evenutaly multiply a by w if normed_weights_ is not empty.
Definition at line 243 of file CglLandPSimplex.hpp.
References norm_weights_.
|
protected |
print the tableau of current basis.
|
protected |
Print everything .
|
protected |
print the tableau of current basis.
|
protected |
|
protected |
|
protected |
Print CGLP basis corresponding to current tableau and source row.
|
protected |
Put variables in M1 M2 and M3 according to their sign.
|
protected |
Put a vector in structural sapce.
|
private |
No assignment operator.
|
private |
Update values in M1 M2 and M3 before an iteration.
|
private |
Remove rows from current tableau.
|
private |
|
private |
Check that the basis is correct.
|
protected |
Compute the reduced cost of Cglp.
|
protected |
Compute the value of sigma and thau (which are constants for a row i as defined in Mike Perregaard thesis.
|
protected |
Compute the objective value of the Cglp with linear combintation of the two rows by gamma.
|
protected |
Compute the objective value of the Cglp with linear combintation of the row_k_ and gamma row_i_.
|
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).
|
protected |
Find the column which leads to the best cut (i.e., find incoming variable).
|
protected |
Compute the reduced cost of Cglp.
|
private |
Source row for cut.
Definition at line 297 of file CglLandPSimplex.hpp.
Referenced by newRowCoefficient().
|
private |
Original version of source row (without modularization).
Definition at line 299 of file CglLandPSimplex.hpp.
|
private |
Row of leaving candidate.
Definition at line 301 of file CglLandPSimplex.hpp.
Referenced by newRowCoefficient().
|
private |
Source row for cut.
Definition at line 303 of file CglLandPSimplex.hpp.
|
private |
vector to sort the gammas
Definition at line 306 of file CglLandPSimplex.hpp.
|
private |
first work vector in row space.
Definition at line 308 of file CglLandPSimplex.hpp.
|
private |
scond work vector in row space.
Definition at line 310 of file CglLandPSimplex.hpp.
|
private |
third work vector in row space.
Definition at line 312 of file CglLandPSimplex.hpp.
|
private |
fourth work vector in row space.
Definition at line 314 of file CglLandPSimplex.hpp.
|
private |
integer valued work vector on the rows
Definition at line 316 of file CglLandPSimplex.hpp.
|
private |
Flag rows which we don't want to try anymore.
Definition at line 318 of file CglLandPSimplex.hpp.
|
private |
Flag columns which are in the subspace (usualy remove nonbasic structurals in subspace)
Definition at line 320 of file CglLandPSimplex.hpp.
|
private |
Flag columns which have to be considered for leaving the basis.
Definition at line 322 of file CglLandPSimplex.hpp.
|
private |
Store the basics variable.
Definition at line 324 of file CglLandPSimplex.hpp.
Referenced by getBasics().
|
private |
Stores the nonBasicVariables.
Definition at line 326 of file CglLandPSimplex.hpp.
Referenced by getNonBasics().
|
private |
Stores the variables which are always in M1 for a given k.
Definition at line 328 of file CglLandPSimplex.hpp.
|
private |
Stores the variables which are always in M2 for a given k.
Definition at line 330 of file CglLandPSimplex.hpp.
|
private |
Stores the variables which could be either in M1 or M2.
Definition at line 332 of file CglLandPSimplex.hpp.
|
private |
stores the cglp value of the normalized cut obtained from row k_
Definition at line 334 of file CglLandPSimplex.hpp.
|
private |
Keep track of basis status.
Definition at line 336 of file CglLandPSimplex.hpp.
Referenced by getBasis(), and getStatus().
|
private |
Pointer to the solution to cut (need to be modified after each pivot because we are only considering slacks).
Definition at line 338 of file CglLandPSimplex.hpp.
Referenced by getColsolToCut(), and setColsolToCut().
|
private |
Pointer to the current basic solution.
Definition at line 340 of file CglLandPSimplex.hpp.
|
private |
cached numcols in original problem
Definition at line 342 of file CglLandPSimplex.hpp.
|
private |
cached numrows in original problem
Definition at line 344 of file CglLandPSimplex.hpp.
|
private |
cached number of columns in reduced size problem
Definition at line 346 of file CglLandPSimplex.hpp.
Referenced by getNumCols(), getStatus(), and isGtConst().
|
private |
Cached number of rows in reduced size problem.
Definition at line 348 of file CglLandPSimplex.hpp.
Referenced by getNumRows().
|
private |
Source row for cut.
Definition at line 350 of file CglLandPSimplex.hpp.
Referenced by getLoBound(), and isGtConst().
|
private |
Source row for cut.
Definition at line 352 of file CglLandPSimplex.hpp.
Referenced by getUpBound(), and isGtConst().
|
private |
Say if we are in a sequence of degenerate pivots.
Definition at line 354 of file CglLandPSimplex.hpp.
|
private |
Value for the reduced cost chosen for pivoting.
Definition at line 356 of file CglLandPSimplex.hpp.
|
private |
pointer to array of integer info for both structural and slacks
Definition at line 358 of file CglLandPSimplex.hpp.
Referenced by isInteger(), and strengthenedIntersectionCutCoef().
|
private |
Original index of variable before deletions.
Definition at line 360 of file CglLandPSimplex.hpp.
Referenced by getColsolToCut(), getLoBound(), getUpBound(), isGtConst(), isInteger(), and setColsolToCut().
|
private |
Stores extra cuts which are generated along the procedure.
Definition at line 362 of file CglLandPSimplex.hpp.
Referenced by extraCuts().
|
private |
Pointer to the solver interface.
Definition at line 367 of file CglLandPSimplex.hpp.
|
private |
Own the data or not?
Definition at line 370 of file CglLandPSimplex.hpp.
|
private |
A pointer to a cut validator.
Definition at line 372 of file CglLandPSimplex.hpp.
|
private |
Weights for the normalization constraint.
Definition at line 374 of file CglLandPSimplex.hpp.
Referenced by normedCoef().
|
private |
Weight for rhs of normalization constraint.*/.
Definition at line 376 of file CglLandPSimplex.hpp.
|
private |
number of rows with a <0 rc in current iteration
Definition at line 379 of file CglLandPSimplex.hpp.
|
private |
Record the number of pivots.
Definition at line 384 of file CglLandPSimplex.hpp.
Referenced by outPivInfo().
|
private |
Record the number of times the source row entered the basis.
Definition at line 386 of file CglLandPSimplex.hpp.
Referenced by outPivInfo().
|
private |
Record the number of times that sigma increased.
Definition at line 388 of file CglLandPSimplex.hpp.
Referenced by outPivInfo().
|
private |
Message handler.
Definition at line 391 of file CglLandPSimplex.hpp.
Referenced by outPivInfo(), and setLogLevel().
|
private |
|
private |
Definition at line 395 of file CglLandPSimplex.hpp.