Skip to content

Commit 843b56f

Browse files
committed
Merge remote-tracking branch 'origin/v9-minor'
2 parents b762394 + baed270 commit 843b56f

File tree

5 files changed

+88
-64
lines changed

5 files changed

+88
-64
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ Fixed bugs
346346
- fixed update of consssorted flags in a variable expressions data when adding an additional constraint using this variable
347347
- corrected computation of number of variables affected by symmetry
348348
- fixed computation of symmetry group size
349+
- correct equality comparisons in checkRedundancySide() of cons_varbound.c to ensure pair redundancy
349350

350351
Build system
351352
------------

check/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ set(pairs_Issue
559559
"instances/Issue/3908.cip\;-20317.1313131313\;subrestart"
560560
"instances/Issue/3911.cip\;-30386.2338470598\;lexdual"
561561
"instances/Issue/3917.cip\;+infinity\;default"
562+
"instances/Issue/3920.cip\;0\;presolving_milp_off"
562563
)
563564

564565
#
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
presolving/milp/maxrounds = 0

check/instances/Issue/3920.cip

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
STATISTICS
2+
Problem name : seed
3+
Variables : 2 (0 binary, 1 integer, 0 implicit integer, 1 continuous)
4+
Constraints : 0 initial, 6 maximal
5+
OBJECTIVE
6+
Sense : minimize
7+
VARIABLES
8+
[integer] <x0>: obj=0, original bounds=[-200,200]
9+
[continuous] <x1>: obj=0, original bounds=[-200,200]
10+
CONSTRAINTS
11+
[linear] <_C1>: +36<x0>[I] +68<x1>[C] <= 3970;
12+
[linear] <_C10>: -38<x0>[I] +6<x1>[C] >= -284;
13+
[linear] <_C12>: +90<x0>[I] +44<x1>[C] <= -2928;
14+
[linear] <_C13>: -28<x0>[I] -96<x1>[C] <= -1798;
15+
[linear] <_C16>: -45.3<x0>[I] -43.73<x1>[C] <= 3067.13;
16+
[linear] <_C24>: +24.33<x0>[I] +79.04<x1>[C] <= 1342.84950662;
17+
END

src/scip/cons_varbound.c

