Skip to content

Commit

Permalink
add a helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
exaexa committed Sep 20, 2024
1 parent 5a68586 commit 9c6886b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/src/examples/05f-cyclefree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ warmup = vcat(
cs,
cs.fluxes,
optimizer = HiGHS.Optimizer,
output = (_, om) -> JuMP.value.(om[:x]),
output = (_, om) -> variable_vector(om),
output_type = Vector{Float64},
) for v in vs
)...,
Expand All @@ -114,7 +114,7 @@ sample = sample_constraints(
seed = UInt(1234),
output = cs.fluxes,
n_chains = 10,
collect_iterations = collect(100:105),
collect_iterations = collect(10:15),
)

# The results can be observed (and usually plotted) from the sample vectors,
Expand Down
10 changes: 10 additions & 0 deletions src/solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ is_solved(opt_model::J.Model) =

export is_solved

"""
$(TYPEDSIGNATURES)
Retrieve the variable vector from a JuMP model created by
[`optimization_model`](@ref).
"""
variable_vector(opt_model::J.Model) = J.value.(opt_model[:x])

export variable_vector

"""
Minimal
Expand Down

0 comments on commit 9c6886b

Please sign in to comment.