Unverified Commit 2ad630fc authored by Miroslav Kratochvil's avatar Miroslav Kratochvil Committed by GitHub
Browse files

Merge pull request #448 from LCSB-BioCore/mk-sanitize-fva

slightly improve the objective value handling at FVA
parents 1a9348ef bc4bd821
Pipeline #46298 passed with stages
in 52 minutes and 57 seconds
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
optimizer; optimizer;
modifications = [], modifications = [],
workers = [myid()], workers = [myid()],
bounds = z -> (z,z), optimal_objective_value = nothing,
bounds = z -> (z, Inf),
ret = objective_value, ret = objective_value,
)::Matrix{Float64} )::Matrix{Float64}
...@@ -30,7 +31,11 @@ first and second pair to remove the limit. Use [`gamma_bounds`](@ref) and ...@@ -30,7 +31,11 @@ first and second pair to remove the limit. Use [`gamma_bounds`](@ref) and
`optimizer` must be set to a `JuMP`-compatible optimizer. The computation of `optimizer` must be set to a `JuMP`-compatible optimizer. The computation of
the individual optimization problems is transparently distributed to `workers` the individual optimization problems is transparently distributed to `workers`
(see `Distributed.workers()`). (see `Distributed.workers()`). The value of Z₀ can be optionally supplied in
argument `optimal_objective_value`, which prevents this function from calling
the non-parallelizable FBA. Separating the single-threaded FBA and
multithreaded variability computation can be used to improve resource
allocation efficiency in many common use-cases.
`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. By default, it calls and returns the value of individual reactions. By default, it calls and returns the value of
...@@ -55,7 +60,8 @@ function flux_variability_analysis( ...@@ -55,7 +60,8 @@ function flux_variability_analysis(
optimizer; optimizer;
modifications = [], modifications = [],
workers = [myid()], workers = [myid()],
bounds = z -> (z, z), optimal_objective_value = nothing,
bounds = z -> (z, Inf),
ret = objective_value, ret = objective_value,
) )
if any(reactions .< 1) || any(reactions .> n_reactions(model)) if any(reactions .< 1) || any(reactions .> n_reactions(model))
...@@ -63,9 +69,10 @@ function flux_variability_analysis( ...@@ -63,9 +69,10 @@ function flux_variability_analysis(
end end
Z = bounds( Z = bounds(
isnothing(optimal_objective_value) ?
objective_value( objective_value(
flux_balance_analysis(model, optimizer; modifications = modifications), flux_balance_analysis(model, optimizer; modifications = modifications),
), ) : optimal_objective_value,
) )
return screen_optmodel_modifications( return screen_optmodel_modifications(
......
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