diff --git a/src/MOI/MOI_wrapper.jl b/src/MOI/MOI_wrapper.jl index 99ace8a..aa9e422 100644 --- a/src/MOI/MOI_wrapper.jl +++ b/src/MOI/MOI_wrapper.jl @@ -527,13 +527,21 @@ function MOI.get(model::Optimizer, param::MOI.RawOptimizerAttribute) return end -function MOI.set(model::Optimizer, ::MOI.TimeLimitSec, limit::Real) - MOI.set(model, MOI.RawOptimizerAttribute("CPXPARAM_TimeLimit"), limit) +const _TIME_LIMIT_DEFAULT = 1.0e75 + +function MOI.set( + model::Optimizer, + ::MOI.TimeLimitSec, + limit::Union{Nothing,Real}, +) + new_limit = something(limit, _TIME_LIMIT_DEFAULT) + MOI.set(model, MOI.RawOptimizerAttribute("CPXPARAM_TimeLimit"), new_limit) return end function MOI.get(model::Optimizer, ::MOI.TimeLimitSec) - return MOI.get(model, MOI.RawOptimizerAttribute("CPXPARAM_TimeLimit")) + limit = MOI.get(model, MOI.RawOptimizerAttribute("CPXPARAM_TimeLimit")) + return limit === _TIME_LIMIT_DEFAULT ? nothing : limit end MOI.supports_incremental_interface(::Optimizer) = true