Unverified Commit c689159c authored by Miroslav Kratochvil's avatar Miroslav Kratochvil Committed by GitHub
Browse files

Merge pull request #507 from LCSB-BioCore/mo-fix-osqp-again

Simplify tests that use OSQP
parents bea55385 8f396b0b
Pipeline #49245 passed with stages
in 19 minutes and 35 seconds
......@@ -155,6 +155,7 @@ dict_soln = parsimonious_flux_balance_analysis_dict(
modifications = [
silence, # silence the optimizer (OSQP is very verbose by default)
change_constraint("R_EX_glc__D_e"; lb = -12, ub = -12),
change_optimizer_attribute("polish", true),
],
)
......@@ -248,6 +249,7 @@ moment_moma = minimize_metabolic_adjustment_analysis_dict(
modifications = [
silence,
change_optimizer_attribute("polish", true),
change_optimizer_attribute("max-iter", 10_000),
change_constraint("EX_glc__D_e", lb = -1000),
change_constraint("CYTBD"; lb = 0, ub = 0),
add_moment_constraints(ksas, protein_mass_fraction;),
......
@testset "MOMA" begin
model = load_model(StandardModel, model_paths["e_coli_core.json"])
model = test_toyModel()
sol = parsimonious_flux_balance_analysis_dict(
model,
OSQP.Optimizer;
modifications = [silence, change_optimizer_attribute("polish", true)],
)
sol = [looks_like_biomass_reaction(rid) ? 0.5 : 0.0 for rid in reactions(model)]
moma = minimize_metabolic_adjustment_analysis_dict(
model,
sol,
OSQP.Optimizer;
modifications = [
silence,
change_optimizer_attribute("polish", true),
change_constraint("CYTBD"; lb = 0.0, ub = 0.0),
],
modifications = [silence, change_optimizer_attribute("polish", true)],
)
@test isapprox(
moma["BIOMASS_Ecoli_core_w_GAM"],
0.06214149238730545,
atol = QP_TEST_TOLERANCE,
)
@test isapprox(moma["biomass1"], 0.07692307692307691, atol = QP_TEST_TOLERANCE)
end
@testset "Parsimonious flux balance analysis with StandardModel" begin
model = load_model(StandardModel, model_paths["e_coli_core.json"])
model = test_toyModel()
d = parsimonious_flux_balance_analysis_dict(
model,
Tulip.Optimizer;
modifications = [
change_constraint("EX_glc__D_e"; lb = -12, ub = -12),
change_optimizer_attribute("IPM_IterationsLimit", 500),
],
qp_modifications = [
change_optimizer(OSQP.Optimizer),
change_optimizer_attribute("polish", true),
silence,
],
)
v = parsimonious_flux_balance_analysis_vec(
model,
Tulip.Optimizer;
modifications = [
change_constraint("EX_glc__D_e"; lb = -12, ub = -12),
change_constraint("EX_m1(e)", lb = -10.0),
change_optimizer_attribute("IPM_IterationsLimit", 500),
],
qp_modifications = [
......@@ -29,6 +17,5 @@
# The used optimizer doesn't really converge to the same answer everytime
# here, we therefore tolerate a wide range of results.
@test isapprox(d["PGM"], -17.606459419216442, atol = QP_TEST_TOLERANCE)
@test isapprox(v[8], -17.606459419216442, atol = QP_TEST_TOLERANCE)
@test isapprox(d["biomass1"], 10.0, atol = QP_TEST_TOLERANCE)
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