Skip to content

Fix return type for NodeCount and BarrierIterations #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1651,13 +1651,13 @@
return p[]
end

function MOI.get(model::Optimizer, ::MOI.NodeCount)
function MOI.get(model::Optimizer, ::MOI.NodeCount)::Int64

Check warning on line 1654 in src/MOI_wrapper.jl

View check run for this annotation

Codecov / codecov/patch

src/MOI_wrapper.jl#L1654

Added line #L1654 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it simpler just to use a return type annotation. It automatically lowers to return convert(Int64, p[])

p = Ref{Cint}(0)
@_checked KN_get_mip_number_nodes(model.inner, p)
return p[]
end

function MOI.get(model::Optimizer, ::MOI.BarrierIterations)
function MOI.get(model::Optimizer, ::MOI.BarrierIterations)::Int64

Check warning on line 1660 in src/MOI_wrapper.jl

View check run for this annotation

Codecov / codecov/patch

src/MOI_wrapper.jl#L1660

Added line #L1660 was not covered by tests
p = Ref{Cint}(0)
@_checked KN_get_number_iters(model.inner, p)
return p[]
Expand Down
Loading