@@ -1939,7 +1939,6 @@ void checkRedundancySide(
1939
1939
SCIP_Real valuey2 ;
1940
1940
SCIP_Bool * redundant0 ;
1941
1941
SCIP_Bool * redundant1 ;
1942
- SCIP_Real eps = SCIPepsilon (scip );
1943
1942
1944
1943
assert (scip != NULL );
1945
1944
assert (var != NULL );
@@ -1948,8 +1947,8 @@ void checkRedundancySide(
1948
1947
assert (cons0sidered != NULL );
1949
1948
assert (cons1sidered != NULL );
1950
1949
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 );
1953
1952
* sideequal = FALSE;
1954
1953
1955
1954
if ( islhs )
@@ -1994,7 +1993,7 @@ void checkRedundancySide(
1994
1993
}
1995
1994
1996
1995
/* calculate important values for variables */
1997
- if ( SCIPisPositive ( scip , coef0 ) )
1996
+ if ( coef0 > 0.0 )
1998
1997
{
1999
1998
valuex1 = MIN (boundvaluex1 , ubvar );
2000
1999
valuex1 = MAX (valuex1 , lbvar );
@@ -2004,10 +2003,8 @@ void checkRedundancySide(
2004
2003
/* if variable is of integral type make values integral too */
2005
2004
if ( SCIPvarIsIntegral (var ) )
2006
2005
{
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 );
2011
2008
}
2012
2009
}
2013
2010
else
@@ -2020,10 +2017,8 @@ void checkRedundancySide(
2020
2017
/* if variable is of integral type make values integral too */
2021
2018
if ( SCIPvarIsIntegral (var ) )
2022
2019
{
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 );
2027
2022
}
2028
2023
}
2029
2024
@@ -2032,9 +2027,9 @@ void checkRedundancySide(
2032
2027
valuey2 = (side1 - valuex1 )/coef1 ;
2033
2028
2034
2029
/* determine redundancy of one constraints side */
2035
- if ( valuey1 - valuey2 <= eps )
2030
+ if ( SCIPisEQ ( scip , valuey1 , valuey2 ) )
2036
2031
* sideequal = TRUE;
2037
- else if ( SCIPisPositive ( scip , coef0 ) )
2032
+ else if ( coef0 > 0.0 )
2038
2033
{
2039
2034
if ( valuey1 < valuey2 )
2040
2035
* redundant1 = TRUE;
@@ -2054,58 +2049,66 @@ void checkRedundancySide(
2054
2049
valuey2 = (side1 - valuex2 )/coef1 ;
2055
2050
2056
2051
/* determine redundancy of one constraints side by checking for the first valuex2 */
2057
- if ( SCIPisPositive ( scip , coef0 ) )
2052
+ if ( coef0 > 0.0 )
2058
2053
{
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 )
2068
2056
{
2069
- if ( valuey1 + eps < valuey2 )
2057
+ assert (!(* redundant0 ));
2058
+ assert (!(* redundant1 ));
2059
+
2060
+ if ( SCIPisLT (scip , valuey1 , valuey2 ) )
2070
2061
{
2071
2062
* sideequal = FALSE;
2072
2063
* redundant1 = TRUE;
2073
2064
}
2074
- else if ( valuey1 + eps > valuey2 )
2065
+ else if ( SCIPisGT ( scip , valuey1 , valuey2 ) )
2075
2066
{
2076
2067
* sideequal = FALSE;
2077
2068
* redundant0 = TRUE;
2078
2069
}
2079
2070
}
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 ) ) )
2085
2074
{
2086
- * sideequal = FALSE;
2087
2075
* redundant0 = FALSE;
2088
2076
* redundant1 = FALSE;
2089
2077
return ;
2090
2078
}
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 )
2092
2084
{
2093
- if ( valuey1 + eps < valuey2 )
2085
+ assert (!(* redundant0 ));
2086
+ assert (!(* redundant1 ));
2087
+
2088
+ if ( SCIPisLT (scip , valuey1 , valuey2 ) )
2094
2089
{
2095
2090
* sideequal = FALSE;
2096
2091
* redundant0 = TRUE;
2097
2092
}
2098
- else if ( valuey1 + eps > valuey2 )
2093
+ else if ( SCIPisGT ( scip , valuey1 , valuey2 ) )
2099
2094
{
2100
2095
* sideequal = FALSE;
2101
2096
* redundant1 = TRUE;
2102
2097
}
2103
2098
}
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
+ }
2104
2107
}
2105
2108
assert (* sideequal || * redundant0 || * redundant1 );
2106
2109
2107
2110
/* calculate feasibility domain values for variable y concerning these both constraints */
2108
- if ( SCIPisPositive ( scip , coef0 ) )
2111
+ if ( coef0 > 0.0 )
2109
2112
{
2110
2113
if ( islhs )
2111
2114
{
@@ -2123,10 +2126,8 @@ void checkRedundancySide(
2123
2126
valuey2 = MAX (boundvaluey2 , lbvbdvar );
2124
2127
valuey2 = MIN (valuey2 , ubvbdvar );
2125
2128
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 );
2130
2131
}
2131
2132
else
2132
2133
{
@@ -2146,64 +2147,67 @@ void checkRedundancySide(
2146
2147
valuey2 = MIN (boundvaluey2 , ubvbdvar );
2147
2148
valuey2 = MAX (valuey2 , lbvbdvar );
2148
2149
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 );
2154
2152
}
2155
2153
2156
2154
/* calculate resulting values of variable x by setting y to valuey1 */
2157
2155
valuex1 = side0 - valuey1 * coef0 ;
2158
2156
valuex2 = side1 - valuey1 * coef1 ;
2159
2157
2160
2158
/* 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
- }
2168
2159
if ( * sideequal )
2169
2160
{
2170
- if ( valuex1 + eps < valuex2 )
2161
+ assert (!(* redundant0 ));
2162
+ assert (!(* redundant1 ));
2163
+
2164
+ if ( SCIPisLT (scip , valuex1 , valuex2 ) )
2171
2165
{
2172
2166
* sideequal = FALSE;
2173
2167
* redundant1 = TRUE;
2174
2168
}
2175
- else if ( valuex1 + eps > valuex2 )
2169
+ else if ( SCIPisGT ( scip , valuex1 , valuex2 ) )
2176
2170
{
2177
2171
* sideequal = FALSE;
2178
2172
* redundant0 = TRUE;
2179
2173
}
2180
2174
}
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 ) ) )
2188
2177
{
2189
- * sideequal = FALSE;
2190
2178
* redundant0 = FALSE;
2191
2179
* redundant1 = FALSE;
2192
2180
return ;
2193
2181
}
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 */
2194
2188
if ( * sideequal )
2195
2189
{
2196
- if ( valuex1 + eps < valuex2 )
2190
+ assert (!(* redundant0 ));
2191
+ assert (!(* redundant1 ));
2192
+
2193
+ if ( SCIPisLT (scip , valuex1 , valuex2 ) )
2197
2194
{
2198
2195
* sideequal = FALSE;
2199
2196
* redundant1 = TRUE;
2200
2197
}
2201
- else if ( valuex1 + eps > valuex2 )
2198
+ else if ( SCIPisGT ( scip , valuex1 , valuex2 ) )
2202
2199
{
2203
2200
* sideequal = FALSE;
2204
2201
* redundant0 = TRUE;
2205
2202
}
2206
2203
}
2204
+ else if ( ( * redundant1 && SCIPisGT (scip , valuex1 , valuex2 ) )
2205
+ || ( * redundant0 && SCIPisLT (scip , valuex1 , valuex2 ) ) )
2206
+ {
2207
+ * redundant0 = FALSE;
2208
+ * redundant1 = FALSE;
2209
+ return ;
2210
+ }
2207
2211
assert (* redundant0 || * redundant1 || * sideequal );
2208
2212
}
2209
2213
}
0 commit comments