diff --git a/Project.toml b/Project.toml index 796e256..02d0e53 100644 --- a/Project.toml +++ b/Project.toml @@ -10,7 +10,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [compat] HiGHS_jll = "=1.5.1, =1.5.3" -MathOptInterface = "1" +MathOptInterface = "1.7" PrecompileTools = "1" julia = "1.6" diff --git a/src/MOI_wrapper.jl b/src/MOI_wrapper.jl index 4cfca9a..12d868d 100644 --- a/src/MOI_wrapper.jl +++ b/src/MOI_wrapper.jl @@ -611,6 +611,42 @@ function MOI.get(model::Optimizer, ::MOI.TimeLimitSec) return value == Inf ? nothing : value end +### +### MOI.AbsoluteGapTolerance +### + +MOI.supports(::Optimizer, ::MOI.AbsoluteGapTolerance) = true + +function MOI.set(model::Optimizer, ::MOI.AbsoluteGapTolerance, limit::Real) + return MOI.set( + model, + MOI.RawOptimizerAttribute("mip_abs_gap"), + Float64(limit), + ) +end + +function MOI.get(model::Optimizer, ::MOI.AbsoluteGapTolerance) + return MOI.get(model, MOI.RawOptimizerAttribute("mip_abs_gap")) +end + +### +### MOI.RelativeGapTolerance +### + +MOI.supports(::Optimizer, ::MOI.RelativeGapTolerance) = true + +function MOI.set(model::Optimizer, ::MOI.RelativeGapTolerance, limit::Real) + return MOI.set( + model, + MOI.RawOptimizerAttribute("mip_rel_gap"), + Float64(limit), + ) +end + +function MOI.get(model::Optimizer, ::MOI.RelativeGapTolerance) + return MOI.get(model, MOI.RawOptimizerAttribute("mip_rel_gap")) +end + ### ### MOI.Silent ###