Skip to content

Commit

Permalink
add objective limit MOI interface (#177)
Browse files Browse the repository at this point in the history
* add objective limit

* format
  • Loading branch information
matbesancon authored Oct 4, 2023
1 parent 8371746 commit 277f052
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,24 @@ function MOI.get(model::Optimizer, ::MOI.RelativeGapTolerance)
return MOI.get(model, MOI.RawOptimizerAttribute("mip_rel_gap"))
end

###
### MOI.ObjectiveLimit
###

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

function MOI.set(model::Optimizer, ::MOI.ObjectiveLimit, limit::Real)
return MOI.set(
model,
MOI.RawOptimizerAttribute("objective_target"),
Float64(limit),
)
end

function MOI.get(model::Optimizer, ::MOI.ObjectiveLimit)
return MOI.get(model, MOI.RawOptimizerAttribute("objective_target"))
end

###
### MOI.Silent
###
Expand Down

0 comments on commit 277f052

Please sign in to comment.