From 245bbfaa8d6222b1754958ac7507134fd19b5e50 Mon Sep 17 00:00:00 2001 From: Alexander Hoen Date: Tue, 8 Oct 2024 13:46:43 +0200 Subject: [PATCH 1/5] resolve some #if 0 --- src/scip/cons_pseudoboolean.c | 30 ++++++++++-------------------- src/scip/nlhdlr_perspective.c | 20 -------------------- src/scip/nlhdlr_soc.c | 22 ---------------------- src/scip/prop_probing.c | 14 -------------- 4 files changed, 10 insertions(+), 76 deletions(-) diff --git a/src/scip/cons_pseudoboolean.c b/src/scip/cons_pseudoboolean.c index 69383c8193..bdd51c6f0f 100644 --- a/src/scip/cons_pseudoboolean.c +++ b/src/scip/cons_pseudoboolean.c @@ -5134,9 +5134,6 @@ SCIP_RETCODE correctConshdlrdata( if( !looseorcolumn ) { SCIP_CALL( SCIPsetConsInitial(scip, consanddata->cons, FALSE) ); -#if 0 - SCIP_CALL( SCIPsetConsSeparated(scip, consanddata->cons, FALSE) ); -#endif } SCIP_CALL( SCIPsetConsChecked(scip, consanddata->cons, TRUE) ); } @@ -5318,9 +5315,6 @@ SCIP_RETCODE updateConsanddataUses( if( !looseorcolumn ) { SCIP_CALL( SCIPsetConsInitial(scip, consanddata->cons, FALSE) ); -#if 0 - SCIP_CALL( SCIPsetConsSeparated(scip, consanddata->cons, FALSE) ); -#endif } SCIP_CALL( SCIPsetConsChecked(scip, consanddata->cons, TRUE) ); } @@ -7223,20 +7217,16 @@ SCIP_RETCODE findAggregation( (*ndelconss) += 2; } } -#if 0 - else - { - /* @todo */ - /* delete allvars[samepos] from all and-constraints which appear in this pseudoboolean constraint, and delete - * all but one of the remaining and-constraint - * - * it is the same like aggregating linvar with the resultant of the product, which is the same in all and- - * constraints without allvars[samepos] - * - * e.g. x1 + x2*x_3*...x_n + ~x2*x_3*...x_n = 1 => x1 = 1 - x_3*...x_n - */ - } -#endif + /* @todo handle case nvars > 2*/ + /* delete allvars[samepos] from all and-constraints which appear in this pseudoboolean constraint, and delete + * all but one of the remaining and-constraint + * + * it is the same as aggregating linvar with the resultant of the product, which is the same in all and- + * constraints without allvars[samepos] + * + * e.g. x1 + x2*x_3*...x_n + ~x2*x_3*...x_n = 1 => x1 = 1 - x_3*...x_n + */ + } /*lint !e438*/ /* we have a constraint in the form of: x1 + x2 * x3 + ~x2 * x3 + ~x2 * ~x3 == 1 * this leads to the aggregation x1 = x2 * ~x3 diff --git a/src/scip/nlhdlr_perspective.c b/src/scip/nlhdlr_perspective.c index 2804dc1e22..b6c993e7a4 100644 --- a/src/scip/nlhdlr_perspective.c +++ b/src/scip/nlhdlr_perspective.c @@ -1241,14 +1241,6 @@ SCIP_DECL_NLHDLRFREEEXPRDATA(nlhdlrFreeExprDataPerspective) return SCIP_OKAY; } -/** callback to be called in initialization */ -#if 0 -static -SCIP_DECL_NLHDLRINIT(nlhdlrInitPerspective) -{ /*lint --e{715}*/ - return SCIP_OKAY; -} -#endif /** callback to be called in deinitialization */ static @@ -1496,18 +1488,6 @@ SCIP_DECL_NLHDLRINITSEPA(nlhdlrInitSepaPerspective) } -#if 0 -/** separation deinitialization method of a nonlinear handler (called during CONSEXITSOL) */ -static -SCIP_DECL_NLHDLREXITSEPA(nlhdlrExitSepaPerspective) -{ /*lint --e{715}*/ - SCIPerrorMessage("method of perspective nonlinear handler not implemented yet\n"); - SCIPABORT(); /*lint --e{527}*/ - - return SCIP_OKAY; -} -#endif - /** nonlinear handler enforcement callback * * "Perspectivies" cuts produced by other nonlinear handlers. diff --git a/src/scip/nlhdlr_soc.c b/src/scip/nlhdlr_soc.c index 690e00538f..84ab8e15de 100644 --- a/src/scip/nlhdlr_soc.c +++ b/src/scip/nlhdlr_soc.c @@ -2406,33 +2406,11 @@ SCIP_DECL_NLHDLRFREEEXPRDATA(nlhdlrFreeExprDataSoc) /** callback to be called in initialization */ -#if 0 -static -SCIP_DECL_NLHDLRINIT(nlhdlrInitSoc) -{ /*lint --e{715}*/ - SCIPerrorMessage("method of soc nonlinear handler not implemented yet\n"); - SCIPABORT(); /*lint --e{527}*/ - - return SCIP_OKAY; -} -#else #define nlhdlrInitSoc NULL -#endif /** callback to be called in deinitialization */ -#if 0 -static -SCIP_DECL_NLHDLREXIT(nlhdlrExitSoc) -{ /*lint --e{715}*/ - SCIPerrorMessage("method of soc nonlinear handler not implemented yet\n"); - SCIPABORT(); /*lint --e{527}*/ - - return SCIP_OKAY; -} -#else #define nlhdlrExitSoc NULL -#endif /** callback to detect structure in expression tree */ diff --git a/src/scip/prop_probing.c b/src/scip/prop_probing.c index a4209e7360..99b56e9736 100644 --- a/src/scip/prop_probing.c +++ b/src/scip/prop_probing.c @@ -1292,20 +1292,6 @@ SCIP_RETCODE SCIPapplyProbingVar( { proplbs[i] = SCIPvarGetLbLocal(vars[i]); propubs[i] = SCIPvarGetUbLocal(vars[i]); -#if 0 -#ifdef SCIP_DEBUG - if( SCIPisGT(scip, proplbs[i], SCIPvarGetLbGlobal(vars[i])) ) - { - SCIPdebugMsg(scip, " -> <%s>[%g,%g] >= %g\n", SCIPvarGetName(vars[i]), - SCIPvarGetLbGlobal(vars[i]), SCIPvarGetUbGlobal(vars[i]), proplbs[i]); - } - if( SCIPisLT(scip, propubs[i], SCIPvarGetUbGlobal(vars[i])) ) - { - SCIPdebugMsg(scip, " -> <%s>[%g,%g] <= %g\n", SCIPvarGetName(vars[i]), - SCIPvarGetLbGlobal(vars[i]), SCIPvarGetUbGlobal(vars[i]), propubs[i]); - } -#endif -#endif } } From 7da737add6ff4c740e5f8815495bfc98fbedf8c3 Mon Sep 17 00:00:00 2001 From: Alexander Hoen Date: Tue, 8 Oct 2024 13:50:51 +0200 Subject: [PATCH 2/5] Apply 1 suggestion(s) to 1 file(s) --- src/scip/cons_pseudoboolean.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/scip/cons_pseudoboolean.c b/src/scip/cons_pseudoboolean.c index bdd51c6f0f..464c22ab92 100644 --- a/src/scip/cons_pseudoboolean.c +++ b/src/scip/cons_pseudoboolean.c @@ -7217,8 +7217,8 @@ SCIP_RETCODE findAggregation( (*ndelconss) += 2; } } - /* @todo handle case nvars > 2*/ - /* delete allvars[samepos] from all and-constraints which appear in this pseudoboolean constraint, and delete + /* @todo handle case nvars > 2: + * delete allvars[samepos] from all and-constraints which appear in this pseudoboolean constraint, and delete * all but one of the remaining and-constraint * * it is the same as aggregating linvar with the resultant of the product, which is the same in all and- @@ -7226,7 +7226,6 @@ SCIP_RETCODE findAggregation( * * e.g. x1 + x2*x_3*...x_n + ~x2*x_3*...x_n = 1 => x1 = 1 - x_3*...x_n */ - } /*lint !e438*/ /* we have a constraint in the form of: x1 + x2 * x3 + ~x2 * x3 + ~x2 * ~x3 == 1 * this leads to the aggregation x1 = x2 * ~x3 From b7696322860690dc6a91f139c61758101d86f92a Mon Sep 17 00:00:00 2001 From: Alexander Hoen Date: Tue, 8 Oct 2024 14:01:05 +0200 Subject: [PATCH 3/5] remove if 0 which issue non-existing event --- src/scip/var.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/scip/var.c b/src/scip/var.c index 00fa4be081..d532290d4d 100644 --- a/src/scip/var.c +++ b/src/scip/var.c @@ -9039,15 +9039,6 @@ SCIP_RETCODE varProcessAddHoleLocal( assert(SCIPsetIsEQ(set, newlb, var->locdom.lb)); assert(SCIPsetIsEQ(set, newub, var->locdom.ub)); -#if 0 - /* issue bound change event */ - assert(SCIPvarIsTransformed(var) == (var->eventfilter != NULL)); - if( var->eventfilter != NULL ) - { - SCIP_CALL( varEventLholeAdded(var, blkmem, set, lp, branchcand, eventqueue, left, right) ); - } -#endif - /* process parent variables */ for( i = 0; i < var->nparentvars; ++i ) { From d7827f01c4b3215f798097f9e0c29bd74109ed96 Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 13 Oct 2024 19:34:03 +0200 Subject: [PATCH 4/5] remove unused functions --- src/scip/nlhdlr_soc.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/scip/nlhdlr_soc.c b/src/scip/nlhdlr_soc.c index 84ab8e15de..d6d4c52106 100644 --- a/src/scip/nlhdlr_soc.c +++ b/src/scip/nlhdlr_soc.c @@ -2404,15 +2404,6 @@ SCIP_DECL_NLHDLRFREEEXPRDATA(nlhdlrFreeExprDataSoc) return SCIP_OKAY; } - -/** callback to be called in initialization */ -#define nlhdlrInitSoc NULL - - -/** callback to be called in deinitialization */ -#define nlhdlrExitSoc NULL - - /** callback to detect structure in expression tree */ static SCIP_DECL_NLHDLRDETECT(nlhdlrDetectSoc) @@ -3142,7 +3133,6 @@ SCIP_RETCODE SCIPincludeNlhdlrSoc( SCIPnlhdlrSetCopyHdlr(nlhdlr, nlhdlrCopyhdlrSoc); SCIPnlhdlrSetFreeHdlrData(nlhdlr, nlhdlrFreehdlrdataSoc); SCIPnlhdlrSetFreeExprData(nlhdlr, nlhdlrFreeExprDataSoc); - SCIPnlhdlrSetInitExit(nlhdlr, nlhdlrInitSoc, nlhdlrExitSoc); SCIPnlhdlrSetSepa(nlhdlr, nlhdlrInitSepaSoc, nlhdlrEnfoSoc, NULL, nlhdlrExitSepaSoc); SCIPnlhdlrSetSollinearize(nlhdlr, nlhdlrSollinearizeSoc); From 6252536ae97c8f447b865849c06cfad525a68e36 Mon Sep 17 00:00:00 2001 From: Alexander Hoen Date: Mon, 14 Oct 2024 13:40:58 +0200 Subject: [PATCH 5/5] 2734: refactor one #if 0 --- src/scip/var.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/scip/var.c b/src/scip/var.c index d532290d4d..25afac5aba 100644 --- a/src/scip/var.c +++ b/src/scip/var.c @@ -9039,6 +9039,14 @@ SCIP_RETCODE varProcessAddHoleLocal( assert(SCIPsetIsEQ(set, newlb, var->locdom.lb)); assert(SCIPsetIsEQ(set, newub, var->locdom.ub)); +#ifdef SCIP_DISABLED_CODE + /* issue LHOLEADDED event */ + SCIP_EVENT event; + assert(var->eventfilter != NULL); + SCIP_CALL( SCIPeventChgType(&event, SCIP_EVENTTYPE_LHOLEADDED) ); + SCIP_CALL( SCIPeventProcess(&event, set, NULL, NULL, NULL, var->eventfilter) ); +#endif + /* process parent variables */ for( i = 0; i < var->nparentvars; ++i ) {