11 #ifndef CglLandPSimplex_H
12 #define CglLandPSimplex_H
26 #ifdef COIN_HAS_OSICLP
35 #define OLD_COMPUTATION
82 #ifdef COIN_HAS_OSICLP
95 #ifdef COIN_HAS_OSICLP
105 std::vector<int> &M1, std::vector<int> &M2,
141 void append_row(
int row_num,
bool modularize) ;
143 void update_row(
TabRow &row);
145 void check_mod_row(
TabRow &row);
149 bool changeBasis(
int incoming,
int leaving,
int direction,
151 bool recompute_source_row,
162 double pivotTol,
double rhsTol,
164 bool allowNonImproving,
165 double &bestSigma,
bool modularize);
268 std::vector<int> &M1,
269 std::vector<int> &M2,
270 std::vector<int> &M3);
280 #ifdef COIN_HAS_OSICLP
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);
414 double pivotTol,
bool reducedSpace,
bool allowDegeneratePivot,
417 int plotCGLPobj(
int direction,
double gammaTolerance,
418 double pivotTol,
bool reducedSpace,
bool allowDegenerate,
bool modularize);
433 double f_i = alpha_i - floor(alpha_i);
435 return f_i*(1- beta);
437 return (1 - f_i)*beta;
double getUpBound(int index) const
Get upper bound for variable or constraint.
CoinMessageHandler * handler_
Message handler.
std::vector< double > rWk2_
scond work vector in row space.
std::vector< bool > col_in_subspace
Flag columns which are in the subspace (usualy remove nonbasic structurals in subspace) ...
Cuts cuts_
Stores extra cuts which are generated along the procedure.
CoinWarmStartBasis * basis_
Keep track of basis status.
int generateExtraCuts(const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms)
Find extra constraints in current tableau.
TabRow original_row_k_
Original version of source row (without modularization).
int ncols_
cached number of columns in reduced size problem
int plotCGLPobj(int direction, double gammaTolerance, double pivotTol, bool reducedSpace, bool allowDegenerate, bool modularize)
Compute the reduced cost of Cglp.
bool * colCandidateToLeave_
Flag columns which have to be considered for leaving the basis.
std::vector< double > rWk1_
first work vector in row space.
Normalization
Normalization.
CoinWarmStartBasis::Status getStatus(int index) const
Get the basic status of a variable (structural or slack).
double computeCglpRedCost(int direction, int gammaSign, double tau)
Compute the reduced cost of Cglp.
const int * getBasics() const
Base class for message handling.
void cacheUpdate(const CglLandP::CachedData &cached, bool reducedSpace=0)
Update cached information in case of basis change in a round.
Equality to a scaled tolerance.
void pullTableauRow(TabRow &row) const
Get the row i of the tableau.
void genThisBasisMigs(const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms)
void setSi(OsiSolverInterface *si)
double getColsolToCut(int index) const
Access to value in solution to cut (indexed in reduced problem)
CoinMessages messages_
Messages.
RhsWeightType
RHS weight in normalization.
bool isGtConst(int index) const
~CglLandPSimplex()
Destructor.
std::vector< int > rIntWork_
integer valued work vector on the rows
std::vector< int > M3_
Stores the variables which could be either in M1 or M2.
double computeRedCostConstantsInRow()
Compute the value of sigma and thau (which are constants for a row i as defined in Mike Perregaard th...
std::vector< double > norm_weights_
Weights for the normalization constraint.
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.
bool checkBasis()
Check that the basis is correct.
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 removeRows(int nDelete, const int *rowsIdx)
Remove rows from current tableau.
TabRow new_row_
Source row for cut.
std::vector< int > original_index_
Original index of variable before deletions.
void printCutLateX(std::ostream &os, int i)
Collections of row cuts and column cuts.
void outPivInfo(int ncuts)
void compute_p_q_r_s(double gamma, int gammaSign, double &p, double &q, double &r, double &s)
double normalizationFactor(const TabRow &row) const
Compute the normalization factor of the cut.
void loadBasis(const OsiSolverInterface &si, std::vector< int > &M1, std::vector< int > &M2, int k)
void setColsolToCut(int index, double value)
Access to value in solution to cut (indexed in reduced problem)
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).
CglLandPSimplex & operator=(const CglLandPSimplex &)
No assignment operator.
std::vector< double > up_bounds_
Source row for cut.
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...
double getLoBound(int index) const
Get lower bound for variable or constraint.
bool optimize(int var, OsiRowCut &cut, const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms)
Perfom pivots to find the best cuts.
bool own_
Own the data or not?
bool resetSolver(const CoinWarmStartBasis *basis)
reset the solver to optimal basis
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 CoinWarmStartBasis * getBasis() const
void computeWeights(CglLandP::LHSnorm norm, CglLandP::Normalization type, CglLandP::RhsWeightType rhs)
Compute normalization weights.
double * colsol_
Pointer to the current basic solution.
const int * getNonBasics() const
Status getStructStatus(int i) const
Return the status of the specified structural variable.
int numPivots_
Record the number of pivots.
Some informations that will be changed by the pivots and that we want to keep.
OsiSolverInterface * si_
Pointer to the solver interface.
CoinPackedVector gammas_
vector to sort the gammas
int rescanReducedCosts(int &direction, int &gammaSign, double tolerance)
Rescan reduced costs tables.
std::vector< int > M2_
Stores the variables which are always in M2 for a given k.
int nrows_
Cached number of rows in reduced size problem.
void printTableau(std::ostream &os)
print the tableau of current basis.
bool inDegenerateSequence_
Say if we are in a sequence of degenerate pivots.
CoinMessageHandler & message(int messageNumber, const CoinMessages &messages)
Start a message.
void printTableauLateX(std::ostream &os)
print the tableau of current basis.
int * nonBasics_
Stores the nonBasicVariables.
Class to validate or reject a cut.
void scaleCut(OsiRowCut &cut, double factor) const
Scale the cut by factor.
void updateM1_M2_M3(TabRow &row, double tolerance, bool alwaysComputeCheap)
Update values in M1 M2 and M3 before an iteration.
This is a first attempt at a message handler.
double rhs_weight_
Weight for rhs of normalization constraint.*/.
Validator & validator_
A pointer to a cut validator.
Abstract Base Class for describing an interface to a solver.
TabRow row_i_
Row of leaving candidate.
void eliminate_slacks(double *vec) const
Put a vector in structural sapce.
std::vector< double > rWk3_
third work vector in row space.
std::vector< double > lo_bounds_
Source row for cut.
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 numSourceRowEntered_
Record the number of times the source row entered the basis.
Class to hold and manipulate an array of massaged messages.
void createIntersectionCut(TabRow &row, OsiRowCut &cut) const
Create the intersection cut of row k.
CglLandPSimplex()
No default constructor.
int numIncreased_
Record the number of times that sigma increased.
double sigma_
stores the cglp value of the normalized cut obtained from row k_
Status getArtifStatus(int i) const
Return the status of the specified artificial variable.
bool * rowFlags_
Flag rows which we don't want to try anymore.
std::vector< double > rWk4_
fourth work vector in row space.
int nNegativeRcRows_
number of rows with a <0 rc in current iteration
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 ...
double normedCoef(double a, int ii) const
Evenutaly multiply a by w if normed_weights_ is not empty.
void adjustTableauRow(int var, TabRow &row, int direction)
Adjust the row of the tableau to reflect leaving variable direction.
void printRowLateX(std::ostream &os, int i)
double * colsolToCut_
Pointer to the solution to cut (need to be modified after each pivot because we are only considering ...
void setLogLevel(int value)
Set current log (detail) level.
bool isInteger(int index) const
Say if variable index by i in current tableau is integer.
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...
int ncols_orig_
cached numcols in original problem
TabRow row_k_
Source row for cut.
int nrows_orig_
cached numrows in original problem
int insertAllExtr(OsiCuts &cs, CoinRelFltEq eq)
insert all extra cuts in cs.
double intersectionCutCoef(double alpha_i, double beta)
return the coefficients of the intersection cut
void setLogLevel(int level)
void printEverything()
Print everything .
Class storing parameters.
void resetOriginalTableauRow(int var, TabRow &row, int direction)
reset the tableau row after a call to adjustTableauRow
double chosenReducedCostVal_
Value for the reduced cost chosen for pivoting.
To store extra cuts generated by columns from which they origin.
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...
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) ...
const bool * integers_
pointer to array of integer info for both structural and slacks
The default COIN simplex (basis-oriented) warm start class.
void printCglpBasis(std::ostream &os=std::cout)
Print CGLP basis corresponding to current tableau and source row.
void createMIG(TabRow &row, OsiRowCut &cut) const
Create strenghtened row.
bool generateMig(int row, OsiRowCut &cut, const CglLandP::Parameters ¶ms)
Find Gomory cut (i.e.
double newRowCoefficient(int j, double gamma) const
return the coefficient of the new row (combining row_k + gamma row_i).
Status
Enum for status of variables.
std::vector< int > M1_
Stores the variables which are always in M1 for a given k.
int * basics_
Store the basics variable.