Skip to content

Commit

Permalink
Merge branch 'follow-up-3409' into 'master'
Browse files Browse the repository at this point in the history
Follow up on !3409

See merge request integer/scip!3602
  • Loading branch information
svigerske committed Dec 1, 2024
2 parents 7704113 + 20c369e commit e4fe24f
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/scip/cons_linear.c
Original file line number Diff line number Diff line change
Expand Up @@ -17947,8 +17947,8 @@ SCIP_RETCODE SCIPcreateConsLinear(
SCIP_CALL( SCIPreallocBufferArray(scip, &consvals, requiredsize) );

SCIP_CALL( SCIPgetProbvarLinearSum(scip, consvars, consvals, &nconsvars, requiredsize, &constant, &requiredsize) );
assert(requiredsize <= nconsvars);
}
assert(requiredsize == nconsvars);

/* adjust sides and check that we do not subtract infinity values */
if( SCIPisInfinity(scip, REALABS(constant)) )
Expand Down Expand Up @@ -18165,8 +18165,8 @@ SCIP_RETCODE SCIPcopyConsLinear(
SCIP_CALL( SCIPreallocBufferArray(scip, &coefs, requiredsize) );

SCIP_CALL( SCIPgetProbvarLinearSum(sourcescip, vars, coefs, &nvars, requiredsize, &constant, &requiredsize) );
assert(requiredsize <= nvars);
}
assert(requiredsize == nvars);
}
else
{
Expand Down Expand Up @@ -18263,8 +18263,8 @@ SCIP_RETCODE SCIPaddCoefLinear(
SCIP_CALL( SCIPreallocBufferArray(scip, &consvals, requiredsize) );

SCIP_CALL( SCIPgetProbvarLinearSum(scip, consvars, consvals, &nconsvars, requiredsize, &constant, &requiredsize) );
assert(requiredsize <= nconsvars);
}
assert(requiredsize == nconsvars);

consdata = SCIPconsGetData(cons);
assert(consdata != NULL);
Expand Down
4 changes: 2 additions & 2 deletions src/scip/cons_logicor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,9 +1014,9 @@ SCIP_RETCODE applyFixings(
size = requiredsize;

SCIP_CALL( SCIPgetProbvarLinearSum(scip, consvars, consvals, &nconsvars, size, &constant, &requiredsize) );
assert(nconsvars <= size);
assert(requiredsize <= size);
}
assert(requiredsize == nconsvars);

easycase = FALSE;

Expand Down Expand Up @@ -1092,9 +1092,9 @@ SCIP_RETCODE applyFixings(
size = requiredsize;

SCIP_CALL( SCIPgetProbvarLinearSum(scip, consvars, consvals, &nconsvars, size, &constant, &requiredsize) );
assert(nconsvars <= size);
assert(requiredsize <= size);
}
assert(requiredsize == nconsvars);

lhs = 1.0 - constant;
rhs = SCIPinfinity(scip);
Expand Down
6 changes: 3 additions & 3 deletions src/scip/cons_pseudoboolean.c
Original file line number Diff line number Diff line change
Expand Up @@ -5102,9 +5102,8 @@ SCIP_RETCODE correctConshdlrdata(
activescalars[0] = 1.0;
activeconstant = 0.0;
nactivevars = 1;
SCIP_CALL( SCIPgetProbvarLinearSum(scip, activevars, activescalars, &nactivevars, nvars,
&activeconstant, &requiredsize) );
assert(requiredsize <= nvars);
SCIP_CALL( SCIPgetProbvarLinearSum(scip, activevars, activescalars, &nactivevars, nvars, &activeconstant, &requiredsize) );
assert(requiredsize == nactivevars);

for( i = 0; i < nactivevars && del; ++i )
{
Expand Down Expand Up @@ -5619,6 +5618,7 @@ SCIP_RETCODE tryUpgradingXor(

/* get linear active representation */
SCIP_CALL( SCIPgetProbvarLinearSum(scip, linvars, lincoefs, &nlinvars, MAXNVARS, &constant, &requiredsize) );
assert(requiredsize == nlinvars);
SCIP_CALL( SCIPduplicateBufferArray(scip, &activelinvars, linvars, nlinvars) );

if( requiredsize > MAXNVARS )
Expand Down
6 changes: 3 additions & 3 deletions src/scip/cons_setppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ SCIP_RETCODE applyFixings(
SCIP_CALL( SCIPgetProbvarLinearSum(scip, consvars, consvals, &nconsvars, consvarssize, &constant, &requiredsize) );
assert(requiredsize <= consvarssize);
}
assert(nconsvars <= consvarssize);
assert(requiredsize == nconsvars);

easycase = FALSE;

Expand Down Expand Up @@ -1988,9 +1988,9 @@ SCIP_RETCODE applyFixings(
SCIP_CALL( SCIPreallocBufferArray(scip, &consvals, size) );

SCIP_CALL( SCIPgetProbvarLinearSum(scip, consvars, consvals, &nconsvars, size, &constant, &requiredsize) );
assert(requiredsize == size);
assert(requiredsize <= size);
}
assert(nconsvars <= size);
assert(requiredsize == nconsvars);

/* compute sides */
if( (SCIP_SETPPCTYPE)consdata->setppctype == SCIP_SETPPCTYPE_PACKING )
Expand Down
1 change: 1 addition & 0 deletions src/scip/cons_sos1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2813,6 +2813,7 @@ SCIP_RETCODE tightenVarsBoundsSOS1(

SCIP_CALL( SCIPgetProbvarLinearSum(scip, trafolinvars, trafolinvals, &ntrafolinvars, requiredsize, &constant, &requiredsize) );
}
assert(requiredsize == ntrafolinvars);
if( !SCIPisInfinity(scip, -trafolhs) )
trafolhs -= constant;
if( !SCIPisInfinity(scip, traforhs) )
Expand Down
3 changes: 2 additions & 1 deletion src/scip/expr_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ SCIP_DECL_EXPRSIMPLIFY(simplifyVar)
SCIP_CALL( SCIPreallocBufferArray(scip, &coefs, requsize) );
varssize = requsize;
SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, coefs, &nvars, varssize, &constant, &requsize) );
assert(requsize <= nvars);
assert(requsize <= varssize);
}
assert(requsize == nvars);
}

