Skip to content
Snippets Groups Projects
Unverified Commit 7079d229 authored by St. Elmo's avatar St. Elmo Committed by Miroslav Kratochvil
Browse files

changed coupling extension

parent ab48efab
No related branches found
No related tags found
No related merge requests found
...@@ -20,23 +20,10 @@ function make_optimization_model(model::MetabolicModel, optimizer; sense = MOI.M ...@@ -20,23 +20,10 @@ function make_optimization_model(model::MetabolicModel, optimizer; sense = MOI.M
@constraint(optimization_model, lbs, xl .<= x) # lower bounds @constraint(optimization_model, lbs, xl .<= x) # lower bounds
@constraint(optimization_model, ubs, x .<= xu) # upper bounds @constraint(optimization_model, ubs, x .<= xu) # upper bounds
return optimization_model C = coupling(model) # empty if no coupling
end
function make_optimization_model(model::CoreModelCoupled, optimizer; sense = MOI.MAX_SENSE)
# coupled models have specific structure
m, n = size(stoichiometry(model))
xl, xu = bounds(model)
cl, cu = coupling_bounds(model) cl, cu = coupling_bounds(model)
isempty(C) || @constraint(optimization_model, c_lbs, cl.<= coupling(model)*x) # coupling lower bounds
optimization_model = COBREXA.JuMP.Model(optimizer) isempty(C) || @constraint(optimization_model, c_ubs, coupling(model)*x .<= cu) # coupling upper bounds
@variable(optimization_model, x[i = 1:n])
@objective(optimization_model, sense, objective(model)' * x)
@constraint(optimization_model, mb, stoichiometry(model) * x .== balance(model)) # mass balance
@constraint(optimization_model, lbs, xl .<= x) # lower bounds
@constraint(optimization_model, ubs, x .<= xu) # upper bounds
@constraint(optimization_model, c_lbs, cl .<= coupling(model) * x) # coupling lower bounds
@constraint(optimization_model, c_ubs, coupling(model) * x .<= cu) # coupling upper bounds
return optimization_model return optimization_model
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment