Commit 7c2660e3 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

implement the solver silencer

this allows sneakiness in linear optimization

Closes #391
parent cddaea86
Pipeline #44958 passed with stages
in 13 minutes and 24 seconds
......@@ -122,7 +122,7 @@ dict_soln = parsimonious_flux_balance_analysis_dict(
model,
OSQP.Optimizer;
modifications = [
change_optimizer_attribute("verbose", false), # silence the optimizer (OSQP is very verbose by default)
silence, # silence the optimizer (OSQP is very verbose by default)
change_constraint("R_EX_glc__D_e", -12, -12),
],
)
......@@ -143,6 +143,6 @@ vec_soln = parsimonious_flux_balance_analysis_vec(
],
qp_modifications = [
change_optimizer(OSQP.Optimizer), # now switch to OSQP (Tulip wouldn't be able to finish the computation)
change_optimizer_attribute("verbose", false), # and silence it.
silence, # and make it quiet.
],
)
......@@ -20,8 +20,7 @@ This may be used to try different approaches for reaching the optimum, and in
problems that may require different optimizers for different parts, such as the
[`parsimonious_flux_balance_analysis`](@ref).
"""
change_optimizer(optimizer) =
(_, opt_model) -> set_optimizer(opt_model, optimizer)
change_optimizer(optimizer) = (_, opt_model) -> set_optimizer(opt_model, optimizer)
"""
change_optimizer_attribute(attribute_key, value)
......@@ -32,3 +31,11 @@ usable keys and values.
"""
change_optimizer_attribute(attribute_key, value) =
(_, opt_model) -> set_optimizer_attribute(opt_model, attribute_key, value)
"""
silence
Modification that disable all output from the JuMP optimizer (shortcut for
`set_silent` from JuMP).
"""
const silence = (_, opt_model) -> set_silent(opt_model)
......@@ -7,10 +7,7 @@
change_constraint("EX_glc__D_e", -12, -12),
change_optimizer_attribute("IPM_IterationsLimit", 500),
],
qp_modifications = [
change_optimizer(OSQP.Optimizer),
change_optimizer_attribute("verbose", false),
],
qp_modifications = [change_optimizer(OSQP.Optimizer), silence],
)
v = parsimonious_flux_balance_analysis_vec(
model,
......@@ -19,10 +16,7 @@
change_constraint("EX_glc__D_e", -12, -12),
change_optimizer_attribute("IPM_IterationsLimit", 500),
],
qp_modifications = [
change_optimizer(OSQP.Optimizer),
change_optimizer_attribute("verbose", false),
],
qp_modifications = [change_optimizer(OSQP.Optimizer), silence],
)
# The used optimizer doesn't really converge to the same answer everytime
......
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