### clean up the gapfilling code

parent f8cd84a3
Pipeline #56576 passed with stages
in 12 minutes and 1 second
 ... @@ -19,16 +19,18 @@ function make_optimization_model(model::MetabolicModel, optimizer; sense = MAX_S ... @@ -19,16 +19,18 @@ function make_optimization_model(model::MetabolicModel, optimizer; sense = MAX_S xl, xu = bounds(model) xl, xu = bounds(model) optimization_model = Model(optimizer) optimization_model = Model(optimizer) @variable(optimization_model, x[i = 1:n]) @variable(optimization_model, x[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 @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 C = coupling(model) # empty if no coupling C = coupling(model) # empty if no coupling cl, cu = coupling_bounds(model) isempty(C) || begin isempty(C) || @constraint(optimization_model, c_lbs, cl .<= C * x) # coupling lower bounds cl, cu = coupling_bounds(model) isempty(C) || @constraint(optimization_model, c_ubs, C * x .<= cu) # coupling upper bounds @constraint(optimization_model, c_lbs, cl .<= C * x) # coupling lower bounds @constraint(optimization_model, c_ubs, C * x .<= cu) # coupling upper bounds end return optimization_model return optimization_model end end ... ...