Unverified Commit 390f0dd1 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

clean up `is_solved` use in FVA

parent 3c242e81
Pipeline #42194 passed with stages
in 12 minutes and 27 seconds
......@@ -34,13 +34,15 @@ the individual optimization problems is transparently distributed to `workers`
(see `Distributed.workers()`).
`ret` is a function used to extract results from optimized JuMP models of the
individual reactions. More detailed information can be extracted e.g. by
setting it to `m -> (JuMP.objective_value(m), JuMP.value.(m[:x]))`.
individual reactions. By default, it calls and returns the value of
`JuMP.objective_value`. More information can be extracted e.g. by setting it to
a function that returns a more elaborate data structure; such as `m ->
(JuMP.objective_value(m), JuMP.value.(m[:x]))`.
Returns a matrix of extracted `ret` values for minima and maxima, of total size
`length(reactions)`×2. The optimizer result status is not checked by default,
instead `ret` function can access the `JuMP.termination_status` of the model
and react accordingly, depending on user decision.
(`length(reactions)`,2). The optimizer result status is checked with
[`is_solved`](@ref); `nothing` is returned if the optimization failed for any
reason.
"""
function flux_variability_analysis(
model::MetabolicModel,
......
......@@ -50,11 +50,9 @@ end
"""
is_solved(optmodel)
Return `true` if `optmodel` solved successfully (solution is optimal or locally optimal).
Return `false` if any other termination status is reached. Termination status is defined
in the documentation of `JuMP`.
Return `true` if `optmodel` solved successfully (solution is optimal or locally
optimal). Return `false` if any other termination status is reached.
Termination status is defined in the documentation of `JuMP`.
"""
function is_solved(optmodel)
COBREXA.JuMP.termination_status(optmodel) in [MOI.OPTIMAL, MOI.LOCALLY_SOLVED] ? true :
false
end
is_solved(optmodel) =
COBREXA.JuMP.termination_status(optmodel) in [MOI.OPTIMAL, MOI.LOCALLY_SOLVED]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment