Skip to content

Commit

Permalink
Add a function that was promised in the documentation: https://ds4dm.…
Browse files Browse the repository at this point in the history
…github.io/Tulip.jl/dev/reference/attributes/

> SolutionTime	Float64	Solution time, in seconds
  • Loading branch information
pratyai committed Jan 21, 2024
1 parent 2edf525 commit 95f5f8d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Interfaces/tulip_julia_api.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using QPSReader
using TimerOutputs: tottime

# TODO: user-facing API in Julia
# Other APIs should wrap this one
Expand Down Expand Up @@ -60,6 +61,20 @@ function get_attribute(m::Model, ::Status)
return m.status
end

"""
get_attribute(model::Model, ::SolutionTime)
Query the `SolutionTime` attribute from `model`
"""
function get_attribute(m::Model, ::SolutionTime)
if isnothing(m.solver)
return 0
else
local ns = tottime(m.solver.timer)
return ns * 1e-9
end
end

"""
get_attribute(model::Model, ::BarrierIterations)
Expand Down

0 comments on commit 95f5f8d

Please sign in to comment.