@@ -1338,7 +1338,7 @@ SCIP_Real getVariablePscostScore(
13381338 SCIP_Bool uselocallpsol /**< should local LP solution be used? */
13391339 )
13401340{
1341- SCIP_Real lpsolval ;
1341+ SCIP_Real soldiff ;
13421342
13431343 assert (scip != NULL );
13441344 assert (var != NULL );
@@ -1347,13 +1347,13 @@ SCIP_Real getVariablePscostScore(
13471347 if ( SCIPvarGetStatus (var ) != SCIP_VARSTATUS_COLUMN )
13481348 return 0.0 ;
13491349
1350- lpsolval = uselocallpsol ? SCIPvarGetLPSol (var ) : SCIPvarGetRootSol (var );
1350+ soldiff = refsolval - ( uselocallpsol ? SCIPvarGetLPSol (var ) : SCIPvarGetRootSol (var ) );
13511351
13521352 /* the score is 0.0 if the values are equal */
1353- if ( SCIPisEQ (scip , lpsolval , refsolval ) )
1353+ if ( SCIPisFeasZero (scip , soldiff ) )
13541354 return 0.0 ;
13551355 else
1356- return SCIPgetVarPseudocostVal (scip , var , refsolval - lpsolval );
1356+ return SCIPgetVarPseudocostVal (scip , var , soldiff );
13571357}
13581358
13591359/** add variable and solution value to buffer data structure for variable fixings. The method checks if
@@ -1370,12 +1370,8 @@ void tryAdd2variableBuffer(
13701370 SCIP_Bool integer /**< is this an integer variable? */
13711371 )
13721372{
1373- /* todo: this assert can fail when there was a dual reduction that changed a variable to
1374- * an integral type after the reference solution was found and the variable has a fractional
1375- * value in this solution, e.g., for boxQP instances (spar*)
1376- * implicit integer variables could also be an issue, as they can take fractional values in feasible solutions
1377- */
1378- assert (SCIPisFeasIntegral (scip , val ) || ! SCIPvarIsIntegral (var ));
1373+ assert (integer == (SCIPvarGetType (var ) == SCIP_VARTYPE_BINARY || SCIPvarGetType (var ) == SCIP_VARTYPE_INTEGER ));
1374+ assert (!integer || SCIPisFeasIntegral (scip , val ));
13791375 assert (* nfixings < SCIPgetNVars (scip ));
13801376
13811377 /* round the value to its nearest integer */
@@ -2774,9 +2770,13 @@ DECL_VARFIXINGS(varFixingsRens)
27742770 /* loop over binary and integer variables; determine those that should be fixed in the sub-SCIP */
27752771 for ( nfracs = 0 , i = 0 ; i < nbinvars + nintvars ; ++ i )
27762772 {
2777- SCIP_VAR * var = vars [i ];
2778- SCIP_Real lpsolval = SCIPvarGetLPSol (var );
2779- assert ((i < nbinvars && SCIPvarIsBinary (var )) || (i >= nbinvars && SCIPvarIsIntegral (var )));
2773+ SCIP_VAR * var ;
2774+ SCIP_Real lpsolval ;
2775+
2776+ var = vars [i ];
2777+ assert (SCIPvarGetType (var ) == SCIP_VARTYPE_BINARY || SCIPvarGetType (var ) == SCIP_VARTYPE_INTEGER );
2778+ assert ((i < nbinvars ) == (SCIPvarGetType (var ) == SCIP_VARTYPE_BINARY ));
2779+ lpsolval = SCIPvarGetLPSol (var );
27802780
27812781 /* fix all binary and integer variables with integer LP solution value */
27822782 if ( SCIPisFeasIntegral (scip , lpsolval ) )
@@ -2897,19 +2897,19 @@ SCIP_RETCODE fixMatchingSolutionValues(
28972897 /* loop over integer and binary variables and check if their solution values match in all solutions */
28982898 for ( v = 0 ; v < nvars ; ++ v )
28992899 {
2900- SCIP_Real solval ;
29012900 SCIP_VAR * var ;
2901+ SCIP_Real solval ;
29022902 int s ;
29032903
29042904 var = vars [v ];
2905- assert ((v < SCIPgetNBinVars (scip ) && SCIPvarIsBinary (var )) || (v >= SCIPgetNBinVars (scip ) && SCIPvarIsIntegral (var )));
2905+ assert (SCIPvarGetType (var ) == SCIP_VARTYPE_BINARY || SCIPvarGetType (var ) == SCIP_VARTYPE_INTEGER );
2906+ assert ((v < SCIPgetNBinVars (scip )) == (SCIPvarGetType (var ) == SCIP_VARTYPE_BINARY ));
29062907 solval = SCIPgetSolVal (scip , firstsol , var );
29072908
29082909 /* determine if solution values match in all given solutions */
29092910 for ( s = 1 ; s < nsols ; ++ s )
29102911 {
2911- SCIP_Real solval2 = SCIPgetSolVal (scip , sols [s ], var );
2912- if ( ! SCIPisEQ (scip , solval , solval2 ) )
2912+ if ( !SCIPisFeasZero (scip , solval - SCIPgetSolVal (scip , sols [s ], var )) )
29132913 break ;
29142914 }
29152915
@@ -2961,8 +2961,9 @@ DECL_VARFIXINGS(varFixingsRins)
29612961 if ( nbinvars + nintvars == 0 )
29622962 return SCIP_OKAY ;
29632963
2964- sols [0 ] = NULL ;
2965- sols [1 ] = incumbent ;
2964+ /* incumbent is reference */
2965+ sols [0 ] = incumbent ;
2966+ sols [1 ] = NULL ;
29662967
29672968 SCIP_CALL ( fixMatchingSolutionValues (scip , sols , 2 , vars , nbinvars + nintvars , varbuf , valbuf , nfixings ) );
29682969
@@ -3518,11 +3519,11 @@ DECL_VARFIXINGS(varFixingsDins)
35183519 nsols = nmipsols + 2 ;
35193520
35203521 SCIP_CALL ( SCIPallocBufferArray (scip , & sols , nsols ) );
3521- sols [0 ] = NULL ; /* node LP solution */
3522- sols [1 ] = rootlpsol ;
35233522
3524- /* copy the remaining MIP solutions after the LP solutions */
3525- BMScopyMemoryArray (& sols [2 ], SCIPgetSols (scip ), nmipsols ); /*lint !e866*/
3523+ /* incumbent is reference */
3524+ BMScopyMemoryArray (sols , SCIPgetSols (scip ), nmipsols ); /*lint !e866*/
3525+ sols [nmipsols ] = NULL ;
3526+ sols [nmipsols + 1 ] = rootlpsol ;
35263527
35273528 /* 1. Binary variables are fixed if their values agree in all the solutions */
35283529 if ( nbinvars > 0 )
0 commit comments