Skip to content

Commit

Permalink
Update MOI_wrapper.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Dec 16, 2024
1 parent 313e568 commit 74ff76a
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -627,24 +627,20 @@ end
MOI.supports(::Optimizer, ::MOI.NodeLimit) = true

Check warning on line 627 in src/MOI_wrapper.jl

View check run for this annotation

Codecov / codecov/patch

src/MOI_wrapper.jl#L627

Added line #L627 was not covered by tests

function MOI.set(model::Optimizer, ::MOI.NodeLimit, ::Nothing)
return MOI.set(
model,
MOI.RawOptimizerAttribute("mip_max_nodes"),
typemax(Int32),
)
attr = MOI.RawOptimizerAttribute("mip_max_nodes")
MOI.set(model, attr, typemax(Cint))
return
end

function MOI.set(model::Optimizer, ::MOI.NodeLimit, limit::Real)
return MOI.set(
model,
MOI.RawOptimizerAttribute("mip_max_nodes"),
Int(limit),
)
attr = MOI.RawOptimizerAttribute("mip_max_nodes")
MOI.set(model, attr, Int(limit))
return
end

function MOI.get(model::Optimizer, ::MOI.NodeLimit)
value = MOI.get(model, MOI.RawOptimizerAttribute("mip_max_nodes"))
return value == typemax(Int32) ? nothing : Int(value)
return value == typemax(Cint) ? nothing : Int(value)
end

###
Expand Down

0 comments on commit 74ff76a

Please sign in to comment.