SciML / EasyModelAnalysis.jl

High level functions for analyzing the output of simulations
MIT License
81 stars 14 forks source link

Add optimal_parameter_intervention_for_threshold #96

Closed YingboMa closed 1 year ago

YingboMa commented 1 year ago
using EasyModelAnalysis
@variables t x(t)
@parameters p
D = Differential(t)
eqs = [D(x) ~ p * x]
@named sys = ODESystem(eqs)
prob = ODEProblem(sys, [x => 0.01], (0.0, Inf), [p => 1.0])

opt_ps, (s1, s2, s3), ret = optimal_parameter_intervention_for_threshold(prob, x, 3,
                                                                         abs(p)^2, [p],
                                                                         [-5.0], [0.0],
                                                                         (2.0, 45.0), 50);
plot(s1, lab = "pre-intervention")
plot!(s2, lab = "intervention")
plot!(s3, xlims = (0, s3.t[end]), ylims = (0, 5), lab = "post-intervention", dpi = 300)

param_intervention