Unverified Commit 56158f9f authored by St. Elmo's avatar St. Elmo Committed by GitHub
Browse files

Merge pull request #411 from LCSB-BioCore/mk-rm-scopes

Completely remove all JuMP and COBREXA prefixes where possible
parents 5cae6c88 e7054358
Pipeline #44928 passed with stages
in 12 minutes and 12 seconds
...@@ -80,6 +80,6 @@ function flux_balance_analysis( ...@@ -80,6 +80,6 @@ function flux_balance_analysis(
mod(model, opt_model) mod(model, opt_model)
end end
COBREXA.JuMP.optimize!(opt_model) optimize!(opt_model)
return opt_model return opt_model
end end
...@@ -9,7 +9,7 @@ If you want to change the objective and sense at the same time, use ...@@ -9,7 +9,7 @@ If you want to change the objective and sense at the same time, use
[`change_objective`](@ref) instead to do both at once. [`change_objective`](@ref) instead to do both at once.
""" """
function change_sense(objective_sense) function change_sense(objective_sense)
(model, opt_model) -> COBREXA.JuMP.set_objective_sense(opt_model, objective_sense) (model, opt_model) -> set_objective_sense(opt_model, objective_sense)
end end
""" """
...@@ -22,7 +22,7 @@ problems that may require different optimizers for different parts, such as the ...@@ -22,7 +22,7 @@ problems that may require different optimizers for different parts, such as the
[`parsimonious_flux_balance_analysis`](@ref). [`parsimonious_flux_balance_analysis`](@ref).
""" """
function change_optimizer(optimizer) function change_optimizer(optimizer)
(model, opt_model) -> COBREXA.JuMP.set_optimizer(opt_model, optimizer) (model, opt_model) -> set_optimizer(opt_model, optimizer)
end end
""" """
...@@ -33,8 +33,7 @@ to the JuMP documentation and the documentation of the specific optimizer for ...@@ -33,8 +33,7 @@ to the JuMP documentation and the documentation of the specific optimizer for
usable keys and values. usable keys and values.
""" """
function change_optimizer_attribute(attribute_key, value) function change_optimizer_attribute(attribute_key, value)
(model, opt_model) -> (model, opt_model) -> set_optimizer_attribute(opt_model, attribute_key, value)
COBREXA.JuMP.set_optimizer_attribute(opt_model, attribute_key, value)
end end
""" """
......
...@@ -65,7 +65,7 @@ function parsimonious_flux_balance_analysis( ...@@ -65,7 +65,7 @@ function parsimonious_flux_balance_analysis(
# get the objective # get the objective
Z = objective_value(opt_model) Z = objective_value(opt_model)
original_objective = COBREXA.JuMP.objective_function(opt_model) original_objective = objective_function(opt_model)
# prepare the model for pFBA # prepare the model for pFBA
for mod in qp_modifications for mod in qp_modifications
......
...@@ -56,5 +56,5 @@ const _constants = ( ...@@ -56,5 +56,5 @@ const _constants = (
), ),
) )
const MAX_SENSE = COBREXA.MOI.MAX_SENSE const MAX_SENSE = MOI.MAX_SENSE
const MIN_SENSE = COBREXA.MOI.MIN_SENSE const MIN_SENSE = MOI.MIN_SENSE
...@@ -16,7 +16,7 @@ function make_optimization_model(model::MetabolicModel, optimizer; sense = MOI.M ...@@ -16,7 +16,7 @@ function make_optimization_model(model::MetabolicModel, optimizer; sense = MOI.M
m, n = size(stoichiometry(model)) m, n = size(stoichiometry(model))
xl, xu = bounds(model) xl, xu = bounds(model)
optimization_model = COBREXA.JuMP.Model(optimizer) optimization_model = Model(optimizer)
@variable(optimization_model, x[i = 1:n]) @variable(optimization_model, x[i = 1:n])
@objective(optimization_model, sense, objective(model)' * x) @objective(optimization_model, sense, objective(model)' * x)
@constraint(optimization_model, mb, stoichiometry(model) * x .== balance(model)) # mass balance @constraint(optimization_model, mb, stoichiometry(model) * x .== balance(model)) # mass balance
...@@ -42,7 +42,7 @@ Use JuMP to solve an instance of CoreModel ...@@ -42,7 +42,7 @@ Use JuMP to solve an instance of CoreModel
""" """
function optimize_model(model::MetabolicModel, optimizer; sense = MOI.MIN_SENSE) function optimize_model(model::MetabolicModel, optimizer; sense = MOI.MIN_SENSE)
optimization_model = make_optimization_model(model, optimizer; sense = sense) optimization_model = make_optimization_model(model, optimizer; sense = sense)
COBREXA.JuMP.optimize!(optimization_model) optimize!(optimization_model)
return optimization_model return optimization_model
end end
...@@ -55,8 +55,7 @@ optimal). Return `false` if any other termination status is reached. ...@@ -55,8 +55,7 @@ optimal). Return `false` if any other termination status is reached.
Termination status is defined in the documentation of `JuMP`. Termination status is defined in the documentation of `JuMP`.
""" """
function is_solved(optmodel) function is_solved(optmodel)
COBREXA.JuMP.termination_status(optmodel) in [MOI.OPTIMAL, MOI.LOCALLY_SOLVED] ? true : termination_status(optmodel) in [MOI.OPTIMAL, MOI.LOCALLY_SOLVED] ? true : false
false
end 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