@@ -1946,6 +1946,7 @@ void checkRedundancySide(
1946
1946
assert (sideequal != NULL );
1947
1947
assert (cons0sidered != NULL );
1948
1948
assert (cons1sidered != NULL );
1949
+ assert (coef0 * coef1 > 0.0 );
1949
1950
1950
1951
* cons0sidered = SCIPisInfinity (scip , islhs ? - side0 : side0 );
1951
1952
* cons1sidered = SCIPisInfinity (scip , islhs ? - side1 : side1 );
@@ -1963,33 +1964,100 @@ void checkRedundancySide(
1963
1964
}
1964
1965
1965
1966
lbvar = SCIPvarGetLbGlobal (var );
1967
+ assert (!SCIPisInfinity (scip , lbvar ));
1966
1968
ubvar = SCIPvarGetUbGlobal (var );
1969
+ assert (!SCIPisInfinity (scip , - ubvar ));
1967
1970
lbvbdvar = SCIPvarGetLbGlobal (vbdvar );
1971
+ assert (!SCIPisInfinity (scip , lbvbdvar ));
1968
1972
ubvbdvar = SCIPvarGetUbGlobal (vbdvar );
1973
+ assert (!SCIPisInfinity (scip , - ubvbdvar ));
1969
1974
1970
1975
/* if both constraints have this side */
1971
1976
if ( !* redundant0 && !* redundant1 )
1972
1977
{
1973
1978
/* calculate extreme values, which are reached by setting the other variable to their lower/upper bound */
1974
- boundxlb1 = side0 - lbvbdvar * coef0 ;
1975
- boundxlb2 = side1 - lbvbdvar * coef1 ;
1976
- boundylb1 = (side0 - lbvar )/coef0 ;
1977
- boundylb2 = (side1 - lbvar )/coef1 ;
1978
-
1979
- boundxub1 = side0 - ubvbdvar * coef0 ;
1980
- boundxub2 = side1 - ubvbdvar * coef1 ;
1981
- boundyub1 = (side0 - ubvar )/coef0 ;
1982
- boundyub2 = (side1 - ubvar )/coef1 ;
1979
+ if ( SCIPisInfinity (scip , - lbvbdvar ) )
1980
+ {
1981
+ if ( coef0 > 0.0 )
1982
+ {
1983
+ boundxlb1 = SCIPinfinity (scip );
1984
+ boundxlb2 = SCIPinfinity (scip );
1985
+ }
1986
+ else
1987
+ {
1988
+ boundxlb1 = - SCIPinfinity (scip );
1989
+ boundxlb2 = - SCIPinfinity (scip );
1990
+ }
1991
+ }
1992
+ else
1993
+ {
1994
+ boundxlb1 = side0 - lbvbdvar * coef0 ;
1995
+ boundxlb2 = side1 - lbvbdvar * coef1 ;
1996
+ }
1997
+ if ( SCIPisInfinity (scip , - lbvar ) )
1998
+ {
1999
+ if ( coef0 > 0.0 )
2000
+ {
2001
+ boundylb1 = SCIPinfinity (scip );
2002
+ boundylb2 = SCIPinfinity (scip );
2003
+ }
2004
+ else
2005
+ {
2006
+ boundylb1 = - SCIPinfinity (scip );
2007
+ boundylb2 = - SCIPinfinity (scip );
2008
+ }
2009
+ }
2010
+ else
2011
+ {
2012
+ boundylb1 = (side0 - lbvar ) / coef0 ;
2013
+ boundylb2 = (side1 - lbvar ) / coef1 ;
2014
+ }
2015
+ if ( SCIPisInfinity (scip , ubvbdvar ) )
2016
+ {
2017
+ if ( coef0 > 0.0 )
2018
+ {
2019
+ boundxub1 = - SCIPinfinity (scip );
2020
+ boundxub2 = - SCIPinfinity (scip );
2021
+ }
2022
+ else
2023
+ {
2024
+ boundxub1 = SCIPinfinity (scip );
2025
+ boundxub2 = SCIPinfinity (scip );
2026
+ }
2027
+ }
2028
+ else
2029
+ {
2030
+ boundxub1 = side0 - ubvbdvar * coef0 ;
2031
+ boundxub2 = side1 - ubvbdvar * coef1 ;
2032
+ }
2033
+ if ( SCIPisInfinity (scip , ubvar ) )
2034
+ {
2035
+ if ( coef0 > 0.0 )
2036
+ {
2037
+ boundyub1 = - SCIPinfinity (scip );
2038
+ boundyub2 = - SCIPinfinity (scip );
2039
+ }
2040
+ else
2041
+ {
2042
+ boundyub1 = SCIPinfinity (scip );
2043
+ boundyub2 = SCIPinfinity (scip );
2044
+ }
2045
+ }
2046
+ else
2047
+ {
2048
+ boundyub1 = (side0 - ubvar ) / coef0 ;
2049
+ boundyub2 = (side1 - ubvar ) / coef1 ;
2050
+ }
1983
2051
1984
2052
if ( islhs )
1985
2053
{
1986
- boundvaluex1 = MAX (boundxlb1 , boundxlb2 );
1987
- boundvaluex2 = MAX (boundxub1 , boundxub2 );
2054
+ boundvaluex1 = MAX (boundxlb1 , boundxlb2 );
2055
+ boundvaluex2 = MAX (boundxub1 , boundxub2 );
1988
2056
}
1989
2057
else
1990
2058
{
1991
- boundvaluex1 = MIN (boundxlb1 , boundxlb2 );
1992
- boundvaluex2 = MIN (boundxub1 , boundxub2 );
2059
+ boundvaluex1 = MIN (boundxlb1 , boundxlb2 );
2060
+ boundvaluex2 = MIN (boundxub1 , boundxub2 );
1993
2061
}
1994
2062
1995
2063
/* calculate important values for variables */
@@ -2023,8 +2091,32 @@ void checkRedundancySide(
2023
2091
}
2024
2092
2025
2093
/* calculate resulting values of variable y by setting x to valuex1 */
2026
- valuey1 = (side0 - valuex1 )/coef0 ;
2027
- valuey2 = (side1 - valuex1 )/coef1 ;
2094
+ if ( SCIPisInfinity (scip , ABS (valuex1 )) )
2095
+ {
2096
+ /* only consider sides if coefficients are equal */
2097
+ if ( SCIPisEQ (scip , coef0 , coef1 ) )
2098
+ {
2099
+ valuey1 = side0 / coef0 ;
2100
+ valuey2 = side1 / coef1 ;
2101
+ }
2102
+ /* only consider original coefficients if otherwise x approaches plus infinity */
2103
+ else if ( valuex1 > 0.0 )
2104
+ {
2105
+ valuey1 = coef0 ;
2106
+ valuey2 = coef1 ;
2107
+ }
2108
+ /* only consider swapped coefficients if otherwise x approaches minus infinity */
2109
+ else
2110
+ {
2111
+ valuey1 = coef1 ;
2112
+ valuey2 = coef0 ;
2113
+ }
2114
+ }
2115
+ else
2116
+ {
2117
+ valuey1 = (side0 - valuex1 ) / coef0 ;
2118
+ valuey2 = (side1 - valuex1 ) / coef1 ;
2119
+ }
2028
2120
2029
2121
/* determine redundancy of one constraints side */
2030
2122
if ( SCIPisEQ (scip , valuey1 , valuey2 ) )
@@ -2045,8 +2137,32 @@ void checkRedundancySide(
2045
2137
}
2046
2138
2047
2139
/* calculate resulting values of variable y by setting x to valuex2 */
2048
- valuey1 = (side0 - valuex2 )/coef0 ;
2049
- valuey2 = (side1 - valuex2 )/coef1 ;
2140
+ if ( SCIPisInfinity (scip , ABS (valuex2 )) )
2141
+ {
2142
+ /* only consider sides if coefficients are equal */
2143
+ if ( SCIPisEQ (scip , coef0 , coef1 ) )
2144
+ {
2145
+ valuey1 = side0 / coef0 ;
2146
+ valuey2 = side1 / coef1 ;
2147
+ }
2148
+ /* only consider original coefficients if otherwise x approaches plus infinity */
2149
+ else if ( valuex2 > 0.0 )
2150
+ {
2151
+ valuey1 = coef0 ;
2152
+ valuey2 = coef1 ;
2153
+ }
2154
+ /* only consider swapped coefficients if otherwise x approaches minus infinity */
2155
+ else
2156
+ {
2157
+ valuey1 = coef1 ;
2158
+ valuey2 = coef0 ;
2159
+ }
2160
+ }
2161
+ else
2162
+ {
2163
+ valuey1 = (side0 - valuex2 ) / coef0 ;
2164
+ valuey2 = (side1 - valuex2 ) / coef1 ;
2165
+ }
2050
2166
2051
2167
/* determine redundancy of one constraints side by checking for the first valuex2 */
2052
2168
if ( coef0 > 0.0 )
@@ -2110,16 +2226,16 @@ void checkRedundancySide(
2110
2226
/* calculate feasibility domain values for variable y concerning these both constraints */
2111
2227
if ( coef0 > 0.0 )
2112
2228
{
2113
- if ( islhs )
2114
- {
2115
- boundvaluey1 = MAX (boundylb1 , boundylb2 );
2116
- boundvaluey2 = MAX (boundyub1 , boundyub2 );
2117
- }
2118
- else
2119
- {
2120
- boundvaluey1 = MIN (boundylb1 , boundylb2 );
2121
- boundvaluey2 = MIN (boundyub1 , boundyub2 );
2122
- }
2229
+ if ( islhs )
2230
+ {
2231
+ boundvaluey1 = MAX (boundylb1 , boundylb2 );
2232
+ boundvaluey2 = MAX (boundyub1 , boundyub2 );
2233
+ }
2234
+ else
2235
+ {
2236
+ boundvaluey1 = MIN (boundylb1 , boundylb2 );
2237
+ boundvaluey2 = MIN (boundyub1 , boundyub2 );
2238
+ }
2123
2239
2124
2240
valuey1 = MIN (boundvaluey1 , ubvbdvar );
2125
2241
valuey1 = MAX (valuey1 , lbvbdvar );
@@ -2131,16 +2247,16 @@ void checkRedundancySide(
2131
2247
}
2132
2248
else
2133
2249
{
2134
- if ( islhs )
2135
- {
2136
- boundvaluey1 = MIN (boundylb1 , boundylb2 );
2137
- boundvaluey2 = MIN (boundyub1 , boundyub2 );
2138
- }
2139
- else
2140
- {
2141
- boundvaluey1 = MAX (boundylb1 , boundylb2 );
2142
- boundvaluey2 = MAX (boundyub1 , boundyub2 );
2143
- }
2250
+ if ( islhs )
2251
+ {
2252
+ boundvaluey1 = MIN (boundylb1 , boundylb2 );
2253
+ boundvaluey2 = MIN (boundyub1 , boundyub2 );
2254
+ }
2255
+ else
2256
+ {
2257
+ boundvaluey1 = MAX (boundylb1 , boundylb2 );
2258
+ boundvaluey2 = MAX (boundyub1 , boundyub2 );
2259
+ }
2144
2260
2145
2261
valuey1 = MAX (boundvaluey1 , lbvbdvar );
2146
2262
valuey1 = MIN (valuey1 , ubvbdvar );
@@ -2152,8 +2268,32 @@ void checkRedundancySide(
2152
2268
}
2153
2269
2154
2270
/* calculate resulting values of variable x by setting y to valuey1 */
2155
- valuex1 = side0 - valuey1 * coef0 ;
2156
- valuex2 = side1 - valuey1 * coef1 ;
2271
+ if ( SCIPisInfinity (scip , ABS (valuey1 )) )
2272
+ {
2273
+ /* only consider sides if coefficients are equal */
2274
+ if ( SCIPisEQ (scip , coef0 , coef1 ) )
2275
+ {
2276
+ valuex1 = side0 ;
2277
+ valuex2 = side1 ;
2278
+ }
2279
+ /* only consider swapped coefficients if otherwise y approaches plus infinity */
2280
+ else if ( valuey1 > 0.0 )
2281
+ {
2282
+ valuex1 = coef1 ;
2283
+ valuex2 = coef0 ;
2284
+ }
2285
+ /* only consider original coefficients if otherwise y approaches minus infinity */
2286
+ else
2287
+ {
2288
+ valuex1 = coef0 ;
2289
+ valuex2 = coef1 ;
2290
+ }
2291
+ }
2292
+ else
2293
+ {
2294
+ valuex1 = side0 - valuey1 * coef0 ;
2295
+ valuex2 = side1 - valuey1 * coef1 ;
2296
+ }
2157
2297
2158
2298
/* determine redundancy of one constraints side by checking for the first valuey1 */
2159
2299
if ( * sideequal )
@@ -2181,8 +2321,32 @@ void checkRedundancySide(
2181
2321
}
2182
2322
2183
2323
/* calculate resulting values of variable x by setting y to valuey2 */
2184
- valuex1 = side0 - valuey2 * coef0 ;
2185
- valuex2 = side1 - valuey2 * coef1 ;
2324
+ if ( SCIPisInfinity (scip , ABS (valuey2 )) )
2325
+ {
2326
+ /* only consider sides if coefficients are equal */
2327
+ if ( SCIPisEQ (scip , coef0 , coef1 ) )
2328
+ {
2329
+ valuex1 = side0 ;
2330
+ valuex2 = side1 ;
2331
+ }
2332
+ /* only consider swapped coefficients if otherwise y approaches plus infinity */
2333
+ else if ( valuey2 > 0.0 )
2334
+ {
2335
+ valuex1 = coef1 ;
2336
+ valuex2 = coef0 ;
2337
+ }
2338
+ /* only consider original coefficients if otherwise y approaches minus infinity */
2339
+ else
2340
+ {
2341
+ valuex1 = coef0 ;
2342
+ valuex2 = coef1 ;
2343
+ }
2344
+ }
2345
+ else
2346
+ {
2347
+ valuex1 = side0 - valuey2 * coef0 ;
2348
+ valuex2 = side1 - valuey2 * coef1 ;
2349
+ }
2186
2350
2187
2351
/* determine redundancy of one constraints side by checking for the second valuey2 */
2188
2352
if ( * sideequal )
0 commit comments