Skip to content

Commit dfcdddc

Browse files
committed
Merge branch '3750-fix-fulldualpresolve-assertion' into 'v91-bugfix'
Resolve "fullDualPresolve: Assertion `SCIPvarGetNLocksDownType(vars[v], SCIP_LOCKTYPE_MODEL) >= nlocksdown[v]' failed." See merge request integer/scip!3510
2 parents aef66f0 + 5529eed commit dfcdddc

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

Diff for: src/scip/cons_linear.c

+14-13
Original file line numberDiff line numberDiff line change
@@ -898,18 +898,16 @@ SCIP_RETCODE consdataCreate(
898898
constant = 0.0;
899899
if( nvars > 0 )
900900
{
901-
int k;
902-
903901
SCIP_VAR** varsbuffer;
904902
SCIP_Real* valsbuffer;
905903

906904
/* copy variables into temporary buffer */
907905
SCIP_CALL( SCIPallocBufferArray(scip, &varsbuffer, nvars) );
908906
SCIP_CALL( SCIPallocBufferArray(scip, &valsbuffer, nvars) );
909-
k = 0;
907+
nvars = 0;
910908

911909
/* loop over variables and sort out fixed ones */
912-
for( v = 0; v < nvars; ++v )
910+
for( v = 0; v < (*consdata)->nvars; ++v )
913911
{
914912
SCIP_VAR* var;
915913
SCIP_Real val;
@@ -927,9 +925,9 @@ SCIP_RETCODE consdataCreate(
927925
}
928926
else
929927
{
930-
varsbuffer[k] = var;
931-
valsbuffer[k] = val;
932-
k++;
928+
varsbuffer[nvars] = var;
929+
valsbuffer[nvars] = val;
930+
++nvars;
933931

934932
/* update hascontvar and hasnonbinvar flags */
935933
if( !(*consdata)->hascontvar )
@@ -947,14 +945,14 @@ SCIP_RETCODE consdataCreate(
947945
}
948946
}
949947
}
950-
(*consdata)->nvars = k;
948+
(*consdata)->nvars = nvars;
951949

952-
if( k > 0 )
950+
if( nvars > 0 )
953951
{
954952
/* copy the possibly reduced buffer arrays into block */
955-
SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(*consdata)->vars, varsbuffer, k) );
956-
SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(*consdata)->vals, valsbuffer, k) );
957-
(*consdata)->varssize = k;
953+
SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(*consdata)->vars, varsbuffer, nvars) );
954+
SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(*consdata)->vals, valsbuffer, nvars) );
955+
(*consdata)->varssize = nvars;
958956
}
959957
/* free temporary buffer */
960958
SCIPfreeBufferArray(scip, &valsbuffer);
@@ -3946,7 +3944,8 @@ SCIP_RETCODE chgCoefPos(
39463944
locked = SCIPconsIsLockedType(cons, (SCIP_LOCKTYPE) i);
39473945

39483946
/* if necessary, update the rounding locks of the variable */
3949-
if( locked && newval * val < 0.0 )
3947+
if( locked && ( !SCIPisNegative(scip, val) || !SCIPisNegative(scip, newval) )
3948+
&& ( !SCIPisPositive(scip, val) || !SCIPisPositive(scip, newval) ) )
39503949
{
39513950
assert(SCIPconsIsTransformed(cons));
39523951

@@ -14773,7 +14772,9 @@ SCIP_RETCODE fullDualPresolve(
1477314772
int arrayindex;
1477414773

1477514774
var = consdata->vars[i];
14775+
assert(var != NULL);
1477614776
val = consdata->vals[i];
14777+
assert(!SCIPisZero(scip, val));
1477714778

1477814779
/* check if still all integer variables have integral coefficients */
1477914780
if( SCIPvarIsIntegral(var) )

0 commit comments

Comments
 (0)