Go to the documentation of this file.
11 #ifndef CglLandPSimplex_H
12 #define CglLandPSimplex_H
20 #include "OsiSolverInterface.hpp"
21 #include "CoinMessage.hpp"
22 #include "CoinMessageHandler.hpp"
23 #include "CoinWarmStartBasis.hpp"
24 #include "CoinPackedMatrix.hpp"
26 #ifdef COIN_HAS_OSICLP
27 #include "OsiClpSolverInterface.hpp"
35 #define OLD_COMPUTATION
47 const CglLandP::CachedData &cached,
53 void cacheUpdate(
const CglLandP::CachedData &cached,
bool reducedSpace = 0);
75 handler_->setLogLevel(level);
79 void setSi(OsiSolverInterface *si)
82 #ifdef COIN_HAS_OSICLP
83 OsiClpSolverInterface * clpSi =
dynamic_cast<OsiClpSolverInterface *
>(si_);
95 #ifdef COIN_HAS_OSICLP
105 std::vector<int> &M1, std::vector<int> &M2,
135 handler_->message(
RoundStats, messages_)<<ncuts<<numPivots_
136 <<numSourceRowEntered_
137 <<numIncreased_<<CoinMessageEol;
141 void append_row(
int row_num,
bool modularize) ;
143 void update_row(
TabRow &row);
145 void check_mod_row(
TabRow &row);
151 bool recompute_source_row,
162 double pivotTol,
double rhsTol,
164 bool allowNonImproving,
165 double &bestSigma,
bool modularize);
207 return lo_bounds_[original_index_[index]];
212 return up_bounds_[original_index_[index]];
217 return colsolToCut_[original_index_[index]];
221 return (index >= ncols_ && lo_bounds_[original_index_[index]] < -1e-10 && up_bounds_[original_index_[index]] <= 1e-09);
226 colsolToCut_[original_index_[index]] = value;
229 inline CoinWarmStartBasis::Status
getStatus(
int index)
const
231 if (index < ncols_)
return basis_->getStructStatus(index);
232 return basis_->getArtifStatus(index - ncols_);
237 return integers_[original_index_[index]];
245 if (norm_weights_.empty())
251 return a*norm_weights_[ii];
268 std::vector<int> &M1,
269 std::vector<int> &M2,
270 std::vector<int> &M3);
280 #ifdef COIN_HAS_OSICLP
282 OsiClpSolverInterface * clp_;
286 void updateM1_M2_M3(
TabRow & row,
double tolerance,
bool alwaysComputeCheap);
288 void removeRows(
int nDelete,
const int * rowsIdx);
291 void compute_p_q_r_s(
double gamma,
int gammaSign,
double &p,
double & q,
double & r ,
double &s);
306 CoinPackedVector gammas_;
308 std::vector<double> rWk1_;
310 std::vector<double> rWk2_;
312 std::vector<double> rWk3_;
314 std::vector<double> rWk4_;
316 std::vector<int> rIntWork_;
320 std::vector<bool> col_in_subspace;
322 bool *colCandidateToLeave_;
328 std::vector<int> M1_;
330 std::vector<int> M2_;
332 std::vector<int> M3_;
336 CoinWarmStartBasis * basis_;
338 double * colsolToCut_;
350 std::vector<double> lo_bounds_;
352 std::vector<double> up_bounds_;
354 bool inDegenerateSequence_;
356 double chosenReducedCostVal_;
358 const bool * integers_;
360 std::vector<int> original_index_;
367 OsiSolverInterface * si_;
374 std::vector<double> norm_weights_;
379 int nNegativeRcRows_;
386 int numSourceRowEntered_;
391 CoinMessageHandler * handler_;
393 CoinMessages messages_;
414 double pivotTol,
bool reducedSpace,
bool allowDegeneratePivot,
418 double pivotTol,
bool reducedSpace,
bool allowDegenerate,
bool modularize);
429 if ( (!integers_[i]))
433 double f_i = alpha_i - floor(alpha_i);
435 return f_i*(1- beta);
437 return (1 - f_i)*beta;
446 return row_k_[j] + gamma * row_i_[j];
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)
bool isInteger(int index) const
Say if variable index by i in current tableau is integer.
void printCglpBasis(std::ostream &os=std::cout)
Print CGLP basis corresponding to current tableau and source row.
RhsWeightType
RHS weight in normalization.
double computeCglpRedCost(int direction, int gammaSign, double tau)
Compute the reduced cost of Cglp.
void setLogLevel(int level)
double computeCglpObjective(double gamma, bool strengthen, TabRow &row)
Compute the objective value of the Cglp with linear combintation of the two rows by gamma.
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 exis...
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-proj...
double intersectionCutCoef(double alpha_i, double beta)
return the coefficients of the intersection cut
void printRowLateX(std::ostream &os, int i)
void printEverything()
Print everything .
~CglLandPSimplex()
Destructor.
void pullTableauRow(TabRow &row) const
Get the row i of the tableau.
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 adjustTableauRow(int var, TabRow &row, int direction)
Adjust the row of the tableau to reflect leaving variable direction.
bool generateMig(int row, OsiRowCut &cut, const CglLandP::Parameters ¶ms)
Find Gomory cut (i.e.
Normalization
Normalization.
void printTableauLateX(std::ostream &os)
print the tableau of current basis.
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 generateExtraCuts(const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms)
Find extra constraints in current tableau.
void setSi(OsiSolverInterface *si)
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).
void scaleCut(OsiRowCut &cut, double factor) const
Scale the cut by factor.
bool optimize(int var, OsiRowCut &cut, const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms)
Perfom pivots to find the best cuts.
void printCutLateX(std::ostream &os, int i)
double normedCoef(double a, int ii) const
Evenutaly multiply a by w if normed_weights_ is not empty.
int insertAllExtr(OsiCuts &cs, CoinRelFltEq eq)
insert all extra cuts in cs.
void loadBasis(const OsiSolverInterface &si, std::vector< int > &M1, std::vector< int > &M2, int k)
const int * getBasics() const
double normalizationFactor(const TabRow &row) const
Compute the normalization factor of the cut.
bool resetSolver(const CoinWarmStartBasis *basis)
reset the solver to optimal basis
void printTableau(std::ostream &os)
print the tableau of current basis.
double getColsolToCut(int index) const
Access to value in solution to cut (indexed in reduced problem)
void setColsolToCut(int index, double value)
Access to value in solution to cut (indexed in reduced problem)
void resetOriginalTableauRow(int var, TabRow &row, int direction)
reset the tableau row after a call to adjustTableauRow
double newRowCoefficient(int j, double gamma) const
return the coefficient of the new row (combining row_k + gamma row_i).
double computeCglpObjective(double gamma, bool strengthen)
Compute the objective value of the Cglp with linear combintation of the row_k_ and gamma row_i_.
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 ...
int plotCGLPobj(int direction, double gammaTolerance, double pivotTol, bool reducedSpace, bool allowDegenerate, bool modularize)
double getLoBound(int index) const
Get lower bound for variable or constraint.
int rescanReducedCosts(int &direction, int &gammaSign, double tolerance)
Rescan reduced costs tables.
bool isGtConst(int index) const
void eliminate_slacks(double *vec) const
Put a vector in structural sapce.
void createMIG(TabRow &row, OsiRowCut &cut) const
Create strenghtened row.
double computeRedCostConstantsInRow()
Compute the value of sigma and thau (which are constants for a row i as defined in Mike Perregaard th...
Class storing parameters.
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 varia...
void createIntersectionCut(TabRow &row, OsiRowCut &cut) const
Create the intersection cut of row k.
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 ...
const int * getNonBasics() const
Class to validate or reject a cut.
CglLandPSimplex(const OsiSolverInterface &si, const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms, Validator &validator)
Usefull onstructor.
const CoinWarmStartBasis * getBasis() const
To store extra cuts generated by columns from which they origin.
void cacheUpdate(const CglLandP::CachedData &cached, bool reducedSpace=0)
Update cached information in case of basis change in a round.
CoinWarmStartBasis::Status getStatus(int index) const
Get the basic status of a variable (structural or slack).
void computeWeights(CglLandP::LHSnorm norm, CglLandP::Normalization type, CglLandP::RhsWeightType rhs)
Compute normalization weights.
void outPivInfo(int ncuts)
double getUpBound(int index) const
Get upper bound for variable or constraint.
Performs one round of Lift & Project using CglLandPSimplex to build cuts.