From 36c2cb818a16f62b9bc0dd034ccee5893b8f0730 Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:00:04 +0100 Subject: [PATCH 01/15] turn off pclint warnings --- pclint/scip.lnt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pclint/scip.lnt b/pclint/scip.lnt index 223e43f37f..8ecf92ebed 100644 --- a/pclint/scip.lnt +++ b/pclint/scip.lnt @@ -142,6 +142,7 @@ -emacro(644,QUAD) -emacro(647,QUAD_ARRAY_SIZE) -emacro(665,QUAD) +-emacro(665,QUAD_MEMBER) -emacro(666,SCIPquadprecProdQD) -emacro(666,SCIPquadprecSumQD) @@ -198,6 +199,7 @@ -emacro(776,SCIPduplicateBufferArray) -emacro(776,SCIPallocClearBufferArray) -emacro(776,SCIPallocBlockMemoryArray) +-emacro(776,SCIPallocClearBlockMemoryArray) -emacro(776,SCIPduplicateBlockMemoryArray) -emacro(776,BMSallocMemorySize) -emacro(776,BMSallocBufferMemoryArray) From 90566744bf66299e2150ba31d08d22d0f840d318 Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:01:02 +0100 Subject: [PATCH 02/15] try to avoid pclint warnings --- src/scip/conflict_dualproofanalysis.c | 2 +- src/scip/cons_knapsack.c | 2 +- src/scip/cons_nonlinear.c | 2 +- src/scip/heur_dps.c | 2 +- src/scip/prop_symmetry.c | 4 ++-- src/scip/symmetry_orbitopal.c | 6 +++--- src/symmetry/build_sassy_graph.cpp | 14 +++++++------- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/scip/conflict_dualproofanalysis.c b/src/scip/conflict_dualproofanalysis.c index a69c46cc3a..b5274ba73d 100644 --- a/src/scip/conflict_dualproofanalysis.c +++ b/src/scip/conflict_dualproofanalysis.c @@ -518,7 +518,7 @@ SCIP_RETCODE tightenSingleVar( SCIP_CALL( SCIPaddCoefLinear(set->scip, cons, var, 1.0) ); - if( applyglobal ) + if( applyglobal ) /*lint !e774*/ { SCIP_CALL( SCIPprobAddCons(transprob, set, stat, cons) ); } diff --git a/src/scip/cons_knapsack.c b/src/scip/cons_knapsack.c index 3f0f603b65..6a00bbc70d 100644 --- a/src/scip/cons_knapsack.c +++ b/src/scip/cons_knapsack.c @@ -13281,7 +13281,7 @@ SCIP_DECL_CONSPARSE(consParseKnapsack) /* try to parse coefficient, and use 1 if not successful */ weight = 1; nread = 0; - sscanf(str, "%" SCIP_LONGINT_FORMAT "%n", &weight, &nread); + (void) sscanf(str, "%" SCIP_LONGINT_FORMAT "%n", &weight, &nread); str += nread; /* parse variable name */ diff --git a/src/scip/cons_nonlinear.c b/src/scip/cons_nonlinear.c index 992711e826..dd24b4adc7 100644 --- a/src/scip/cons_nonlinear.c +++ b/src/scip/cons_nonlinear.c @@ -10435,7 +10435,7 @@ SCIP_RETCODE addSymmetryInformation( SCIP_EXPR** children; int sumidx; int optype; - int childidx = 0; + int childidx; /* sums are handled by a special gadget */ usedefaultgadget = FALSE; diff --git a/src/scip/heur_dps.c b/src/scip/heur_dps.c index 17f09dc6d0..a5323899e7 100644 --- a/src/scip/heur_dps.c +++ b/src/scip/heur_dps.c @@ -1693,7 +1693,7 @@ SCIP_DECL_EVENTEXEC(eventExecDps) assert(event != NULL); assert(SCIPeventGetType(event) & SCIP_EVENTTYPE_LPSOLVED); - SCIPdebugMsg(scip, "dual bound: %0.2f\n", SCIPgetDualbound(scip)); + SCIPdebugMsg(scip, "dual bound: %.2f\n", SCIPgetDualbound(scip)); if( SCIPisFeasGT(scip, SCIPgetDualbound(scip), 0.0) && SCIPgetNSols(scip) >= 1 ) { diff --git a/src/scip/prop_symmetry.c b/src/scip/prop_symmetry.c index a082661f94..9301ce9ead 100644 --- a/src/scip/prop_symmetry.c +++ b/src/scip/prop_symmetry.c @@ -4278,7 +4278,7 @@ SCIP_RETCODE createConflictGraphSST( assert( cliquevars != NULL ); assert( ncliquevars > 0 ); - SCIPdebugMsg(scip, "\tIdentify edges for clique ID: %d; Index: %d).\n", SCIPcliqueGetId(clique), + SCIPdebugMsg(scip, "\tIdentify edges for clique ID: %u; Index: %d).\n", SCIPcliqueGetId(clique), SCIPcliqueGetIndex(clique)); /* for all variables, list which cliques it is part of */ @@ -4321,7 +4321,7 @@ SCIP_RETCODE createConflictGraphSST( assert( cliquevars != NULL ); assert( ncliquevars > 0 ); - SCIPdebugMsg(scip, "\tAdd edges for clique ID: %d; Index: %d).\n", SCIPcliqueGetId(clique), + SCIPdebugMsg(scip, "\tAdd edges for clique ID: %u; Index: %d).\n", SCIPcliqueGetId(clique), SCIPcliqueGetIndex(clique)); /* for all variables, list which cliques it is part of */ diff --git a/src/scip/symmetry_orbitopal.c b/src/scip/symmetry_orbitopal.c index e421adde49..e5019f33c3 100644 --- a/src/scip/symmetry_orbitopal.c +++ b/src/scip/symmetry_orbitopal.c @@ -930,7 +930,7 @@ SCIP_DECL_EVENTEXEC(eventExecNodeBranched) colorderinv, branchvars[i], &tmpcolswap) ); /* skip trivial swaps of columns */ - if ( tmpcolswap.from == tmpcolswap.to ) + if ( tmpcolswap.from == tmpcolswap.to ) /*lint !e644*/ continue; /* mark that this row index is the new one in the node */ @@ -946,8 +946,8 @@ SCIP_DECL_EVENTEXEC(eventExecNodeBranched) newnodeinfo->ncolswaps + 1) ); } thiscolswap = &(newnodeinfo->colswaps[newnodeinfo->ncolswaps++]); - thiscolswap->from = tmpcolswap.from; - thiscolswap->to = tmpcolswap.to; + thiscolswap->from = tmpcolswap.from; /*lint !e644*/ + thiscolswap->to = tmpcolswap.to; /*lint !e644*/ } SCIPfreeBufferArray(scip, &colorder); diff --git a/src/symmetry/build_sassy_graph.cpp b/src/symmetry/build_sassy_graph.cpp index 662eb89ac2..d15273ae0c 100644 --- a/src/symmetry/build_sassy_graph.cpp +++ b/src/symmetry/build_sassy_graph.cpp @@ -170,7 +170,7 @@ SCIP_RETCODE addOrDetermineEffectOfGroupedEdges( } else { - G->add_vertex((unsigned) curcolor, (*degrees)[*internodeid]); + (voi) G->add_vertex((unsigned) curcolor, (*degrees)[*internodeid]); G->add_edge((unsigned) commonnodeidx, (unsigned) *internodeid); for (f = curstart; f < e; ++f) @@ -202,7 +202,7 @@ SCIP_RETCODE addOrDetermineEffectOfGroupedEdges( } else { - G->add_vertex((unsigned) curcolor, (unsigned) (*degrees)[*internodeid]); + (void) G->add_vertex((unsigned) curcolor, (unsigned) (*degrees)[*internodeid]); G->add_edge((unsigned) commonnodeidx, (unsigned) *internodeid); for (f = curstart; f < nneighbors; ++f) @@ -288,11 +288,11 @@ SCIP_RETCODE createOrDetermineSizeGraph( { /* add nodes for variables */ for (j = 0; j < nvarnodestoadd; ++j) - G->add_vertex((unsigned) SCIPgetSymgraphVarnodeColor(graph, j), (*degrees)[j]); + (void) G->add_vertex((unsigned) SCIPgetSymgraphVarnodeColor(graph, j), (*degrees)[j]); /* add nodes for remaining nodes of graph */ for (j = 0; j < SCIPgetSymgraphNNodes(graph); ++j) - G->add_vertex((unsigned) SCIPgetSymgraphNodeColor(graph, j), (*degrees)[nvarnodestoadd + j]); + (void) G->add_vertex((unsigned) SCIPgetSymgraphNodeColor(graph, j), (*degrees)[nvarnodestoadd + j]); } /* determine grouping depending on the number of rhs vs. variables */ @@ -366,7 +366,7 @@ SCIP_RETCODE createOrDetermineSizeGraph( assert( internodeid < *nnodes ); color = SCIPgetSymgraphEdgeColor(graph, e); - G->add_vertex((unsigned) color, (unsigned) (*degrees)[internodeid]); + (void) G->add_vertex((unsigned) color, (unsigned) (*degrees)[internodeid]); G->add_edge((unsigned) first, (unsigned) internodeid); G->add_edge((unsigned) second, (unsigned) internodeid++); @@ -647,7 +647,7 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( { if ( varlabel[j] >= 0 ) { - G->add_vertex((unsigned) j, (*degrees)[nodeshift + varlabel[j]]); + (void) G->add_vertex((unsigned) j, (*degrees)[nodeshift + varlabel[j]]); ++curnnodes; } } @@ -655,7 +655,7 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( /* add nodes for remaining nodes of graph, ensure that colors do not conflict with variable colors */ for (j = 0; j < SCIPgetSymgraphNNodes(graph); ++j) { - G->add_vertex((unsigned) nusedvars + SCIPgetSymgraphNodeColor(graph, j), + (void) G->add_vertex((unsigned) nusedvars + SCIPgetSymgraphNodeColor(graph, j), (*degrees)[nodeshift + nusedvars + j]); ++curnnodes; } From 9ad8a04343119343a50462981cd9d86106aaf11b Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:02:36 +0100 Subject: [PATCH 03/15] try to avoid NULL pclint pointer warnings --- src/scip/nlhdlr_quadratic.c | 1 + src/scip/rbtree.c | 12 ++++++++++++ src/scip/sepa_lagromory.c | 2 ++ src/symmetry/build_sassy_graph.cpp | 12 ++++++++++++ 4 files changed, 27 insertions(+) diff --git a/src/scip/nlhdlr_quadratic.c b/src/scip/nlhdlr_quadratic.c index 995b1b8bcc..225241792f 100644 --- a/src/scip/nlhdlr_quadratic.c +++ b/src/scip/nlhdlr_quadratic.c @@ -2036,6 +2036,7 @@ SCIP_Bool areCoefsNumericsGood( { max = 0.0; min = SCIPinfinity(scip); + assert(coefs4b != NULL); for( j = 0; j < 3; ++j ) { SCIP_Real absval; diff --git a/src/scip/rbtree.c b/src/scip/rbtree.c index 240017a2ba..37ee2562a6 100644 --- a/src/scip/rbtree.c +++ b/src/scip/rbtree.c @@ -56,8 +56,11 @@ void rbRotate( int dir /**< direction of rotation */ ) { + assert(x != NULL); + SCIP_RBTREENODE* p; SCIP_RBTREENODE* y = x->child[OPPOSITE(dir)]; + x->child[OPPOSITE(dir)] = y->child[dir]; if( y->child[dir] != NULL ) { @@ -85,6 +88,8 @@ void rbInsertFixup( SCIP_RBTREENODE* z /**< inserted node */ ) { + assert(z != NULL); + SCIP_RBTREENODE* p; p = PARENT(z); @@ -94,7 +99,9 @@ void rbInsertFixup( SCIP_RBTREENODE* y; int dir; + assert(p != NULL); pp = PARENT(p); + assert(pp != NULL); dir = p == pp->child[LEFT] ? RIGHT : LEFT; y = pp->child[dir]; @@ -112,10 +119,13 @@ void rbInsertFixup( z = p; rbRotate(root, z, OPPOSITE(dir)); p = PARENT(z); + assert(p != NULL); pp = PARENT(p); } + assert(p != NULL); MAKE_BLACK(p); + assert(pp != NULL); MAKE_RED(pp); rbRotate(root, pp, dir); } @@ -141,6 +151,7 @@ void rbDeleteFixup( int dir; p = PARENT(x == NULL ? nil : x); + assert(p != NULL); dir = x == p->child[LEFT] ? RIGHT : LEFT; w = p->child[dir]; @@ -171,6 +182,7 @@ void rbDeleteFixup( assert(p == PARENT(x == NULL ? nil : x)); w = p->child[dir]; } + assert(w != NULL); SET_COLOR(w, COLOR(p)); MAKE_BLACK(p); MAKE_BLACK(w->child[dir]); diff --git a/src/scip/sepa_lagromory.c b/src/scip/sepa_lagromory.c index edb1623086..43b17fd597 100644 --- a/src/scip/sepa_lagromory.c +++ b/src/scip/sepa_lagromory.c @@ -1357,12 +1357,14 @@ SCIP_RETCODE updateDualVector( /* update Lagrangian multipliers */ for( int i = 0; i < ncuts; i++ ) { + assert( subgradient != NULL ); /* for lint */ dualvector1[i] += steplength * subgradient[i]; } /* projection onto non-negative orthant */ for( int i = 0; i < ncuts; i++ ) { + assert( dualvector1 != NULL ); /* for lint */ dualvector1[i] = MAX(dualvector1[i], 0.0); } diff --git a/src/symmetry/build_sassy_graph.cpp b/src/symmetry/build_sassy_graph.cpp index d15273ae0c..7573a46977 100644 --- a/src/symmetry/build_sassy_graph.cpp +++ b/src/symmetry/build_sassy_graph.cpp @@ -286,6 +286,8 @@ SCIP_RETCODE createOrDetermineSizeGraph( } else { + assert( G != NULL ); + /* add nodes for variables */ for (j = 0; j < nvarnodestoadd; ++j) (void) G->add_vertex((unsigned) SCIPgetSymgraphVarnodeColor(graph, j), (*degrees)[j]); @@ -364,6 +366,7 @@ SCIP_RETCODE createOrDetermineSizeGraph( else { assert( internodeid < *nnodes ); + assert( G != NULL ); color = SCIPgetSymgraphEdgeColor(graph, e); (void) G->add_vertex((unsigned) color, (unsigned) (*degrees)[internodeid]); @@ -382,6 +385,7 @@ SCIP_RETCODE createOrDetermineSizeGraph( } else { + assert( G != NULL ); if ( first < second ) G->add_edge((unsigned) first, (unsigned) second); else @@ -451,6 +455,7 @@ SCIP_RETCODE createOrDetermineSizeGraph( } else { + assert( G != NULL ); for (j = 0; j < nsymvars; ++j) G->add_edge((unsigned) j, (unsigned) j + nsymvars); } @@ -642,6 +647,8 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( } else { + assert( G != NULL ); + /* add nodes for variables, each variable gets a unique color */ for (j = 0; j < nvarnodestoadd; ++j) { @@ -718,6 +725,7 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( else { assert( internodeid < *nnodes ); + assert( G != NULL ); color = SCIPgetSymgraphEdgeColor(graph, e); G->add_vertex((unsigned) nusedvars + color, (unsigned) (*degrees)[internodeid]); @@ -737,6 +745,8 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( } else { + assert( G != NULL ); + if ( first < second ) G->add_edge((unsigned) nodeshift + first, (unsigned) nodeshift + second); else @@ -803,6 +813,8 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( } else { + assert( G != NULL ); + for (j = 0; j < nusedvars/2; ++j) G->add_edge((unsigned) nodeshift + j, (unsigned) nodeshift + j + nusedvars/2); } From 790903fb51c7395836318112506820c5931baf9a Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:03:18 +0100 Subject: [PATCH 04/15] avoid unused return value and parameter --- src/scip/sepa_lagromory.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/scip/sepa_lagromory.c b/src/scip/sepa_lagromory.c index 43b17fd597..678f0a0a2c 100644 --- a/src/scip/sepa_lagromory.c +++ b/src/scip/sepa_lagromory.c @@ -1207,8 +1207,7 @@ void linfBallProjection( * the terminology related to best Lagrangian multipliers) */ static -SCIP_RETCODE weightedDualVector( - SCIP* scip, /**< SCIP data structure */ +void weightedDualVector( SCIP_SEPADATA* sepadata, /**< separator data structure */ SCIP_Real* dualvector, /**< Lagrangian multipliers */ int dualvectorlen, /**< length of the Lagrangian multipliers vector */ @@ -1296,8 +1295,7 @@ SCIP_RETCODE stabilizeDualVector( if( sepadata->stabilitycentertype == 1 ) { /* weighted Lagrangian multipliers based on best Langrangian multipliers as stability center */ - SCIP_CALL( weightedDualVector(scip, sepadata, dualvector, dualvectorlen, bestdualvector, - bestdualvectorlen, nbestdualupdates, totaliternum) ); + weightedDualVector(sepadata, dualvector, dualvectorlen, bestdualvector, bestdualvectorlen, nbestdualupdates, totaliternum); } return SCIP_OKAY; From 2026d450a3856a9fff1f33a41dfd4c6f14c42f36 Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:03:35 +0100 Subject: [PATCH 05/15] fix indentation --- src/scip/pub_implics.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scip/pub_implics.h b/src/scip/pub_implics.h index bcde3455e2..f7010bb05f 100644 --- a/src/scip/pub_implics.h +++ b/src/scip/pub_implics.h @@ -123,7 +123,7 @@ SCIP_Bool SCIPcliqueIsEquation( #define SCIPcliqueGetVars(clique) ((clique)->vars) #define SCIPcliqueGetValues(clique) ((clique)->values) #define SCIPcliqueGetId(clique) ((clique)->id) -#define SCIPcliqueGetIndex(clique) ((clique)->index) +#define SCIPcliqueGetIndex(clique) ((clique)->index) #define SCIPcliqueIsCleanedUp(clique) ((clique)->startcleanup == -1) #define SCIPcliqueIsEquation(clique) ((SCIP_Bool)(clique)->equation) From c00acf67c5595de31bda9bb1f1678e69a81185ef Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:06:14 +0100 Subject: [PATCH 06/15] fix indentation of switch blocks --- src/scip/symmetry_orbital.c | 64 +++++++++++++++++------------------ src/scip/symmetry_orbitopal.c | 36 ++++++++++---------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/scip/symmetry_orbital.c b/src/scip/symmetry_orbital.c index baef2515ea..8c9a74e993 100644 --- a/src/scip/symmetry_orbital.c +++ b/src/scip/symmetry_orbital.c @@ -767,16 +767,16 @@ SCIP_RETCODE applyOrbitalBranchingPropagations( assert( SCIPsymLE(scip, varlbs[varid], varubs[varid]) ); switch (update->boundchgtype) { - case SCIP_BOUNDTYPE_LOWER: - assert( SCIPsymGE(scip, update->newbound, varlbs[varid]) ); - varlbs[varid] = update->newbound; - break; - case SCIP_BOUNDTYPE_UPPER: - assert( SCIPsymLE(scip, update->newbound, varubs[varid]) ); - varubs[varid] = update->newbound; - break; - default: - assert( FALSE ); + case SCIP_BOUNDTYPE_LOWER: + assert( SCIPsymGE(scip, update->newbound, varlbs[varid]) ); + varlbs[varid] = update->newbound; + break; + case SCIP_BOUNDTYPE_UPPER: + assert( SCIPsymLE(scip, update->newbound, varubs[varid]) ); + varubs[varid] = update->newbound; + break; + default: + assert( FALSE ); } assert( SCIPsymLE(scip, varlbs[varid], varubs[varid]) ); } @@ -871,30 +871,30 @@ SCIP_RETCODE applyOrbitalBranchingPropagations( assert( SCIPsymLE(scip, varlbs[branchingdecisionvarid], varubs[branchingdecisionvarid]) ); switch (branchingdecision->boundchgtype) { - case SCIP_BOUNDTYPE_LOWER: - /* incompatible upper bound */ - if ( SCIPsymGT(scip, branchingdecision->newbound, varubs[branchingdecisionvarid]) ) - { - *infeasible = TRUE; - goto FREE; - } + case SCIP_BOUNDTYPE_LOWER: + /* incompatible upper bound */ + if ( SCIPsymGT(scip, branchingdecision->newbound, varubs[branchingdecisionvarid]) ) + { + *infeasible = TRUE; + goto FREE; + } - assert( SCIPsymLE(scip, varlbs[branchingdecisionvarid], branchingdecision->newbound) ); - varlbs[branchingdecisionvarid] = branchingdecision->newbound; - break; - case SCIP_BOUNDTYPE_UPPER: - /* incompatible lower bound */ - if ( SCIPsymLT(scip, branchingdecision->newbound, varlbs[branchingdecisionvarid]) ) - { - *infeasible = TRUE; - goto FREE; - } + assert( SCIPsymLE(scip, varlbs[branchingdecisionvarid], branchingdecision->newbound) ); + varlbs[branchingdecisionvarid] = branchingdecision->newbound; + break; + case SCIP_BOUNDTYPE_UPPER: + /* incompatible lower bound */ + if ( SCIPsymLT(scip, branchingdecision->newbound, varlbs[branchingdecisionvarid]) ) + { + *infeasible = TRUE; + goto FREE; + } - assert( SCIPsymGE(scip, varubs[branchingdecisionvarid], branchingdecision->newbound) ); - varubs[branchingdecisionvarid] = branchingdecision->newbound; - break; - default: - assert( FALSE ); + assert( SCIPsymGE(scip, varubs[branchingdecisionvarid], branchingdecision->newbound) ); + varubs[branchingdecisionvarid] = branchingdecision->newbound; + break; + default: + assert( FALSE ); } /* 3. propagate that branching variable is >= the variables in its orbit diff --git a/src/scip/symmetry_orbitopal.c b/src/scip/symmetry_orbitopal.c index e5019f33c3..269fd7c8fb 100644 --- a/src/scip/symmetry_orbitopal.c +++ b/src/scip/symmetry_orbitopal.c @@ -379,24 +379,24 @@ SCIP_RETCODE updateColumnOrderWhenBranchingOnColumn( */ switch (orbidata->columnordering) { - case SCIP_COLUMNORDERING_FIRST: - /* only swap with c if c is earlier in column order than swaporigcolid */ - if ( colorderinv[c] >= colorderinv[swaporigcolid] ) - goto CONDITIONFAIL; - break; - case SCIP_COLUMNORDERING_LAST: - /* only swap with c if c is later in column order than swaporigcolid */ - if ( colorderinv[c] <= colorderinv[swaporigcolid] ) - goto CONDITIONFAIL; - break; - case SCIP_COLUMNORDERING_CENTRE: - /* if the column is not more central than swaporigcolid, ignore */ - if ( ABS(colorderinv[c] - middlecolumn) >= - ABS(colorderinv[swaporigcolid] - middlecolumn) ) - goto CONDITIONFAIL; - break; - default: - return SCIP_ERROR; + case SCIP_COLUMNORDERING_FIRST: + /* only swap with c if c is earlier in column order than swaporigcolid */ + if ( colorderinv[c] >= colorderinv[swaporigcolid] ) + goto CONDITIONFAIL; + break; + case SCIP_COLUMNORDERING_LAST: + /* only swap with c if c is later in column order than swaporigcolid */ + if ( colorderinv[c] <= colorderinv[swaporigcolid] ) + goto CONDITIONFAIL; + break; + case SCIP_COLUMNORDERING_CENTRE: + /* if the column is not more central than swaporigcolid, ignore */ + if ( ABS(colorderinv[c] - middlecolumn) >= + ABS(colorderinv[swaporigcolid] - middlecolumn) ) + goto CONDITIONFAIL; + break; + default: + return SCIP_ERROR; } /* test: are c and origcolid the same columns w.r.t. the variable domain restrictions? */ From 9027a655dfa40b0ac8597cf878b76e36bd751857 Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:08:33 +0100 Subject: [PATCH 07/15] use SCIPABORT instead of assert( FALSE ) This is to automatically avoid lint warnings. --- src/scip/symmetry_orbital.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scip/symmetry_orbital.c b/src/scip/symmetry_orbital.c index 8c9a74e993..26ca805b80 100644 --- a/src/scip/symmetry_orbital.c +++ b/src/scip/symmetry_orbital.c @@ -776,7 +776,7 @@ SCIP_RETCODE applyOrbitalBranchingPropagations( varubs[varid] = update->newbound; break; default: - assert( FALSE ); + SCIPABORT(); } assert( SCIPsymLE(scip, varlbs[varid], varubs[varid]) ); } @@ -894,7 +894,7 @@ SCIP_RETCODE applyOrbitalBranchingPropagations( varubs[branchingdecisionvarid] = branchingdecision->newbound; break; default: - assert( FALSE ); + SCIPABORT(); } /* 3. propagate that branching variable is >= the variables in its orbit From 121d43e5aa019d2834302327428d3bdcc3d06c6c Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:11:59 +0100 Subject: [PATCH 08/15] avoid goto by using continue continue will continue the outer while loop. It is ignored by switch. --- src/scip/symmetry_orbitopal.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/scip/symmetry_orbitopal.c b/src/scip/symmetry_orbitopal.c index 269fd7c8fb..3bd3af8ae0 100644 --- a/src/scip/symmetry_orbitopal.c +++ b/src/scip/symmetry_orbitopal.c @@ -382,18 +382,18 @@ SCIP_RETCODE updateColumnOrderWhenBranchingOnColumn( case SCIP_COLUMNORDERING_FIRST: /* only swap with c if c is earlier in column order than swaporigcolid */ if ( colorderinv[c] >= colorderinv[swaporigcolid] ) - goto CONDITIONFAIL; + continue; break; case SCIP_COLUMNORDERING_LAST: /* only swap with c if c is later in column order than swaporigcolid */ if ( colorderinv[c] <= colorderinv[swaporigcolid] ) - goto CONDITIONFAIL; + continue; break; case SCIP_COLUMNORDERING_CENTRE: /* if the column is not more central than swaporigcolid, ignore */ if ( ABS(colorderinv[c] - middlecolumn) >= ABS(colorderinv[swaporigcolid] - middlecolumn) ) - goto CONDITIONFAIL; + continue; break; default: return SCIP_ERROR; @@ -405,9 +405,6 @@ SCIP_RETCODE updateColumnOrderWhenBranchingOnColumn( /* the variable domain reductions in c and origcolid are the same */ swaporigcolid = c; - - CONDITIONFAIL: - ; /* no-op for going to the next iteration */ } /* end switch */ From 9440a03be2848ad1025a5506babdd832679500b0 Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:15:48 +0100 Subject: [PATCH 09/15] typo --- src/symmetry/build_sassy_graph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/symmetry/build_sassy_graph.cpp b/src/symmetry/build_sassy_graph.cpp index 7573a46977..c88803b2e8 100644 --- a/src/symmetry/build_sassy_graph.cpp +++ b/src/symmetry/build_sassy_graph.cpp @@ -170,7 +170,7 @@ SCIP_RETCODE addOrDetermineEffectOfGroupedEdges( } else { - (voi) G->add_vertex((unsigned) curcolor, (*degrees)[*internodeid]); + (void) G->add_vertex((unsigned) curcolor, (*degrees)[*internodeid]); G->add_edge((unsigned) commonnodeidx, (unsigned) *internodeid); for (f = curstart; f < e; ++f) From 596c628447fa92b63957cbaa17613cc4426d5e0b Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:27:14 +0100 Subject: [PATCH 10/15] remove unused return --- src/scip/sepa_lagromory.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/scip/sepa_lagromory.c b/src/scip/sepa_lagromory.c index 678f0a0a2c..b56de48423 100644 --- a/src/scip/sepa_lagromory.c +++ b/src/scip/sepa_lagromory.c @@ -1237,8 +1237,6 @@ void weightedDualVector( { dualvector[i] = alpha * dualvector[i]; } - - return SCIP_OKAY; } /** stabilize Lagrangian multipliers */ From 8445d3e32d2ba5bd9c8a6e6acaa51fd64e7b8eeb Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:27:33 +0100 Subject: [PATCH 11/15] one more pclint fix --- src/symmetry/build_sassy_graph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/symmetry/build_sassy_graph.cpp b/src/symmetry/build_sassy_graph.cpp index c88803b2e8..5d3d9d86e5 100644 --- a/src/symmetry/build_sassy_graph.cpp +++ b/src/symmetry/build_sassy_graph.cpp @@ -728,7 +728,7 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( assert( G != NULL ); color = SCIPgetSymgraphEdgeColor(graph, e); - G->add_vertex((unsigned) nusedvars + color, (unsigned) (*degrees)[internodeid]); + (void) G->add_vertex((unsigned) nusedvars + color, (unsigned) (*degrees)[internodeid]); G->add_edge((unsigned) nodeshift + first, (unsigned) internodeid); G->add_edge((unsigned) nodeshift + second, (unsigned) internodeid); } From 3e1be224d3bd4a9c05c425cb483c3dfea989c3b2 Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:30:38 +0100 Subject: [PATCH 12/15] fix add_vertex calls (arguments are ints) --- src/symmetry/build_sassy_graph.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/symmetry/build_sassy_graph.cpp b/src/symmetry/build_sassy_graph.cpp index 5d3d9d86e5..cfb2dfdb19 100644 --- a/src/symmetry/build_sassy_graph.cpp +++ b/src/symmetry/build_sassy_graph.cpp @@ -170,7 +170,7 @@ SCIP_RETCODE addOrDetermineEffectOfGroupedEdges( } else { - (void) G->add_vertex((unsigned) curcolor, (*degrees)[*internodeid]); + (void) G->add_vertex(curcolor, (*degrees)[*internodeid]); G->add_edge((unsigned) commonnodeidx, (unsigned) *internodeid); for (f = curstart; f < e; ++f) @@ -202,7 +202,7 @@ SCIP_RETCODE addOrDetermineEffectOfGroupedEdges( } else { - (void) G->add_vertex((unsigned) curcolor, (unsigned) (*degrees)[*internodeid]); + (void) G->add_vertex(curcolor, (*degrees)[*internodeid]); G->add_edge((unsigned) commonnodeidx, (unsigned) *internodeid); for (f = curstart; f < nneighbors; ++f) @@ -290,11 +290,11 @@ SCIP_RETCODE createOrDetermineSizeGraph( /* add nodes for variables */ for (j = 0; j < nvarnodestoadd; ++j) - (void) G->add_vertex((unsigned) SCIPgetSymgraphVarnodeColor(graph, j), (*degrees)[j]); + (void) G->add_vertex(SCIPgetSymgraphVarnodeColor(graph, j), (*degrees)[j]); /* add nodes for remaining nodes of graph */ for (j = 0; j < SCIPgetSymgraphNNodes(graph); ++j) - (void) G->add_vertex((unsigned) SCIPgetSymgraphNodeColor(graph, j), (*degrees)[nvarnodestoadd + j]); + (void) G->add_vertex(SCIPgetSymgraphNodeColor(graph, j), (*degrees)[nvarnodestoadd + j]); } /* determine grouping depending on the number of rhs vs. variables */ @@ -369,7 +369,7 @@ SCIP_RETCODE createOrDetermineSizeGraph( assert( G != NULL ); color = SCIPgetSymgraphEdgeColor(graph, e); - (void) G->add_vertex((unsigned) color, (unsigned) (*degrees)[internodeid]); + (void) G->add_vertex(color, (*degrees)[internodeid]); G->add_edge((unsigned) first, (unsigned) internodeid); G->add_edge((unsigned) second, (unsigned) internodeid++); @@ -654,7 +654,7 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( { if ( varlabel[j] >= 0 ) { - (void) G->add_vertex((unsigned) j, (*degrees)[nodeshift + varlabel[j]]); + (void) G->add_vertex(j, (*degrees)[nodeshift + varlabel[j]]); ++curnnodes; } } @@ -662,7 +662,7 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( /* add nodes for remaining nodes of graph, ensure that colors do not conflict with variable colors */ for (j = 0; j < SCIPgetSymgraphNNodes(graph); ++j) { - (void) G->add_vertex((unsigned) nusedvars + SCIPgetSymgraphNodeColor(graph, j), + (void) G->add_vertex(nusedvars + SCIPgetSymgraphNodeColor(graph, j), (*degrees)[nodeshift + nusedvars + j]); ++curnnodes; } @@ -728,7 +728,7 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( assert( G != NULL ); color = SCIPgetSymgraphEdgeColor(graph, e); - (void) G->add_vertex((unsigned) nusedvars + color, (unsigned) (*degrees)[internodeid]); + (void) G->add_vertex(nusedvars + color, (*degrees)[internodeid]); G->add_edge((unsigned) nodeshift + first, (unsigned) internodeid); G->add_edge((unsigned) nodeshift + second, (unsigned) internodeid); } From 41d03b9184bf38d07122dbc8bb50b900f34b52ae Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:33:47 +0100 Subject: [PATCH 13/15] fix pclint warning and make code more explicit --- src/symmetry/build_sassy_graph.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/symmetry/build_sassy_graph.cpp b/src/symmetry/build_sassy_graph.cpp index cfb2dfdb19..66a96e4515 100644 --- a/src/symmetry/build_sassy_graph.cpp +++ b/src/symmetry/build_sassy_graph.cpp @@ -298,7 +298,10 @@ SCIP_RETCODE createOrDetermineSizeGraph( } /* determine grouping depending on the number of rhs vs. variables */ - groupByConstraints = SCIPgetSymgraphNConsnodes(graph) < SCIPgetSymgraphNVars(graph); + if ( SCIPgetSymgraphNConsnodes(graph) < SCIPgetSymgraphNVars(graph) ) + groupByConstraints = TRUE; + else + groupByConstraints = FALSE; /* allocate arrays to collect edges to be grouped */ nsymedges = SCIPgetSymgraphNEdges(graph); @@ -606,7 +609,10 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( } /* determine grouping depending on the number of rhs vs. variables */ - groupByConstraints = SCIPgetSymgraphNConsnodes(graph1) < SCIPgetSymgraphNVars(graph1); + if ( SCIPgetSymgraphNConsnodes(graph1) < SCIPgetSymgraphNVars(graph1) ) + groupByConstraints = TRUE; + else + groupByConstraints = FALSE; /* allocate arrays to collect edges to be grouped */ SCIP_CALL( SCIPallocBufferArray(scip, &groupfirsts, nsymedges) ); From 5aaa18b88510d4da516a19e9540957afdcfbf4a3 Mon Sep 17 00:00:00 2001 From: Marc Pfetsch Date: Sun, 11 Feb 2024 18:35:19 +0100 Subject: [PATCH 14/15] avoid more pclint warnings --- src/symmetry/build_sassy_graph.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/symmetry/build_sassy_graph.cpp b/src/symmetry/build_sassy_graph.cpp index 66a96e4515..1a4d1a476f 100644 --- a/src/symmetry/build_sassy_graph.cpp +++ b/src/symmetry/build_sassy_graph.cpp @@ -460,7 +460,7 @@ SCIP_RETCODE createOrDetermineSizeGraph( { assert( G != NULL ); for (j = 0; j < nsymvars; ++j) - G->add_edge((unsigned) j, (unsigned) j + nsymvars); + G->add_edge((unsigned) j, (unsigned) (j + nsymvars)); } break; default: @@ -735,8 +735,8 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( color = SCIPgetSymgraphEdgeColor(graph, e); (void) G->add_vertex(nusedvars + color, (*degrees)[internodeid]); - G->add_edge((unsigned) nodeshift + first, (unsigned) internodeid); - G->add_edge((unsigned) nodeshift + second, (unsigned) internodeid); + G->add_edge((unsigned) (nodeshift + first), (unsigned) internodeid); + G->add_edge((unsigned) (nodeshift + second), (unsigned) internodeid); } ++internodeid; ++curnnodes; @@ -754,9 +754,9 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( assert( G != NULL ); if ( first < second ) - G->add_edge((unsigned) nodeshift + first, (unsigned) nodeshift + second); + G->add_edge((unsigned) (nodeshift + first), (unsigned) (nodeshift + second)); else - G->add_edge((unsigned) nodeshift + second, (unsigned) nodeshift + first); + G->add_edge((unsigned) (nodeshift + second), (unsigned) (nodeshift + first)); } } } @@ -822,7 +822,7 @@ SCIP_RETCODE createOrDetermineSizeGraphCheck( assert( G != NULL ); for (j = 0; j < nusedvars/2; ++j) - G->add_edge((unsigned) nodeshift + j, (unsigned) nodeshift + j + nusedvars/2); + G->add_edge((unsigned) (nodeshift + j), (unsigned) (nodeshift + j + nusedvars / 2)); } } nodeshift = curnnodes; From 3f986d1a3513d76e08b19d52ffffb0c45e027fcb Mon Sep 17 00:00:00 2001 From: Christopher Hojny Date: Sun, 11 Feb 2024 19:00:18 +0100 Subject: [PATCH 15/15] Apply 1 suggestion(s) to 1 file(s) --- src/scip/sepa_lagromory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scip/sepa_lagromory.c b/src/scip/sepa_lagromory.c index b56de48423..8279cecaea 100644 --- a/src/scip/sepa_lagromory.c +++ b/src/scip/sepa_lagromory.c @@ -1353,14 +1353,14 @@ SCIP_RETCODE updateDualVector( /* update Lagrangian multipliers */ for( int i = 0; i < ncuts; i++ ) { - assert( subgradient != NULL ); /* for lint */ + assert(subgradient != NULL); /* for lint */ dualvector1[i] += steplength * subgradient[i]; } /* projection onto non-negative orthant */ for( int i = 0; i < ncuts; i++ ) { - assert( dualvector1 != NULL ); /* for lint */ + assert(dualvector1 != NULL); /* for lint */ dualvector1[i] = MAX(dualvector1[i], 0.0); }