From 1374c2cab92ea042e804de2ef3a9c1e0502e0446 Mon Sep 17 00:00:00 2001 From: Suresh Bolusani Date: Wed, 9 Oct 2024 14:44:42 +0200 Subject: [PATCH 1/3] Typo fix for SCIP++ description in the interfaces section in docu --- doc/xternal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/xternal.c b/doc/xternal.c index be3e731c7d..de5b69da73 100644 --- a/doc/xternal.c +++ b/doc/xternal.c @@ -8794,7 +8794,7 @@ * to use SCIP and SCIP-SDP from Matlab and Octave. * - JSCIPOpt is an interface for Java. * - Russcip is an interface for Rust. - * - SCIP++ is a modeling interfaces for C++. + * - SCIP++ is a modeling interface for C++. * * Contributions to these projects are very welcome. * From 16e5da58b3dcb89918c8ff602ff14e5759c226ee Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Wed, 9 Oct 2024 17:07:13 +0200 Subject: [PATCH 2/3] add pb to testing --- .gitlab/merge_request_templates/Code_Review.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitlab/merge_request_templates/Code_Review.md b/.gitlab/merge_request_templates/Code_Review.md index d6a6fef118..28f6068634 100644 --- a/.gitlab/merge_request_templates/Code_Review.md +++ b/.gitlab/merge_request_templates/Code_Review.md @@ -21,10 +21,9 @@ ### Testing * [ ] ctest passes without errors (type some of `jenkins ctest {soplex master,soplex bugfix,cplex,gurobi,mosek,xpress,highs}`). -* [ ] The performance impact on MILP has been checked (type some of `jenkins performance {mip,mip quick,mip continue}`), **or** the changed code will not be executed for MILP instances, **or** the changed code will not be executed by default. -* [ ] The performance impact on MINLP has been checked (type some of `jenkins performance {minlp,minlplib,minlp quick,minlp continue}`) **or** the changed code will not be executed by default. +* [ ] The performance impact has been checked (type some of `jenkins performance {mip,minlp,pb} (quick|continue|)`), **or** the changed code will not be executed by default. * [ ] The new code is sufficiently covered by tests (perhaps, new coverage settings or new unit tests have been added). -* Consider a debug run (type some of `jenkins debug {short,minlp,mip}`). +* Consider a debug run (type some of `jenkins debug {short,minlp,mip,pb}`). ### Does this merge request introduce an API change? :warning: From 40f77c4465d8d44e479667783b3503a84c08cb94 Mon Sep 17 00:00:00 2001 From: Dominik Kamp Date: Thu, 10 Oct 2024 22:31:26 +0200 Subject: [PATCH 3/3] Fix strongbranching cutoffs --- src/scip/branch_allfullstrong.c | 14 +++---------- src/scip/scip_prob.c | 8 ++++++-- src/scip/scip_tree.c | 2 ++ src/scip/scip_var.c | 35 +++++++++++++++------------------ src/scip/tree.c | 10 ++++++++-- 5 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/scip/branch_allfullstrong.c b/src/scip/branch_allfullstrong.c index d162b5d946..091209035c 100644 --- a/src/scip/branch_allfullstrong.c +++ b/src/scip/branch_allfullstrong.c @@ -104,10 +104,6 @@ SCIP_RETCODE branch( int npseudocands; int npriopseudocands; int bestpseudocand; -#ifndef NDEBUG - SCIP_Real cutoffbound; - cutoffbound = SCIPgetCutoffbound(scip); -#endif assert(branchrule != NULL); assert(strcmp(SCIPbranchruleGetName(branchrule), BRANCHRULE_NAME) == 0); @@ -165,7 +161,7 @@ SCIP_RETCODE branch( assert(*result == SCIP_DIDNOTRUN); assert(0 <= bestpseudocand && bestpseudocand < npseudocands); - assert(SCIPisLT(scip, provedbound, cutoffbound)); + assert(SCIPisLT(scip, provedbound, SCIPgetCutoffbound(scip))); var = pseudocandscopy[bestpseudocand]; @@ -316,10 +312,6 @@ SCIP_RETCODE SCIPselectVarPseudoStrongBranching( SCIP_Real lpobjval; SCIP_Bool allcolsinlp; SCIP_Bool exactsolve; -#ifndef NDEBUG - SCIP_Real cutoffbound; - cutoffbound = SCIPgetCutoffbound(scip); -#endif assert(scip != NULL); assert(pseudocands != NULL); @@ -442,8 +434,8 @@ SCIP_RETCODE SCIPselectVarPseudoStrongBranching( up = MAX(up, lpobjval); downgain = down - lpobjval; upgain = up - lpobjval; - assert(!allcolsinlp || exactsolve || !downvalid || downinf == SCIPisGE(scip, down, cutoffbound)); - assert(!allcolsinlp || exactsolve || !upvalid || upinf == SCIPisGE(scip, up, cutoffbound)); + assert(!allcolsinlp || exactsolve || !downvalid || downinf == SCIPisGE(scip, down, SCIPgetCutoffbound(scip))); + assert(!allcolsinlp || exactsolve || !upvalid || upinf == SCIPisGE(scip, up, SCIPgetCutoffbound(scip))); assert(downinf || !downconflict); assert(upinf || !upconflict); diff --git a/src/scip/scip_prob.c b/src/scip/scip_prob.c index 799e7a6e35..b5273e737c 100644 --- a/src/scip/scip_prob.c +++ b/src/scip/scip_prob.c @@ -3724,7 +3724,9 @@ SCIP_RETCODE SCIPupdateLocalLowerbound( } /** if given value is tighter (higher for minimization, lower for maximization) than the node's dual bound, sets the - * node's dual bound to the new value. Only applicable to non-leafs because the node priority queue remains untouched. + * node's dual bound to the new value. + * + * @note must not be used on a leaf because the node priority queue remains untouched * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. @@ -3746,7 +3748,9 @@ SCIP_RETCODE SCIPupdateNodeDualbound( } /** if given value is higher than the node's lower bound (in transformed problem), sets the node's lower bound to the - * new value. Only applicable to non-leafs because the node priority queue remains untouched. + * new value. + * + * @note must not be used on a leaf because the node priority queue remains untouched * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. diff --git a/src/scip/scip_tree.c b/src/scip/scip_tree.c index 6b5e1b2662..1b606dfcad 100644 --- a/src/scip/scip_tree.c +++ b/src/scip/scip_tree.c @@ -424,6 +424,8 @@ SCIP_RETCODE SCIPgetOpenNodesData( } /** cuts off node and whole sub tree from branch and bound tree + * + * @note must not be used on a leaf because the node priority queue remains untouched * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. diff --git a/src/scip/scip_var.c b/src/scip/scip_var.c index 2243241516..4d1f5f2f65 100644 --- a/src/scip/scip_var.c +++ b/src/scip/scip_var.c @@ -2946,7 +2946,7 @@ SCIP_RETCODE SCIPgetVarStrongbranchFrac( assert(var != NULL); assert(lperror != NULL); - assert(!SCIPtreeProbing(scip->tree)); /* we should not be in strong branching with propagation mode */ + assert(!SCIPinProbing(scip)); /* we should not be in strong branching with propagation mode */ assert(var->scip == scip); SCIP_CALL( SCIPcheckStage(scip, "SCIPgetVarStrongbranchFrac", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); @@ -3044,15 +3044,13 @@ SCIP_RETCODE SCIPgetVarStrongbranchFrac( { if( !idempotent ) /*lint !e774*/ { - SCIP_CALL( analyzeStrongbranch(scip, var, downinf, upinf, downconflict, upconflict) ); - } - else - { - if( downinf != NULL ) - *downinf = localdownvalid && SCIPsetIsGE(scip->set, localdown, scip->lp->cutoffbound); - if( upinf != NULL ) - *upinf = localupvalid && SCIPsetIsGE(scip->set, localup, scip->lp->cutoffbound); + SCIP_CALL( analyzeStrongbranch(scip, var, NULL, NULL, downconflict, upconflict) ); } + + if( downinf != NULL ) + *downinf = localdownvalid && SCIPsetIsGE(scip->set, localdown, scip->lp->cutoffbound); + if( upinf != NULL ) + *upinf = localupvalid && SCIPsetIsGE(scip->set, localup, scip->lp->cutoffbound); } if( down != NULL ) @@ -3766,11 +3764,12 @@ SCIP_RETCODE SCIPgetVarStrongbranchInt( SCIP_Bool localdownvalid; SCIP_Bool localupvalid; - SCIP_CALL( SCIPcheckStage(scip, "SCIPgetVarStrongbranchInt", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); - + assert(var != NULL); assert(lperror != NULL); assert(var->scip == scip); + SCIP_CALL( SCIPcheckStage(scip, "SCIPgetVarStrongbranchInt", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); + lpobjval = SCIPgetLPObjval(scip); if( downvalid != NULL ) *downvalid = FALSE; @@ -3864,15 +3863,13 @@ SCIP_RETCODE SCIPgetVarStrongbranchInt( { if( !idempotent ) /*lint !e774*/ { - SCIP_CALL( analyzeStrongbranch(scip, var, downinf, upinf, downconflict, upconflict) ); - } - else - { - if( downinf != NULL ) - *downinf = localdownvalid && SCIPsetIsGE(scip->set, localdown, scip->lp->cutoffbound); - if( upinf != NULL ) - *upinf = localupvalid && SCIPsetIsGE(scip->set, localup, scip->lp->cutoffbound); + SCIP_CALL( analyzeStrongbranch(scip, var, NULL, NULL, downconflict, upconflict) ); } + + if( downinf != NULL ) + *downinf = localdownvalid && SCIPsetIsGE(scip->set, localdown, scip->lp->cutoffbound); + if( upinf != NULL ) + *upinf = localupvalid && SCIPsetIsGE(scip->set, localup, scip->lp->cutoffbound); } if( down != NULL ) diff --git a/src/scip/tree.c b/src/scip/tree.c index edc62b7ab6..834690b935 100644 --- a/src/scip/tree.c +++ b/src/scip/tree.c @@ -1231,7 +1231,10 @@ SCIP_RETCODE SCIPnodeFree( return SCIP_OKAY; } -/** cuts off node and whole sub tree from branch and bound tree */ +/** cuts off node and whole sub tree from branch and bound tree + * + * @note must not be used on a leaf because the node priority queue remains untouched + */ SCIP_RETCODE SCIPnodeCutoff( SCIP_NODE* node, /**< node that should be cut off */ SCIP_SET* set, /**< global SCIP settings */ @@ -2377,7 +2380,10 @@ SCIP_RETCODE treeApplyPendingBdchgs( return SCIP_OKAY; } -/** if given value is larger than the node's lower bound, sets the node's lower bound to the new value */ +/** if given value is larger than the node's lower bound, sets the node's lower bound to the new value + * + * @note must not be used on a leaf because the node priority queue remains untouched + */ void SCIPnodeUpdateLowerbound( SCIP_NODE* node, /**< node to update lower bound for */ SCIP_STAT* stat, /**< problem statistics */