Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slightly improve the objective value handling at FVA #448

Merged
merged 1 commit into from
Aug 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/analysis/flux_variability_analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
optimizer;
modifications = [],
workers = [myid()],
bounds = z -> (z,z),
optimal_objective_value = nothing,
bounds = z -> (z, Inf),
ret = objective_value,
)::Matrix{Float64}

Expand All @@ -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
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
individual reactions. By default, it calls and returns the value of
Expand All @@ -55,17 +60,19 @@ function flux_variability_analysis(
optimizer;
modifications = [],
workers = [myid()],
bounds = z -> (z, z),
optimal_objective_value = nothing,
bounds = z -> (z, Inf),
ret = objective_value,
)
if any(reactions .< 1) || any(reactions .> n_reactions(model))
throw(DomainError(reactions, "Index exceeds number of reactions."))
end

Z = bounds(
isnothing(optimal_objective_value) ?
objective_value(
flux_balance_analysis(model, optimizer; modifications = modifications),
),
) : optimal_objective_value,
)

return screen_optmodel_modifications(
Expand Down