diff --git a/src/net_components/core_ops.jl b/src/net_components/core_ops.jl index 42aff450..0ad7feb2 100644 --- a/src/net_components/core_ops.jl +++ b/src/net_components/core_ops.jl @@ -89,9 +89,17 @@ function tight_bound( status = solve(model, suppress_warnings = true, relaxation = relaxation) if status == :Optimal b = getobjectivevalue(model) + db = bound_delta_f[bound_type](b, b_0) + Memento.debug(MIPVerify.LOGGER, " Δu = $(db)") + if db < 0 + b = b_0 + Memento.info( + MIPVerify.LOGGER, + "Tightening via interval_arithmetic gives a better result than $(tightening_algorithm); using best bound found.", + ) + end elseif status == :UserLimit - b = getobjectivebound(model) - log_gap(model) + b = b_0 else Memento.warn( MIPVerify.LOGGER, @@ -99,15 +107,6 @@ function tight_bound( ) b = b_0 end - db = bound_delta_f[bound_type](b, b_0) - Memento.debug(MIPVerify.LOGGER, " Δu = $(db)") - if db < 0 - b = b_0 - Memento.info( - MIPVerify.LOGGER, - "Tightening via interval_arithmetic gives a better result than $(tightening_algorithm); using best bound found.", - ) - end return b end @@ -416,6 +415,9 @@ function maximum_ge(xs::AbstractArray{T})::JuMPLinearType where {T<:JuMPLinearTy if all(is_constant.(xs)) return maximum_of_constants(xs) end + if length(xs) == 1 + return first(xs) + end # at least one of xs is not constant. model = MIPVerify.getmodel(xs) x_max = @variable(model)