Commit c26aa15b authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

just reformat everything

...to be able to continue pushing formatted code sanely
parent a1987d7d
Pipeline #42960 passed with stages
in 9 minutes and 58 seconds
...@@ -99,8 +99,11 @@ end ...@@ -99,8 +99,11 @@ end
Return the reaction equation of reaction with id `rxn_id` in model. The reaction Return the reaction equation of reaction with id `rxn_id` in model. The reaction
equation maps metabolite ids to their stoichiometric coefficients. equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::CoreModel, rxn_id::String)::Dict{String, Float64} function reaction_stoichiometry(m::CoreModel, rxn_id::String)::Dict{String,Float64}
Dict(m.mets[k]=>v for (k, v) in zip(findnz(m.S[:, first(indexin([rxn_id], m.rxns))])...)) Dict(
m.mets[k] => v for
(k, v) in zip(findnz(m.S[:, first(indexin([rxn_id], m.rxns))])...)
)
end end
""" """
...@@ -109,8 +112,8 @@ end ...@@ -109,8 +112,8 @@ end
Return the reaction equation of reaction with id `rxn_ind` in model. The reaction Return the reaction equation of reaction with id `rxn_ind` in model. The reaction
equation maps metabolite ids to their stoichiometric coefficients. equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::CoreModel, rxn_ind::Int)::Dict{String, Float64} function reaction_stoichiometry(m::CoreModel, rxn_ind::Int)::Dict{String,Float64}
Dict(m.mets[k]=>v for (k, v) in zip(findnz(m.S[:, rxn_ind])...)) Dict(m.mets[k] => v for (k, v) in zip(findnz(m.S[:, rxn_ind])...))
end end
""" """
......
...@@ -110,7 +110,7 @@ end ...@@ -110,7 +110,7 @@ end
Return the reaction equation of reaction with id `rxn_id` in model. The reaction Return the reaction equation of reaction with id `rxn_id` in model. The reaction
equation maps metabolite ids to their stoichiometric coefficients. equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::CoreModelCoupled, rxn_id::String)::Dict{String, Float64} function reaction_stoichiometry(m::CoreModelCoupled, rxn_id::String)::Dict{String,Float64}
reaction_stoichiometry(m.lm, rxn_id) reaction_stoichiometry(m.lm, rxn_id)
end end
...@@ -120,7 +120,7 @@ end ...@@ -120,7 +120,7 @@ end
Return the reaction equation of reaction with id `rxn_ind` in model. The reaction Return the reaction equation of reaction with id `rxn_ind` in model. The reaction
equation maps metabolite ids to their stoichiometric coefficients. equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::CoreModelCoupled, rxn_ind::Int)::Dict{String, Float64} function reaction_stoichiometry(m::CoreModelCoupled, rxn_ind::Int)::Dict{String,Float64}
reaction_stoichiometry(m.lm, rxn_ind) reaction_stoichiometry(m.lm, rxn_ind)
end end
......
...@@ -282,7 +282,7 @@ end ...@@ -282,7 +282,7 @@ end
Return the reaction equation of reaction with id `rxn_id` in model. The reaction Return the reaction equation of reaction with id `rxn_id` in model. The reaction
equation maps metabolite ids to their stoichiometric coefficients. equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::JSONModel, rxn_id::String)::Dict{String, Float64} function reaction_stoichiometry(m::JSONModel, rxn_id::String)::Dict{String,Float64}
ind = findfirst(x -> x["id"] == rxn_id, m.json["reactions"]) ind = findfirst(x -> x["id"] == rxn_id, m.json["reactions"])
m.json["reactions"][ind]["metabolites"] m.json["reactions"][ind]["metabolites"]
end end
......
...@@ -174,7 +174,7 @@ metabolite_compartment(m::MATModel, mid::String) = _maybemap( ...@@ -174,7 +174,7 @@ metabolite_compartment(m::MATModel, mid::String) = _maybemap(
Return the reaction equation of reaction with id `rxn_id` in model. The reaction Return the reaction equation of reaction with id `rxn_id` in model. The reaction
equation maps metabolite ids to their stoichiometric coefficients. equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::MATModel, rxn_id::String)::Dict{String, Float64} function reaction_stoichiometry(m::MATModel, rxn_id::String)::Dict{String,Float64}
rxn_ind = first(indexin([rxn_id], m.mat["rxns"])) rxn_ind = first(indexin([rxn_id], m.mat["rxns"]))
reaction_stoichiometry(m, rxn_ind) reaction_stoichiometry(m, rxn_ind)
end end
...@@ -186,7 +186,7 @@ Return the reaction equation of reaction with index `rxn_index` in model. The re ...@@ -186,7 +186,7 @@ Return the reaction equation of reaction with index `rxn_index` in model. The re
equation maps metabolite ids to their stoichiometric coefficients. Note, `rxn_index` can equation maps metabolite ids to their stoichiometric coefficients. Note, `rxn_index` can
be any suitable type that can index into an array. be any suitable type that can index into an array.
""" """
function reaction_stoichiometry(m::MATModel, rxn_ind)::Dict{String, Float64} function reaction_stoichiometry(m::MATModel, rxn_ind)::Dict{String,Float64}
met_inds = findall(m.mat["S"][:, rxn_ind] .!= 0.0) met_inds = findall(m.mat["S"][:, rxn_ind] .!= 0.0)
Dict(m.mat["mets"][met_ind] => m.mat["S"][met_ind, rxn_ind] for met_ind in met_inds) Dict(m.mat["mets"][met_ind] => m.mat["S"][met_ind, rxn_ind] for met_ind in met_inds)
end end
......
...@@ -143,7 +143,7 @@ _sbml_export_notes = _sbml_export_annotation ...@@ -143,7 +143,7 @@ _sbml_export_notes = _sbml_export_annotation
Return the reaction equation of reaction with id `rxn_id` in model. The reaction Return the reaction equation of reaction with id `rxn_id` in model. The reaction
equation maps metabolite ids to their stoichiometric coefficients. equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::SBMLModel, rxn_id::String)::Dict{String, Float64} function reaction_stoichiometry(m::SBMLModel, rxn_id::String)::Dict{String,Float64}
m.sbml.reactions[rxn_id].stoichiometry m.sbml.reactions[rxn_id].stoichiometry
end end
......
...@@ -288,7 +288,7 @@ end ...@@ -288,7 +288,7 @@ end
Return the reaction equation of reaction with id `rxn_id` in model. The reaction Return the reaction equation of reaction with id `rxn_id` in model. The reaction
equation maps metabolite ids to their stoichiometric coefficients. equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::StandardModel, rxn_id::String)::Dict{String, Float64} function reaction_stoichiometry(m::StandardModel, rxn_id::String)::Dict{String,Float64}
m.reactions[rxn_id].metabolites m.reactions[rxn_id].metabolites
end end
......
...@@ -312,9 +312,12 @@ end ...@@ -312,9 +312,12 @@ end
Return the reaction equation of reaction with id `rxn_id` in model. The reaction Return the reaction equation of reaction with id `rxn_id` in model. The reaction
equation maps metabolite ids to their stoichiometric coefficients. equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::MetabolicModel, rxn_id::String)::Dict{String, Float64} function reaction_stoichiometry(m::MetabolicModel, rxn_id::String)::Dict{String,Float64}
mets = metabolites(m) mets = metabolites(m)
Dict(mets[k] => v for (k, v) in zip(findnz(stoichiometry(m)[:, first(indexin([rxn_id], reactions(m)))])...)) Dict(
mets[k] => v for (k, v) in
zip(findnz(stoichiometry(m)[:, first(indexin([rxn_id], reactions(m)))])...)
)
end end
""" """
......
...@@ -59,7 +59,8 @@ function atom_exchange(flux_dict::Dict{String,Float64}, model::StandardModel) ...@@ -59,7 +59,8 @@ function atom_exchange(flux_dict::Dict{String,Float64}, model::StandardModel)
for (met, stoich_rxn) in model.reactions[rxn_id].metabolites for (met, stoich_rxn) in model.reactions[rxn_id].metabolites
adict = get_atoms(model.metabolites[met]) adict = get_atoms(model.metabolites[met])
for (atom, stoich_molecule) in adict for (atom, stoich_molecule) in adict
atom_flux[atom] = get(atom_flux, atom, 0.0) + flux * stoich_rxn * stoich_molecule atom_flux[atom] =
get(atom_flux, atom, 0.0) + flux * stoich_rxn * stoich_molecule
end end
end end
end end
......
...@@ -21,20 +21,12 @@ function add_reactions( ...@@ -21,20 +21,12 @@ function add_reactions(
xu::AbstractFloat; xu::AbstractFloat;
check_consistency = false, check_consistency = false,
) where {V1<:VecType,V2<:VecType} ) where {V1<:VecType,V2<:VecType}
new_lm = add_reactions( new_lm = add_reactions(m.lm, s, b, c, xl, xu, check_consistency = check_consistency)
m.lm,
s,
b,
c,
xl,
xu,
check_consistency = check_consistency,
)
return CoreModelCoupled( return CoreModelCoupled(
new_lm, new_lm,
hcat(m.C, spzeros(size(m.C, 1), n_reactions(new_lm)-n_reactions(m.lm))), hcat(m.C, spzeros(size(m.C, 1), n_reactions(new_lm) - n_reactions(m.lm))),
m.cl, m.cl,
m.cu m.cu,
) )
end end
...@@ -64,21 +56,21 @@ function add_reactions( ...@@ -64,21 +56,21 @@ function add_reactions(
check_consistency = false, check_consistency = false,
) where {V1<:VecType,V2<:VecType,K<:StringVecType} ) where {V1<:VecType,V2<:VecType,K<:StringVecType}
new_lm = add_reactions( new_lm = add_reactions(
m.lm, m.lm,
s, s,
b, b,
c, c,
xl, xl,
xu, xu,
rxn, rxn,
mets, mets,
check_consistency = check_consistency check_consistency = check_consistency,
) )
return CoreModelCoupled( return CoreModelCoupled(
new_lm, new_lm,
hcat(m.C, spzeros(size(m.C, 1), n_reactions(new_lm)-n_reactions(m.lm))), hcat(m.C, spzeros(size(m.C, 1), n_reactions(new_lm) - n_reactions(m.lm))),
m.cl, m.cl,
m.cu m.cu,
) )
end end
...@@ -103,20 +95,12 @@ function add_reactions( ...@@ -103,20 +95,12 @@ function add_reactions(
xu::V; xu::V;
check_consistency = false, check_consistency = false,
) where {M<:MatType,V<:VecType} ) where {M<:MatType,V<:VecType}
new_lm = add_reactions( new_lm = add_reactions(m.lm, Sp, b, c, xl, xu, check_consistency = check_consistency)
m.lm,
Sp,
b,
c,
xl,
xu,
check_consistency = check_consistency,
)
return CoreModelCoupled( return CoreModelCoupled(
new_lm, new_lm,
hcat(m.C, spzeros(size(m.C, 1), n_reactions(new_lm)-n_reactions(m.lm))), hcat(m.C, spzeros(size(m.C, 1), n_reactions(new_lm) - n_reactions(m.lm))),
m.cl, m.cl,
m.cu m.cu,
) )
end end
...@@ -127,16 +111,12 @@ Add all reactions from `m2` to `m1`. ...@@ -127,16 +111,12 @@ Add all reactions from `m2` to `m1`.
""" """
function add_reactions(m1::CoreModelCoupled, m2::CoreModel; check_consistency = false) function add_reactions(m1::CoreModelCoupled, m2::CoreModel; check_consistency = false)
new_lm = add_reactions( new_lm = add_reactions(m1.lm, m2, check_consistency = check_consistency)
m1.lm,
m2,
check_consistency=check_consistency
)
return CoreModelCoupled( return CoreModelCoupled(
new_lm, new_lm,
hcat(m1.C, spzeros(size(m1.C, 1), n_reactions(new_lm)-n_reactions(m1.lm))), hcat(m1.C, spzeros(size(m1.C, 1), n_reactions(new_lm) - n_reactions(m1.lm))),
m1.cl, m1.cl,
m1.cu m1.cu,
) )
end end
...@@ -166,21 +146,21 @@ function add_reactions( ...@@ -166,21 +146,21 @@ function add_reactions(
check_consistency = false, check_consistency = false,
) where {M<:MatType,V<:VecType,K<:StringVecType} ) where {M<:MatType,V<:VecType,K<:StringVecType}
new_lm = add_reactions( new_lm = add_reactions(
m.lm, m.lm,
Sp, Sp,
b, b,
c, c,
xl, xl,
xu, xu,
rxns, rxns,
mets, mets,
check_consistency = check_consistency check_consistency = check_consistency,
) )
return CoreModelCoupled( return CoreModelCoupled(
new_lm, new_lm,
hcat(m.C, spzeros(size(m.C, 1), n_reactions(new_lm)-n_reactions(m.lm))), hcat(m.C, spzeros(size(m.C, 1), n_reactions(new_lm) - n_reactions(m.lm))),
m.cl, m.cl,
m.cu m.cu,
) )
end end
...@@ -194,11 +174,11 @@ Also removes any metabolites not involved in any reaction after the deletion. ...@@ -194,11 +174,11 @@ Also removes any metabolites not involved in any reaction after the deletion.
""" """
function remove_reactions(m::CoreModelCoupled, rxns::Vector{Int}) function remove_reactions(m::CoreModelCoupled, rxns::Vector{Int})
return CoreModelCoupled( return CoreModelCoupled(
remove_reactions(m.lm, rxns), remove_reactions(m.lm, rxns),
m.C[:, filter(e -> e rxns, 1:n_reactions(m))], m.C[:, filter(e -> e rxns, 1:n_reactions(m))],
m.cl, m.cl,
m.cu m.cu,
) )
end end
""" """
...@@ -222,7 +202,8 @@ end ...@@ -222,7 +202,8 @@ end
""" """
function remove_reactions(m::CoreModelCoupled, rxns::Vector{String}) function remove_reactions(m::CoreModelCoupled, rxns::Vector{String})
rxn_indices = [findfirst(isequal(name), m.lm.rxns) for name in intersect(rxns, m.lm.rxns)] rxn_indices =
[findfirst(isequal(name), m.lm.rxns) for name in intersect(rxns, m.lm.rxns)]
if isempty(rxn_indices) if isempty(rxn_indices)
return m return m
else else
...@@ -398,12 +379,7 @@ function change_bounds!( ...@@ -398,12 +379,7 @@ function change_bounds!(
xl::V = Float64[], xl::V = Float64[],
xu::V = Float64[], xu::V = Float64[],
) where {V<:VecType} ) where {V<:VecType}
change_bounds!( change_bounds!(model.lm, rxns, xl = xl, xu = xu)
model.lm,
rxns,
xl = xl,
xu = xu
)
end end
""" """
...@@ -421,10 +397,5 @@ function change_bounds!( ...@@ -421,10 +397,5 @@ function change_bounds!(
xl::V = Float64[], xl::V = Float64[],
xu::V = Float64[], xu::V = Float64[],
) where {V<:VecType} ) where {V<:VecType}
change_bounds!( change_bounds!(model.lm, rxns, xl = xl, xu = xu)
model.lm,
rxns,
xl = xl,
xu = xu
)
end end
...@@ -32,8 +32,8 @@ end ...@@ -32,8 +32,8 @@ end
Add `met` to `model` based on metabolite `id`. Add `met` to `model` based on metabolite `id`.
""" """
add_metabolite!(model::StandardModel, met::Metabolite) = add_metabolites!(model, [met]) add_metabolite!(model::StandardModel, met::Metabolite) = add_metabolites!(model, [met])
""" """
add_genes!(model::StandardModel, genes::Vector{Gene}) add_genes!(model::StandardModel, genes::Vector{Gene})
...@@ -50,7 +50,7 @@ end ...@@ -50,7 +50,7 @@ end
Add `gene` to `model` based on gene `id`. Add `gene` to `model` based on gene `id`.
""" """
add_gene!(model::StandardModel, gene::Gene) = add_genes!(model, [gene]) add_gene!(model::StandardModel, gene::Gene) = add_genes!(model, [gene])
""" """
@add_reactions!(model::Symbol, ex::Expr) @add_reactions!(model::Symbol, ex::Expr)
...@@ -130,7 +130,7 @@ Remove reaction with `id` from `model`. Note, may result in orphan metabolites. ...@@ -130,7 +130,7 @@ Remove reaction with `id` from `model`. Note, may result in orphan metabolites.
remove_reaction!(model, "EX_glc__D_e") remove_reaction!(model, "EX_glc__D_e")
``` ```
""" """
remove_reaction!(model::StandardModel, id::String) = remove_reactions!(model, [id]) remove_reaction!(model::StandardModel, id::String) = remove_reactions!(model, [id])
""" """
remove_metabolites!(model::StandardModel, ids::Vector{String}) remove_metabolites!(model::StandardModel, ids::Vector{String})
...@@ -145,7 +145,7 @@ remove_metabolites!(model, ["atp_c", "adp_c"]) ...@@ -145,7 +145,7 @@ remove_metabolites!(model, ["atp_c", "adp_c"])
``` ```
""" """
function remove_metabolites!(model::StandardModel, ids::Vector{String}) function remove_metabolites!(model::StandardModel, ids::Vector{String})
pop!.(Ref(model.metabolites), ids) pop!.(Ref(model.metabolites), ids)
end end
""" """
...@@ -160,7 +160,7 @@ require the deleted metabolite, in which case analysis functions will error. ...@@ -160,7 +160,7 @@ require the deleted metabolite, in which case analysis functions will error.
remove_metabolite!(model, "atp_c") remove_metabolite!(model, "atp_c")
``` ```
""" """
remove_metabolite!(model::StandardModel, id::String) = remove_metabolites!(model, [id]) remove_metabolite!(model::StandardModel, id::String) = remove_metabolites!(model, [id])
""" """
remove_genes!( remove_genes!(
...@@ -210,7 +210,8 @@ constrain reactions that require the genes to function to carry zero flux. ...@@ -210,7 +210,8 @@ constrain reactions that require the genes to function to carry zero flux.
remove_gene!(model, "g1") remove_gene!(model, "g1")
``` ```
""" """
remove_gene!(model::StandardModel, gid::String; knockout_reactions::Bool = false) = remove_genes!(model, [gid]; knockout_reactions = knockout_reactions) remove_gene!(model::StandardModel, gid::String; knockout_reactions::Bool = false) =
remove_genes!(model, [gid]; knockout_reactions = knockout_reactions)
function set_bound(model::StandardModel, reaction_id::String; ub, lb) function set_bound(model::StandardModel, reaction_id::String; ub, lb)
reaction = model.reactions[reaction_id] reaction = model.reactions[reaction_id]
......
...@@ -151,8 +151,7 @@ function add_model_with_exchanges( ...@@ -151,8 +151,7 @@ function add_model_with_exchanges(
rxnsadd = "$(model_name)_" .* reactions(model) rxnsadd = "$(model_name)_" .* reactions(model)
if !isnothing(biomass_id) if !isnothing(biomass_id)
metsadd = metsadd = ["$(model_name)_" .* metabolites(model); "$(model_name)_" * biomass_id]
["$(model_name)_" .* metabolites(model); "$(model_name)_" * biomass_id]
else else
metsadd = "$(model_name)_" .* metabolites(model) metsadd = "$(model_name)_" .* metabolites(model)
end end
...@@ -247,7 +246,7 @@ function join_with_exchanges( ...@@ -247,7 +246,7 @@ function join_with_exchanges(
add_biomass_objective = true, add_biomass_objective = true,
biomass_ids = String[], biomass_ids = String[],
model_names = String[], model_names = String[],
)::CoreModel where M <: MetabolicModel )::CoreModel where {M<:MetabolicModel}
if add_biomass_objective && isempty(biomass_ids) if add_biomass_objective && isempty(biomass_ids)
throw( throw(
...@@ -284,7 +283,8 @@ function join_with_exchanges( ...@@ -284,7 +283,8 @@ function join_with_exchanges(
nnz_total = nnz_total =
sum(length(first(nnz)) for nnz in nnzs) + sum(length(first(nnz)) for nnz in nnzs) +
length(models) * length(exchange_rxn_ids) + length(models) * length(exchange_rxn_ids) +
length(exchange_met_ids) + nnz_add length(exchange_met_ids) +
nnz_add
n_reactions_metabolic = sum(reaction_lengths) n_reactions_metabolic = sum(reaction_lengths)
n_reactions_total = n_reactions_metabolic + length(exchange_rxn_ids) + column_add n_reactions_total = n_reactions_metabolic + length(exchange_rxn_ids) + column_add
n_metabolites_metabolic = sum(metabolite_lengths) n_metabolites_metabolic = sum(metabolite_lengths)
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
lp = flux_balance_analysis(cp, Tulip.Optimizer) lp = flux_balance_analysis(cp, Tulip.Optimizer)
@test termination_status(lp) == MOI.OPTIMAL @test termination_status(lp) == MOI.OPTIMAL
sol = JuMP.value.(lp[:x]) sol = JuMP.value.(lp[:x])
@test isapprox(objective_value(lp), expected_optimum, atol=TEST_TOLERANCE) @test isapprox(objective_value(lp), expected_optimum, atol = TEST_TOLERANCE)
@test isapprox(cp.c' * sol, expected_optimum, atol=TEST_TOLERANCE) @test isapprox(cp.c' * sol, expected_optimum, atol = TEST_TOLERANCE)
# test the "nicer output" variants # test the "nicer output" variants
fluxes_vec = flux_balance_analysis_vec(cp, Tulip.Optimizer) fluxes_vec = flux_balance_analysis_vec(cp, Tulip.Optimizer)
......
...@@ -5,7 +5,10 @@ ...@@ -5,7 +5,10 @@
add_gene!(m, Gene("g1")) add_gene!(m, Gene("g1"))
add_gene!(m, Gene("g2")) add_gene!(m, Gene("g2"))
add_reaction!(m, Reaction("v1", metabolites = Dict("A" => -1.0, "B" => 1.0), grr = [["g1"]])) add_reaction!(
m,
Reaction("v1", metabolites = Dict("A" => -1.0, "B" => 1.0), grr = [["g1"]]),
)
add_reaction!( add_reaction!(
m, m,
Reaction("v2", metabolites = Dict("A" => -1.0, "B" => 1.0), grr = [["g1", "g2"]]), Reaction("v2", metabolites = Dict("A" => -1.0, "B" => 1.0), grr = [["g1", "g2"]]),
......
...@@ -12,14 +12,18 @@ ...@@ -12,14 +12,18 @@
# atom tracker # atom tracker
atom_fluxes = atom_exchange(sol, model) atom_fluxes = atom_exchange(sol, model)
@test isapprox(atom_fluxes["C"], 37.19016648975907; atol=TEST_TOLERANCE) @test isapprox(atom_fluxes["C"], 37.19016648975907; atol = TEST_TOLERANCE)
@test atom_exchange("FBA", model)["C"] == 0.0 @test atom_exchange("FBA", model)["C"] == 0.0
@test isapprox(atom_exchange("BIOMASS_Ecoli_core_w_GAM", model)["C"], -42.5555; atol=TEST_TOLERANCE) @test isapprox(
atom_exchange("BIOMASS_Ecoli_core_w_GAM", model)["C"],
-42.5555;
atol = TEST_TOLERANCE,
)
# metabolite trackers # metabolite trackers
consuming, producing = metabolite_fluxes(sol, model) consuming, producing = metabolite_fluxes(sol, model)
@test isapprox(consuming["atp_c"]["PFK"], -7.47738; atol=TEST_TOLERANCE) @test isapprox(consuming["atp_c"]["PFK"], -7.47738; atol = TEST_TOLERANCE)
@test isapprox(producing["atp_c"]["PYK"], 1.75818; atol=TEST_TOLERANCE) @test isapprox(producing["atp_c"]["PYK"], 1.75818; atol = TEST_TOLERANCE)
# set bounds # set bounds
cbm = make_optimization_model(model, optimizer) cbm = make_optimization_model(model, optimizer)
......