Skip to content

Commit

Permalink
Allow more options in mixedInteger2 cuts - will error if n>2 but see …
Browse files Browse the repository at this point in the history
…changes coming up in Cgl
  • Loading branch information
jjhforrest committed May 29, 2024
1 parent cb855c7 commit a58efff
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CbcParam.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ class CBCLIB_EXPORT CbcParam : public CoinParam {

// Integer Parameters
FIRSTINTPARAM,
AGGREGATEMIXED,
BKPIVOTINGSTRATEGY,
BKMAXCALLS,
BKCLQEXTMETHOD,
Expand Down
5 changes: 5 additions & 0 deletions src/CbcParamUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Copyright (C) 2007, Lou Hafer, International Business Machines Corporation
and others. All Rights Reserved.
Expand Down Expand Up @@ -246,6 +247,10 @@ int pushCbcSolverIntParam(CoinParam &param)
Figure out what we're doing and set the relevant field.
*/
switch (cbcParamCode) {
case CbcParam::AGGREGATEMIXED: {
parameters->setMixedRoundStrategy(val);
break;
}
case CbcParam::BKPIVOTINGSTRATEGY: {
parameters->setBkPivotStrategy(val);
break;
Expand Down
8 changes: 8 additions & 0 deletions src/CbcParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ void CbcParameters::setDefaults(int strategy) {
parameters_[CbcParam::FAKEINCREMENT]->setDefault(0.0);
parameters_[CbcParam::SMALLBAB]->setDefault(0.5);
parameters_[CbcParam::TIGHTENFACTOR]->setDefault(0.0);
parameters_[CbcParam::AGGREGATEMIXED]->setDefault(1);
parameters_[CbcParam::BKPIVOTINGSTRATEGY]->setDefault(3);
parameters_[CbcParam::BKMAXCALLS]->setDefault(1000);
parameters_[CbcParam::BKCLQEXTMETHOD]->setDefault(4);
Expand Down Expand Up @@ -1392,6 +1393,13 @@ void CbcParameters::addCbcSolverIntParams() {
getParam(code)->setPushFunc(CbcParamUtils::pushCbcSolverIntParam);
}

parameters_[CbcParam::AGGREGATEMIXED]->setup(
"agg!regatelevel", "Level of aggregation used in CglMixedRounding", -1, 5,
"MixedIntegerRounding2 can work on constraints created by aggregating "
"constraints in model. Although the coding for this has been in for "
"some time, it is being modified and the user may wish to play with this. "
"-1 varies the level at various times.");

parameters_[CbcParam::BKPIVOTINGSTRATEGY]->setup(
"bkpivot!ing", "Pivoting strategy used in Bron-Kerbosch algorithm", 0, 6);

Expand Down
9 changes: 9 additions & 0 deletions src/CbcParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,14 @@ class CBCLIB_EXPORT CbcParameters {

//@{

/*! \brief Get MixedRoundStrategy setting */
inline int getMixedRoundStrategy() { return mixedRoundStrategy_; }

/*! \brief Set MixedRoundStrategy setting */
inline void setMixedRoundStrategy(int mixedRoundStrategy) {
mixedRoundStrategy_ = mixedRoundStrategy;
}

/*! \brief Get BkPivotStrategy setting */
inline int getBkPivotStrategy() { return bkPivotStrategy_; }

Expand Down Expand Up @@ -2420,6 +2428,7 @@ class CBCLIB_EXPORT CbcParameters {
*/
//@{

int mixedRoundStrategy_;
int bkPivotStrategy_;
int bkMaxCalls_;
int bkClqExtMethod_;
Expand Down
6 changes: 6 additions & 0 deletions src/CbcSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,7 @@ void CbcMain0(CbcModel &model, CbcParameters &parameters) {
parameters[CbcParam::ODDWHEELCUTS]->setVal("ifmove");
parameters[CbcParam::CLQSTRENGTHENING]->setVal("after");
parameters[CbcParam::USECGRAPH]->setVal("on");
parameters[CbcParam::AGGREGATEMIXED]->setVal(1);
parameters[CbcParam::BKPIVOTINGSTRATEGY]->setVal(3);
parameters[CbcParam::BKMAXCALLS]->setVal(1000);
parameters[CbcParam::BKCLQEXTMETHOD]->setVal(4);
Expand Down Expand Up @@ -1446,6 +1447,7 @@ int CbcMain1(std::deque<std::string> inputQueue, CbcModel &model,
CglMixedIntegerRounding2 mixedGen(1, true, 1);
// set default action (0=off,1=on,2=root,3=ifmove)
int mixedMode = CbcParameters::CGIfMove;
int mixedRoundStrategy = 1;
assert (parameters[CbcParam::MIRCUTS]->modeVal()==mixedMode);
mixedGen.setDoPreproc(1); // safer (and better)

Expand Down Expand Up @@ -2200,6 +2202,8 @@ int CbcMain1(std::deque<std::string> inputQueue, CbcModel &model,
} else if (cbcParamCode == CbcParam::FPUMPTUNE || cbcParamCode == CbcParam::FPUMPTUNE2 ||
cbcParamCode == CbcParam::FPUMPITS) {
pumpChanged = true;
} else if (cbcParamCode == CbcParam::AGGREGATEMIXED) {
mixedRoundStrategy = iValue;
} else if (cbcParamCode == CbcParam::BKPIVOTINGSTRATEGY) {
bkPivotingStrategy = iValue;
} else if (cbcParamCode == CbcParam::BKMAXCALLS) {
Expand Down Expand Up @@ -6157,6 +6161,8 @@ int CbcMain1(std::deque<std::string> inputQueue, CbcModel &model,
}
assert (parameters[CbcParam::MIRCUTS]->modeVal()==mixedMode);
if (mixedMode) {
if (mixedRoundStrategy != 1)
mixedGen.setMAXAGGR_(mixedRoundStrategy);
babModel_->addCutGenerator(&mixedGen, translate[mixedMode],
"MixedIntegerRounding2");
accuracyFlag[numberGenerators] = 2;
Expand Down

0 comments on commit a58efff

Please sign in to comment.