/* create expression for constant + sum coefs_i vars_i */
Expand Down
2 changes: 1 addition & 1 deletion src/scip/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ SCIP_RETCODE getActiveVariables(

/* call function a second time with enough memory */
SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, requiredsize, constant, &requiredsize) );
assert(requiredsize <= *nvars);
}
assert(requiredsize == *nvars);

return SCIP_OKAY;
}
Expand Down
2 changes: 2 additions & 0 deletions src/scip/prop_genvbounds.c
Original file line number Diff line number Diff line change
Expand Up @@ -2494,7 +2494,9 @@ SCIP_DECL_PROPEXITPRE(propExitpreGenvbounds)
}

SCIP_CALL( SCIPgetProbvarLinearSum(scip, genvbound->vars, genvbound->coefs, &genvbound->ncoefs, requiredsize, &genvbound->constant, &requiredsize) );
assert(requiredsize <= genvbound->coefssize);
}
assert(requiredsize == genvbound->ncoefs);

/* capture new and release old variables */
for( j = 0; j < genvbound->ncoefs; ++j )
Expand Down
2 changes: 1 addition & 1 deletion src/scip/reader_ccg.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ SCIP_RETCODE getActiveVariables(
SCIP_CALL( SCIPreallocBufferArray(scip, &scalars, requiredsize) );

SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, scalars, nvars, requiredsize, constant, &requiredsize) );
assert( requiredsize <= *nvars );
}
assert( requiredsize == *nvars );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/scip/reader_fzn.c
Original file line number Diff line number Diff line change
Expand Up @@ -3891,8 +3891,8 @@ SCIP_RETCODE getActiveVariables(
SCIP_CALL( SCIPreallocBufferArray(scip, scalars, requiredsize) );

SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, requiredsize, constant, &requiredsize) );
assert( requiredsize <= *nvars );
}
assert( requiredsize == *nvars );
}
else
{
Expand Down
1 change: 1 addition & 0 deletions src/scip/reader_gms.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ SCIP_RETCODE getActiveVariables(
SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, *varssize, constant, &requiredsize) );
assert(requiredsize <= *varssize);
}
assert(requiredsize == *nvars);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/scip/reader_lp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2545,8 +2545,8 @@ SCIP_RETCODE getActiveVariables(
SCIP_CALL( SCIPreallocBufferArray(scip, scalars, requiredsize) );

SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, requiredsize, constant, &requiredsize) );
assert( requiredsize <= *nvars );
}
assert( requiredsize == *nvars );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/scip/reader_mps.c
Original file line number Diff line number Diff line change
Expand Up @@ -2969,8 +2969,8 @@ SCIP_RETCODE getLinearCoeffs(
SCIP_CALL( SCIPreallocBufferArray(scip, &activevals, requiredsize) );

SCIP_CALL( SCIPgetProbvarLinearSum(scip, activevars, activevals, &nactivevars, requiredsize, &activeconstant, &requiredsize) );
assert( requiredsize <= nactivevars );
}
assert( requiredsize == nactivevars );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/scip/reader_opb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1795,8 +1795,8 @@ SCIP_RETCODE getActiveVariables(
SCIP_CALL( SCIPreallocBufferArray(scip, &scalars, requiredsize) );

SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, scalars, nvars, requiredsize, constant, &requiredsize) );
assert( requiredsize <= *nvars );
}
assert( requiredsize == *nvars );
}
else
for( v = 0; v < *nvars; ++v )
Expand Down
2 changes: 1 addition & 1 deletion src/scip/reader_pbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ SCIP_RETCODE getActiveVariables(
SCIP_CALL( SCIPreallocBufferArray(scip, &scalars, requiredsize) );

SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, scalars, nvars, requiredsize, constant, &requiredsize) );
assert(requiredsize <= *nvars);
}
assert(requiredsize == *nvars);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/scip/reader_pip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1766,8 +1766,8 @@ SCIP_RETCODE getActiveVariables(
SCIP_CALL( SCIPreallocBufferArray(scip, scalars, requiredsize) );

SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, requiredsize, constant, &requiredsize) );
assert( requiredsize <= *nvars );
}
assert( requiredsize == *nvars );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/scip/reader_ppm.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ SCIP_RETCODE getActiveVariables(
SCIP_CALL( SCIPreallocBufferArray(scip, &scalars, requiredsize) );

SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, scalars, nvars, requiredsize, constant, &requiredsize) );
assert( requiredsize <= *nvars );
}
assert( requiredsize == *nvars );
}
else
{
Expand Down
1 change: 1 addition & 0 deletions src/scip/symmetry_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -1865,6 +1865,7 @@ SCIP_RETCODE SCIPgetSymActiveVariables(

SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, requiredsize, constant, &requiredsize) );
}
assert( requiredsize == *nvars );
}
else
{
Expand Down
6 changes: 4 additions & 2 deletions src/scip/var.c
Original file line number Diff line number Diff line change
Expand Up @@ -4190,8 +4190,7 @@ SCIP_RETCODE SCIPvarGetActiveRepresentatives(
* actual size, but this would need another loop through the active variables. We therefore take the upper bound. */

/* return results */
*requiredsize = nactivevars;
if( varssize >= *requiredsize )
if( varssize >= nactivevars )
{
assert(vars != NULL);

Expand Down Expand Up @@ -4232,6 +4231,8 @@ SCIP_RETCODE SCIPvarGetActiveRepresentatives(
/* clean buffer again */
tmpscalars[var->index] = 0.0;
}
/* set requiredsize to space actually needed */
*requiredsize = *nvars;
}
else
{
Expand All @@ -4242,6 +4243,7 @@ SCIP_RETCODE SCIPvarGetActiveRepresentatives(
assert( 0 <= var->index && var->index < ntotalvars );
tmpscalars[var->index] = 0.0;
}
*requiredsize = nactivevars;
}

assert(SCIPsetIsInfinity(set, *constant) == ((*constant) == SCIPsetInfinity(set))); /*lint !e777*/
Expand Down

0 comments on commit e4fe24f

Please sign in to comment.