Skip to content

Commit

Permalink
Add support for MOI.RelativeGapTolerance and MOI.AbsoluteGapTolerance (
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Mar 7, 2024
1 parent c55d106 commit 808f157
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/MOI/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4424,3 +4424,33 @@ function MOI.get(
column = _info(model, vi).column
return model.cached_solution.variable_dual[column]
end

#=
RelativeGapTolerance
=#

MOI.supports(::Optimizer, ::MOI.RelativeGapTolerance) = true

function MOI.get(model::Optimizer, ::MOI.RelativeGapTolerance)
return Xpress.getcontrol(model.inner, Lib.XPRS_MIPRELSTOP)
end

function MOI.set(model::Optimizer, ::MOI.RelativeGapTolerance, value::Float64)
Xpress.setcontrol!(model.inner, Lib.XPRS_MIPRELSTOP, value)
return
end

#=
AbsoluteGapTolerance
=#

MOI.supports(::Optimizer, ::MOI.AbsoluteGapTolerance) = true

function MOI.get(model::Optimizer, ::MOI.AbsoluteGapTolerance)
return Xpress.getcontrol(model.inner, Lib.XPRS_MIPABSSTOP)
end

function MOI.set(model::Optimizer, ::MOI.AbsoluteGapTolerance, value::Float64)
Xpress.setcontrol!(model.inner, Lib.XPRS_MIPABSSTOP, value)
return
end

0 comments on commit 808f157

Please sign in to comment.