diff --git a/src/CglFlowCover/CglFlowCover.cpp b/src/CglFlowCover/CglFlowCover.cpp index 6547d60c..51484ab4 100644 --- a/src/CglFlowCover/CglFlowCover.cpp +++ b/src/CglFlowCover/CglFlowCover.cpp @@ -300,7 +300,7 @@ void CglFlowCover::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, hasCut = generateOneFlowCut(si, rowLen, ind, coef, 'L', thisRhs, flowCut1, violation); if (hasCut) { // If find a cut - cs.insertIfNotDuplicate(flowCut1); + cs.insertIfNotDuplicateAndClean(flowCut1,41); incNumFlowCuts(); if (getNumFlowCuts() >= getMaxNumCuts()) break; @@ -309,7 +309,7 @@ void CglFlowCover::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, hasCut = generateOneFlowCut(si, rowLen, ind, coef, 'G', thisRhs, flowCut2, violation); if (hasCut) { - cs.insertIfNotDuplicate(flowCut2); + cs.insertIfNotDuplicateAndClean(flowCut2,42); incNumFlowCuts(); if (getNumFlowCuts() >= getMaxNumCuts()) break; @@ -319,7 +319,7 @@ void CglFlowCover::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, hasCut = generateOneFlowCut(si, rowLen, ind, coef, sense[iRow], thisRhs, flowCut3, violation); if (hasCut) { - cs.insertIfNotDuplicate(flowCut3); + cs.insertIfNotDuplicateAndClean(flowCut3,43); incNumFlowCuts(); if (getNumFlowCuts() >= getMaxNumCuts()) break; diff --git a/src/CglGMI/CglGMI.cpp b/src/CglGMI/CglGMI.cpp index fdb96c52..db7afeb4 100644 --- a/src/CglGMI/CglGMI.cpp +++ b/src/CglGMI/CglGMI.cpp @@ -1264,10 +1264,10 @@ void CglGMI::generateCuts(OsiCuts &cs) rc.setLb(-param.getINFINIT()); rc.setUb(cutRhs); if (!param.getCHECK_DUPLICATES()) { - cs.insertIfNotDuplicate(rc); + cs.insertIfNotDuplicateAndClean(rc,21); } else{ - cs.insertIfNotDuplicate(rc, CoinAbsFltEq(param.getEPS_COEFF())); + cs.insertIfNotDuplicateAndClean(rc, 22, CoinAbsFltEq(param.getEPS_COEFF())); } } diff --git a/src/CglGomory/CglGomory.cpp b/src/CglGomory/CglGomory.cpp index 2533a3e8..636d676f 100644 --- a/src/CglGomory/CglGomory.cpp +++ b/src/CglGomory/CglGomory.cpp @@ -1695,13 +1695,13 @@ CglGomory::generateCuts( if (number>1) { #if MORE_GOMORY_CUTS<2 nTotalEls -= number; - cs.insertIfNotDuplicate(rc); + cs.insertIfNotDuplicateAndClean(rc,11); #else if(numberlbCol || ub0) { for (int i=0;irow().getNumElements(); - cs.insertIfNotDuplicate(longCuts.rowCut(i)); + cs.insertIfNotDuplicateAndClean(longCuts.rowCut(i),16); numberAdded ++; if (nTotalEls<=0) break; @@ -1889,7 +1889,7 @@ CglGomory::generateCuts( while (nTotalEls>0) { for (int i=0;irow().getNumElements(); - cs.insertIfNotDuplicate(secondaryCuts.rowCut(i)); + cs.insertIfNotDuplicateAndClean(secondaryCuts.rowCut(i),17); numberAdded ++; if (nTotalEls<=0) break; diff --git a/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.cpp b/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.cpp index 23ead55c..9f1d317c 100644 --- a/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.cpp +++ b/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.cpp @@ -34,15 +34,20 @@ CglMixedIntegerRounding2::generateCuts(const OsiSolverInterface& si, // everytime this function is called. Otherwise, just do once. bool preInit = false; bool preReso = false; + info_ = &info; si.getHintParam(OsiDoPresolveInInitial, preInit); si.getHintParam(OsiDoPresolveInResolve, preReso); // Deal with MAXAGGR_ int saveMaxAggr = MAXAGGR_; - if (MAXAGGR_==-1) { - if(!info.inTree && info.pass<1000) + if (MAXAGGR_<0) { + if(!info.inTree && info.pass<1000) { MAXAGGR_=5; // up at root - else - MAXAGGR_=1; + } else { + if (MAXAGGR_==-1) + MAXAGGR_=1; + else + return; + } } if (preInit == false && preReso == false && doPreproc_ == -1 ) { // Do once if (doneInitPre_ == false) { @@ -992,6 +997,14 @@ CglMixedIntegerRounding2::generateMirCuts( if (n>CBC_CHECK_CUT_LENGTH*numRows_) hasCut = false; } +#endif +#if 1 + if (info_->pass || info_->inTree) { + const CoinPackedVector & row = cMirCut.row(); + int n=row.getNumElements(); + if (n>0.8*numCols_) + hasCut = false; + } #endif if (hasCut) { // look at cut to see if unstable @@ -1017,7 +1030,7 @@ CglMixedIntegerRounding2::generateMirCuts( printf("(%d,%g) ",columns[i],elements[i]); printf("<= %g\n",cMirCut.ub()); #endif - cs.insertIfNotDuplicate(cMirCut,tolTest); + cs.insertIfNotDuplicateAndClean(cMirCut,31,tolTest); } } diff --git a/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.hpp b/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.hpp index bfb894cc..3c08226c 100644 --- a/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.hpp +++ b/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.hpp @@ -169,7 +169,7 @@ class CGLLIB_EXPORT CglMixedIntegerRounding2 : public CglCutGenerator { //@{ /// Set MAXAGGR_ inline void setMAXAGGR_ (int maxaggr) { - if (maxaggr > 0 || maxaggr == -1) { + if (maxaggr > 0 || maxaggr == -1 || maxaggr ==-2) { MAXAGGR_ = maxaggr; } else { @@ -412,6 +412,8 @@ class CGLLIB_EXPORT CglMixedIntegerRounding2 : public CglCutGenerator { char * sense_; // RHS of rows (modified if ranges) double * RHS_; + // Pointer to info + const CglTreeInfo *info_; }; //############################################################################# diff --git a/src/CglRedSplit2/CglRedSplit2.cpp b/src/CglRedSplit2/CglRedSplit2.cpp index dbf12db3..ed0d9de5 100644 --- a/src/CglRedSplit2/CglRedSplit2.cpp +++ b/src/CglRedSplit2/CglRedSplit2.cpp @@ -2111,7 +2111,7 @@ int CglRedSplit2::generateCuts(OsiCuts* cs, int maxNumCuts, int* lambda) } rc.setUb(tabrowrhs + adjust); // relax the constraint slightly - buffcs->insertIfNotDuplicate(rc, CoinAbsFltEq(param.getEPS())); + buffcs->insertIfNotDuplicateAndClean(rc, 51, CoinAbsFltEq(param.getEPS())); numCuts = buffcs->sizeRowCuts() - initNumCuts; #if CBC_CHECK_CUT_LENGTH } @@ -2137,7 +2137,7 @@ int CglRedSplit2::generateCuts(OsiCuts* cs, int maxNumCuts, int* lambda) // also delete temp data if (buffcs){ for (int i = 0; i < numCuts && i < maxNumCuts; ++i){ - cs->insertIfNotDuplicate(buffcs->rowCut(quality[i].index), + cs->insertIfNotDuplicateAndClean(buffcs->rowCut(quality[i].index),52, CoinAbsFltEq(param.getEPS_COEFF())); } delete buffcs; diff --git a/src/CglResidualCapacity/CglResidualCapacity.cpp b/src/CglResidualCapacity/CglResidualCapacity.cpp index 9741599d..f03ba1ec 100644 --- a/src/CglResidualCapacity/CglResidualCapacity.cpp +++ b/src/CglResidualCapacity/CglResidualCapacity.cpp @@ -491,7 +491,7 @@ CglResidualCapacity::generateResCapCuts( #if CGL_DEBUG std::cout << "Res. cap. cut generated " << std::endl; #endif - cs.insertIfNotDuplicate(resCapCut); + cs.insertIfNotDuplicateAndClean(resCapCut,71); } } @@ -516,7 +516,7 @@ CglResidualCapacity::generateResCapCuts( #if CGL_DEBUG std::cout << "Res. cap. cut generated " << std::endl; #endif - cs.insertIfNotDuplicate(resCapCut); + cs.insertIfNotDuplicateAndClean(resCapCut,72); } } diff --git a/src/CglTwomir/CglTwomir.cpp b/src/CglTwomir/CglTwomir.cpp index 4dabebef..37dd81ef 100644 --- a/src/CglTwomir/CglTwomir.cpp +++ b/src/CglTwomir/CglTwomir.cpp @@ -39,7 +39,7 @@ class CoinWarmStartBasis; #define t_min data->cparams.t_min #define a_max data->cparams.a_max #define max_elements data->cparams.max_elements - +//#define CGL_DEBUG #ifdef CGL_DEBUG // Declarations and defines for debug build. @@ -81,7 +81,6 @@ void testus( DGG_constraint_t *cut){ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #endif // CGL_DEBUG - //------------------------------------------------------------------- // Generate cuts //------------------------------------------------------------------- @@ -407,7 +406,7 @@ void CglTwomir::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, rowcut.setRow(number, cutIndex, packed); rowcut.setUb(si.getInfinity()); rowcut.setLb(rhs); - cs.insertIfNotDuplicate(rowcut); + cs.insertIfNotDuplicateAndClean(rowcut,61); } else { // singleton row cut! double lb = rhs; @@ -436,7 +435,7 @@ void CglTwomir::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, rc.setRow(0,cutIndex,packed,false); rc.setLb(1.0); rc.setUb(0.0); - cs.insertIfNotDuplicate(rc); + cs.insertIfNotDuplicateAndClean(rc,62); } else if (lb>lbCol || ubnz, cut->index, cut->coeff); rowcut.setUb(si->getInfinity()); rowcut.setLb(cut->rhs); - cs.insertIfNotDuplicate(rowcut); + cs.insertIfNotDuplicateAndClean(rowcut,63); #endif } @@ -476,7 +475,6 @@ void CglTwomir::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, #endif } } - for ( i=0; i