Lines changed: 68 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,7 +1939,6 @@ void checkRedundancySide(
19391939
SCIP_Real valuey2;
19401940
SCIP_Bool* redundant0;
19411941
SCIP_Bool* redundant1;
1942-
SCIP_Real eps = SCIPepsilon(scip);
19431942

19441943
assert(scip != NULL);
19451944
assert(var != NULL);
@@ -1948,8 +1947,8 @@ void checkRedundancySide(
19481947
assert(cons0sidered != NULL);
19491948
assert(cons1sidered != NULL);
19501949

1951-
*cons0sidered = SCIPisInfinity(scip, REALABS(side0));
1952-
*cons1sidered = SCIPisInfinity(scip, REALABS(side1));
1950+
*cons0sidered = SCIPisInfinity(scip, islhs ? -side0 : side0);
1951+
*cons1sidered = SCIPisInfinity(scip, islhs ? -side1 : side1);
19531952
*sideequal = FALSE;
19541953

19551954
if( islhs )
@@ -1994,7 +1993,7 @@ void checkRedundancySide(
19941993
}
19951994

19961995
/* calculate important values for variables */
1997-
if( SCIPisPositive(scip, coef0) )
1996+
if( coef0 > 0.0 )
19981997
{
19991998
valuex1 = MIN(boundvaluex1, ubvar);
20001999
valuex1 = MAX(valuex1, lbvar);
@@ -2004,10 +2003,8 @@ void checkRedundancySide(
20042003
/* if variable is of integral type make values integral too */
20052004
if( SCIPvarIsIntegral(var) )
20062005
{
2007-
if( !SCIPisFeasIntegral(scip, valuex1) )
2008-
valuex1 = SCIPfeasFloor(scip, valuex1);
2009-
if( !SCIPisFeasIntegral(scip, valuex2) )
2010-
valuex2 = SCIPfeasCeil(scip, valuex2);
2006+
valuex1 = SCIPfeasFloor(scip, valuex1);
2007+
valuex2 = SCIPfeasCeil(scip, valuex2);
20112008
}
20122009
}
20132010
else
@@ -2020,10 +2017,8 @@ void checkRedundancySide(
20202017
/* if variable is of integral type make values integral too */
20212018
if( SCIPvarIsIntegral(var) )
20222019
{
2023-
if( !SCIPisFeasIntegral(scip, valuex1) )
2024-
valuex1 = SCIPfeasCeil(scip, valuex1);
2025-
if( !SCIPisFeasIntegral(scip, valuex2) )
2026-
valuex2 = SCIPfeasFloor(scip, valuex2);
2020+
valuex1 = SCIPfeasCeil(scip, valuex1);
2021+
valuex2 = SCIPfeasFloor(scip, valuex2);
20272022
}
20282023
}
20292024

@@ -2032,9 +2027,9 @@ void checkRedundancySide(
20322027
valuey2 = (side1 - valuex1)/coef1;
20332028

20342029
/* determine redundancy of one constraints side */
2035-
if( valuey1 - valuey2 <= eps )
2030+
if( SCIPisEQ(scip, valuey1, valuey2) )
20362031
*sideequal = TRUE;
2037-
else if( SCIPisPositive(scip, coef0) )
2032+
else if( coef0 > 0.0 )
20382033
{
20392034
if( valuey1 < valuey2 )
20402035
*redundant1 = TRUE;
@@ -2054,58 +2049,66 @@ void checkRedundancySide(
20542049
valuey2 = (side1 - valuex2)/coef1;
20552050

20562051
/* determine redundancy of one constraints side by checking for the first valuex2 */
2057-
if( SCIPisPositive(scip, coef0) )
2052+
if( coef0 > 0.0 )
20582053
{
2059-
/* if both constraints are weaker than the other on one value, we have no redundancy */
2060-
if( (*redundant1 && valuey1 > valuey2) || (*redundant0 && valuey1 < valuey2) )
2061-
{
2062-
*sideequal = FALSE;
2063-
*redundant0 = FALSE;
2064-
*redundant1 = FALSE;
2065-
return;
2066-
}
2067-
else if( *sideequal )
2054+
/* if both constraints are equal on one value, only consider the other value */
2055+
if( *sideequal )
20682056
{
2069-
if( valuey1 + eps < valuey2 )
2057+
assert(!(*redundant0));
2058+
assert(!(*redundant1));
2059+
2060+
if( SCIPisLT(scip, valuey1, valuey2) )
20702061
{
20712062
*sideequal = FALSE;
20722063
*redundant1 = TRUE;
20732064
}
2074-
else if( valuey1 + eps > valuey2 )
2065+
else if( SCIPisGT(scip, valuey1, valuey2) )
20752066
{
20762067
*sideequal = FALSE;
20772068
*redundant0 = TRUE;
20782069
}
20792070
}
2080-
}
2081-
else
2082-
{
2083-
/* if both constraints are weaker than the other one on one value, we have no redundancy */
2084-
if( (*redundant1 && valuey1 < valuey2) || (*redundant0 && valuey1 > valuey2) )
2071+
/* if both constraints are weaker than the other on one value, we have no redundancy */
2072+
else if( ( *redundant1 && SCIPisGT(scip, valuey1, valuey2) )
2073+
|| ( *redundant0 && SCIPisLT(scip, valuey1, valuey2) ) )
20852074
{
2086-
*sideequal = FALSE;
20872075
*redundant0 = FALSE;
20882076
*redundant1 = FALSE;
20892077
return;
20902078
}
2091-
else if( *sideequal )
2079+
}
2080+
else
2081+
{
2082+
/* if both constraints are equal on one value, only consider the other value */
2083+
if( *sideequal )
20922084
{
2093-
if( valuey1 + eps < valuey2 )
2085+
assert(!(*redundant0));
2086+
assert(!(*redundant1));
2087+
2088+
if( SCIPisLT(scip, valuey1, valuey2) )
20942089
{
20952090
*sideequal = FALSE;
20962091
*redundant0 = TRUE;
20972092
}
2098-
else if( valuey1 + eps > valuey2 )
2093+
else if( SCIPisGT(scip, valuey1, valuey2) )
20992094
{
21002095
*sideequal = FALSE;
21012096
*redundant1 = TRUE;
21022097
}
21032098
}
2099+
/* if both constraints are weaker than the other one on one value, we have no redundancy */
2100+
else if( ( *redundant0 && SCIPisGT(scip, valuey1, valuey2) )
2101+
|| ( *redundant1 && SCIPisLT(scip, valuey1, valuey2) ) )
2102+
{
2103+
*redundant0 = FALSE;
2104+
*redundant1 = FALSE;
2105+
return;
2106+
}
21042107
}
21052108
assert(*sideequal || *redundant0 || *redundant1);
21062109

21072110
/* calculate feasibility domain values for variable y concerning these both constraints */
2108-
if( SCIPisPositive(scip, coef0) )
2111+
if( coef0 > 0.0 )
21092112
{
21102113
if( islhs )
21112114
{
@@ -2123,10 +2126,8 @@ void checkRedundancySide(
21232126
valuey2 = MAX(boundvaluey2, lbvbdvar);
21242127
valuey2 = MIN(valuey2, ubvbdvar);
21252128

2126-
if( !SCIPisFeasIntegral(scip, valuey1) )
2127-
valuey1 = SCIPfeasFloor(scip, valuey1);
2128-
if( !SCIPisFeasIntegral(scip, valuey2) )
2129-
valuey2 = SCIPfeasCeil(scip, valuey2);
2129+
valuey1 = SCIPfeasFloor(scip, valuey1);
2130+
valuey2 = SCIPfeasCeil(scip, valuey2);
21302131
}
21312132
else
21322133
{
@@ -2146,64 +2147,67 @@ void checkRedundancySide(
21462147
valuey2 = MIN(boundvaluey2, ubvbdvar);
21472148
valuey2 = MAX(valuey2, lbvbdvar);
21482149

2149-
/* if variable is of integral type make values integral too */
2150-
if( !SCIPisFeasIntegral(scip, valuey1) )
2151-
valuey1 = SCIPfeasCeil(scip, valuey1);
2152-
if( !SCIPisFeasIntegral(scip, valuey2) )
2153-
valuey2 = SCIPfeasFloor(scip, valuey2);
2150+
valuey1 = SCIPfeasCeil(scip, valuey1);
2151+
valuey2 = SCIPfeasFloor(scip, valuey2);
21542152
}
21552153

21562154
/* calculate resulting values of variable x by setting y to valuey1 */
21572155
valuex1 = side0 - valuey1*coef0;
21582156
valuex2 = side1 - valuey1*coef1;
21592157

21602158
/* determine redundancy of one constraints side by checking for the first valuey1 */
2161-
if( (*redundant1 && valuex1 > valuex2) || (*redundant0 && valuex1 < valuex2) )
2162-
{
2163-
*sideequal = FALSE;
2164-
*redundant0 = FALSE;
2165-
*redundant1 = FALSE;
2166-
return;
2167-
}
21682159
if( *sideequal )
21692160
{
2170-
if( valuex1 + eps < valuex2 )
2161+
assert(!(*redundant0));
2162+
assert(!(*redundant1));
2163+
2164+
if( SCIPisLT(scip, valuex1, valuex2) )
21712165
{
21722166
*sideequal = FALSE;
21732167
*redundant1 = TRUE;
21742168
}
2175-
else if( valuex1 + eps > valuex2 )
2169+
else if( SCIPisGT(scip, valuex1, valuex2) )
21762170
{
21772171
*sideequal = FALSE;
21782172
*redundant0 = TRUE;
21792173
}
21802174
}
2181-
2182-
/* calculate resulting values of variable x by setting y to valuey2 */
2183-
valuex1 = side0 - valuey2*coef0;
2184-
valuex2 = side1 - valuey2*coef1;
2185-
2186-
/* determine redundancy of one constraints side by checking for the first valuey1 */
2187-
if( (*redundant1 && valuex1 > valuex2) || (*redundant0 && valuex1 < valuex2) )
2175+
else if( ( *redundant1 && SCIPisGT(scip, valuex1, valuex2) )
2176+
|| ( *redundant0 && SCIPisLT(scip, valuex1, valuex2) ) )
21882177
{
2189-
*sideequal = FALSE;
21902178
*redundant0 = FALSE;
21912179
*redundant1 = FALSE;
21922180
return;
21932181
}
2182+
2183+
/* calculate resulting values of variable x by setting y to valuey2 */
2184+
valuex1 = side0 - valuey2*coef0;
2185+
valuex2 = side1 - valuey2*coef1;
2186+
2187+
/* determine redundancy of one constraints side by checking for the second valuey2 */
21942188
if( *sideequal )
21952189
{
2196-
if( valuex1 + eps < valuex2 )
2190+
assert(!(*redundant0));
2191+
assert(!(*redundant1));
2192+
2193+
if( SCIPisLT(scip, valuex1, valuex2) )
21972194
{
21982195
*sideequal = FALSE;
21992196
*redundant1 = TRUE;
22002197
}
2201-
else if( valuex1 + eps > valuex2 )
2198+
else if( SCIPisGT(scip, valuex1, valuex2) )
22022199
{
22032200
*sideequal = FALSE;
22042201
*redundant0 = TRUE;
22052202
}
22062203
}
2204+
else if( ( *redundant1 && SCIPisGT(scip, valuex1, valuex2) )
2205+
|| ( *redundant0 && SCIPisLT(scip, valuex1, valuex2) ) )
2206+
{
2207+
*redundant0 = FALSE;
2208+
*redundant1 = FALSE;
2209+
return;
2210+
}
22072211
assert(*redundant0 || *redundant1 || *sideequal);
22082212
}
22092213
}

0 commit comments

Comments
 (0)