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` ...@@ -34,13 +34,15 @@ the individual optimization problems is transparently distributed to `workers`
(see `Distributed.workers()`). (see `Distributed.workers()`).
`ret` is a function used to extract results from optimized JuMP models of the `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 individual reactions. By default, it calls and returns the value of
setting it to `m -> (JuMP.objective_value(m), JuMP.value.(m[:x]))`. `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 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, (`length(reactions)`,2). The optimizer result status is checked with
instead `ret` function can access the `JuMP.termination_status` of the model [`is_solved`](@ref); `nothing` is returned if the optimization failed for any
and react accordingly, depending on user decision. reason.
""" """
function flux_variability_analysis( function flux_variability_analysis(
model::MetabolicModel, model::MetabolicModel,
......
...@@ -50,11 +50,9 @@ end ...@@ -50,11 +50,9 @@ end
""" """
is_solved(optmodel) is_solved(optmodel)
Return `true` if `optmodel` solved successfully (solution is optimal or locally optimal). Return `true` if `optmodel` solved successfully (solution is optimal or locally
Return `false` if any other termination status is reached. Termination status is defined optimal). Return `false` if any other termination status is reached.
in the documentation of `JuMP`. Termination status is defined in the documentation of `JuMP`.
""" """
function is_solved(optmodel) is_solved(optmodel) =
COBREXA.JuMP.termination_status(optmodel) in [MOI.OPTIMAL, MOI.LOCALLY_SOLVED] ? true : COBREXA.JuMP.termination_status(optmodel) in [MOI.OPTIMAL, MOI.LOCALLY_SOLVED]
false
end
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