Filtration.jl API
For the developers, here are the private methods.
Index
Filtration.FiltrationFiltration.ControlFiltration.ControlFiltration.CostateFiltration.CostateFiltration.ExtremalFiltration.ModelFiltration.ModelFiltration.ModelFiltration.MultiModelFiltration.MultiModelFiltration.MultiModelFiltration.MultiSynthesisFiltration.MultiSynthesisFiltration.ODELikeFiltration.ODELikeFiltration.ParetoFiltration.ParetoFiltration.SolutionFiltration.StateFiltration.StateFiltration.SynthesisFiltration.SynthesisFiltration.__sepFiltration.add_solution_to_synthesis!Filtration.check_rootFiltration.compute_phiFiltration.construct_extremalFiltration.controlFiltration.controlFiltration.costateFiltration.cut_SLFiltration.cutsFiltration.dispersal_locusFiltration.dispersal_locus_2Filtration.fitFiltration.infinite_horizon_controlFiltration.infinite_horizon_solveFiltration.interpolate_cutFiltration.real_solveFiltration.simulateFiltration.solutionFiltration.solveFiltration.solve_MPFiltration.solve_MSPFiltration.solve_PFiltration.solve_PSPFiltration.solve_SPFiltration.stateFiltration.stateFiltration.switching_locus
Documentation
Filtration.Filtration — Module
Filtration module.
Lists all the imported modules and packages:
BaseDocStringExtensionsForwardDiffIpoptNonlinearSolveOptimizationOptimizationMOIOptimizationOptimJLOrdinaryDiffEqRoots
List of all the exported names:
ControlCostateExtremalModelMultiModelMultiSynthesisODELikeParetoSolutionStateSynthesis__sepadd_solution_to_synthesis!check_rootcompute_phiconstruct_extremalcontrolcostatecut_SLcutsdispersal_locusdispersal_locus_2fitinfinite_horizon_controlinfinite_horizon_solveinterpolate_cutreal_solvesimulatesolutionsolvesolve_MPsolve_MSPsolve_Psolve_PSPsolve_SPstateswitching_locus
Filtration.Control — Type
Structure of a Control, composed by
- control : a vector of functions
- time : a vector of times
- N : the number of intervals
- m : size of the control
Filtration.Control — Method
Callable method for the Control structure. This return the value of the control at time t.
Arguments
- t : the time $t$
Return
- u : the value of the control $u(t)$ at the time $t$
Filtration.Costate — Type
Structure for a Costate, composed by
- z : state-costate as a vector of
ODESolution - time : a vector of times
- N : the number of intervals
- n : size of the co-state, which is also the size of the state
Filtration.Costate — Method
Callable method for the Costate structure. This return the value of the costate at time t.
Arguments
- t : the time $t$
Return
- x : the value of the costate $\lambda(t)$ at the time $t \in [t_0, tf]$
Filtration.Extremal — Type
Structure of an Extremal, composed by
- state : a
State - costate : a
Costate - control : a
Control - time : a vector of times
- N : the number of intervals
Filtration.Model — Type
Structure of a Model, composed by:
- p : parameters of the model
- criteria_type : either
:minor:max - λ₀ : the constant of the Hamiltonian assiciated to the cost
- F₊ : vector field with control u=+1
- F₋ : vector field with control u=-1
- F₀ : drift vector field
- F₁ : control vector field
- dF₊ : derivative of F₊
- dF₋ : derivative of F₋
- dF₀ : derivative of F₀
- dF₁ : derivative of F₁
- H₀ : Hamiltonian lift of F₀
- H₁ : Hamiltonian lift of F₁
- H₀₁ : Lie bracket of H₀ and H₁
- H : Pseudo-Hamiltonian
- dynamic! : function for the state dynamics
- singular_dynamic! : function for the singular state dynamics
- extremal_dynamic! : function for the extremal dynamics
- singular_extremal_dynamic! : function for the singular extremal dynamics
- λₛ_ : function to compute the singular costate
- xₛ : singular state
- λₛ : singular costate
- uₛ : singular control
- Δx₂ : value of the end of the singular arc
- Δt : time of the end of the singular arc
- n : number of meaningful states for the user (used for display and structural identifiability, see
Base.showand theFiltrationModelingToolkitExt/FiltrationStructuralIdentifiabilityExtpackage extensions inext/) — not the size of the vector $x$ actually integrated bydynamic!, which always has 3 components $(cost, x_1, x_2)$ regardless ofn. When aModelis built with $g^+ = g^- = 1$ (the 4-argument constructor below),nis 2: the resulting $x_2(t) = t$ carries no information beyond elapsed time, so it is excluded from what's considered a meaningful state, even though it is still present and integrated as the 3rd component of $x$. Code that needs the true size of $x$ (e.g. to size an array meant to hold a full state) should uselength(x)/length(x0)on an actual state vector, not this field. - m : dimension of the control space
Filtration.Model — Method
Model(
e⁺::Function,
e⁻::Function,
f⁺::Function,
f⁻::Function,
g⁺::Function,
g⁻::Function,
p::Vector{<:Real},
criteria_type::Symbol;
initial_guess,
n,
m
) -> Model
Constructor for Model.
Arguments
- e⁺ : the function $e^+(x_1, p)$
- e⁻ : the function $e^-(x_1, p)$
- f⁺ : the function $f^+(x_1, p)$
- f⁻ : the function $f^-(x_1, p)$
- g⁺ : the function $g^+(x_1, p)$
- g⁻ : the function $g^-(x_1, p)$
- p : parameters of previous functions
- criteria_type : the criteria type, either
:minor:max
Keyword arguments (optional)
- initial_guess : initial guess for the singular state $x_s$, initialized to 1.
- n : number of meaningful states reported on the resulting
Model(see theModelstruct docstring — this does not change the actual dimension integrated bydynamic!, always 3), initialized to 3. - m : dimension of the control space, initialized to 1.
Returns
- model : the
Model
Filtration.Model — Method
Model(
e₊::Function,
e₋::Function,
f⁺::Function,
f⁻::Function,
p::Vector{<:Real},
criteria_type::Symbol;
initial_guess,
n,
m
) -> Model
Constructor for a Model.
This function is a wrapper of Model function, where the functions $g_1$ and $g_2$ are set to 1. This leads to $\dot x_2 = 1$ with $x_2(t_0) = 0$, ie. $x_2(t) = t$.
Arguments
- e₊ : the function $e_^+(x_1, p)$
- e₋ : the function $e_^-(x_1, p)$
- f⁺ : the function $f_^+(x_1, p)$
- f⁻ : the function $f_^-(x_1, p)$
- p : parameters of previous functions
- criteria_type : the criteria type, either
:minor:max
Keyword arguments (optional)
- initial_guess : initial guess for the singular state $x_s$, initialized to 1.
- n : number of meaningful states reported on the resulting
Model, initialized to 2 here since $x_2(t) = t$ carries no information beyond elapsed time (see theModelstruct docstring). The vector $x$ actually integrated bydynamic!still has 3 components $(cost, x_1, x_2)$ —ndoes not shrink it, it only affectsBase.showand structural identifiability. Do not use this field as the size of a full state vector. - m : dimension of the control space, initialized to 1.
Filtration.MultiModel — Type
Structure of a MultiModel, composed by
- models : a vector of
Models, which corresponds to turnpike - __models : a vector of
Models, which corresponds to anti-turnpike - xₛ : vector of singular state value, which corresponds to turnpike
- __xₛ : vector of singular state value, which corresponds to anti-turnpike
- N : number of models
- __N : numbers of __models
Filtration.MultiModel — Method
MultiModel(
e₁::Function,
e₂::Function,
f₁::Function,
f₂::Function,
g₁::Function,
g₂::Function,
p::Vector{<:Real},
criteria_type::Symbol,
initial_guesses::Vector{<:Real}
) -> MultiModel
Constructor for MultiModel
Arguments
- e₁ : the function $e_1(x₁)$
- e₂ : the function $e_2(x₁)$
- f₁ : the function $f_1(x₁)$
- f₂ : the function $f_2(x₁)$
- g₁ : the function $g_1(x₁)$
- g₂ : the function $g_2(x₁)$
- p : parameters of previous functions
- criteria_type : the criteria type, either
:minor:max - initial_guesses : initial guesses for all singular states $x_s$
Returns
- multimodel : the
MultiModel
Filtration.MultiModel — Method
MultiModel(
e₁::Function,
e₂::Function,
f₁::Function,
f₂::Function,
p::Vector{<:Real},
criteria_type::Symbol,
initial_guesses::Vector{<:Real}
) -> MultiModel
Constructor for a MultiModel.
This function is a wrapper of MultiModel function, where the functions $g_1$ and $g_2$ are set to 1. This leads to $\dot x_2 = 1$ with $x_2(t_0) = 0$, ie. $x_2(t) = t$.
Arguments
- e₁ : the function $e_1(x_1)$
- e₂ : the function $e_2(x_1)$
- f₁ : the function $f_1(x_1)$
- f₂ : the function $f_2(x_1)$
- p : parameters of previous functions
- criteria_type : the criteria type, either
:minor:max` - initial_guesses : initial guesses for all singular states $x_s$.
Keyword arguments (optional)
Returns
- multimodel : the
MultiModel
Filtration.MultiSynthesis — Type
Structure of a MultiSynthesis, composed by
- synthesis : the vector of
Synthesis - sep : a vector of
ODESolutionthat connect synthesis - N : number of
Synthesis
Filtration.MultiSynthesis — Method
MultiSynthesis(
multimodel::MultiModel,
xlim::Tuple{Real, Real},
ylim::Tuple{Real, Real}
) -> MultiSynthesis
Constructor for MultiSynthesis
Arguments
- multimodel : a
MultiModel - xlim : limits of x-axis
- ylim : limits of y-axis
Return
- multisynthesis : a
MultiSynthesis
Filtration.ODELike — Type
Structure of a ODELike, composed by
- u : a vector of controls
- t : a vector of times
- S : a function
- lb : the lower bound used to bracket the root search when evaluating the curve, either a constant, a
ODESolution(a cut) or anotherODELike - ub : the upper bound used to bracket the root search when evaluating the curve, either a constant, a
ODESolution(a cut) or anotherODELike
Filtration.ODELike — Method
Evaluate the ODE at time t
Filtration.Pareto — Type
Structure representing a Pareto front for a given model, composed by ;
- model : a
Model - get_sol : function to get the optimal solution for a given λ
Filtration.Pareto — Method
Pareto(model::Model) -> Pareto
Constructor for Pareto
Arguments
- model : a
Model
Returns
- pareto : the
Pareto
Filtration.Solution — Type
Structure of a Solution, composed by
- state : a
State - control : a
Control - time : a vector of times
- N : the number of intervals
- x0 : the initial state $x(t_0) = x_0$
Filtration.State — Type
Structure of a State, composed by
- state : a vector of
ODESolution - time : a vector of times
- N : the number of intervals
- n : number of states
Filtration.State — Method
Callable method for the State structure. This return the value of the state at time t.
Arguments
- t : the time $t$
Return
- x : the value of the state $x(t)$ at the time $t$
Filtration.Synthesis — Type
Structure of a optimal synthesis, composed by:
- model : a
Model - xlim : the limits of the x-axis
- ylim : the limits of the y-axis
- cut₋ : the cut₋ function
- cut₊ : the cut₊ function
- SL : the switching locus
- DL : the dispersal locus with the switching locus
- DL2 : the dispersal locus with the singular curve
Filtration.Synthesis — Method
Synthesis(
model::Model,
xlim::Tuple{Real, Real},
ylim::Tuple{Real, Real}
) -> Synthesis
Constructor of a Synthesis.
Arguments
- model : a
Model - xlim : the limits of x-axis
- ylim : the limits of y-axis
Returns
- synthesis : the
Synthesis
Filtration.__sep — Method
__sep(
synthesis1::Synthesis,
synthesis2::Synthesis,
xmax::Real
) -> SciMLBase.ODESolution
Provide the separation curve of two synthesis by diffetial continuation method.
Arguments
- synthesis1 : the below
Synthesis - synthesis2 : the above
Synthesis
Return
- sol : the separation curve, as an
ODESolution
Filtration.add_solution_to_synthesis! — Function
Add a Solution to a synthesis plot.
Implemented in the FiltrationPlotsExt package extension — only usable once the caller's own environment has using Plots (see [weakdeps]/[extensions] in Project.toml).
Arguments
- plt : the synthesis plot
- solution : the
Solution
Keyword arguments (optional)
- element : list of index of
solution.stateto plot, initialized to[1, ..., solution.N] - axis_arrow : symbol to indicate the axis for the arrow, initialized to
nothing(no arrow). This symbol must be:xor:y. - arrow : vector of
axis_arrowcoordinates to make arrows, initialized tonothing - color : color of trajectory, initialized to the first color of the classical theme palette
- nb_pts : number of points for each sub-segments, initialized to 5
- label : the label of the trajectory, initialized to an empty string
- kwargs... : keyword arguments for plot
Return
- plt : the plot
Filtration.check_root — Function
Plot a function where we need to ensure that there is only one zero of it, on the domain of interest. An initial guess of this zero can be provided to the constructor of the Model type.
Implemented in the FiltrationPlotsExt package extension — only usable once the caller's own environment has using Plots (see [weakdeps]/[extensions] in Project.toml).
Arguments
- e⁺ : the function $e^+(x_1, p)$
- e⁻ : the function $e^-(x_1, p)$
- f⁺ : the function $f^+(x_1, p)$
- f⁻ : the function $f^-(x_1, p)$
- g⁺ : the function $g^+(x_1, p)$
- g⁻ : the function $g^-(x_1, p)$
- p : parameters of previous functions
- criteria_type : the criteria type, either
:minor:max
Keyword arguments (optional)
- xlim : limits for x axis, initialized to (0,10)
- initial_guess : initial guess(es) for zero of the function. Initialized to
nothing. - kwargs... : keyword arguments for plot
Return
- plt : the plot
Filtration.compute_phi — Method
compute_phi(
extremal::Extremal,
model::Model;
p
) -> Filtration.var"#phi#74"{Vector{var"#s280"}, Extremal, Model} where var"#s280"<:Real
Compute the function $t \mapsto \phi(x(t), p(t))$ of an Extremal computed on a Model.
Arguments
- extremal : the
Extremal - model : the
Model
Keyword arguments (optional)
- p : a vector of parameter for the model (default is the parameters of the model).
Return
- phi : the function $\phi$.
Filtration.construct_extremal — Method
construct_extremal(
model::Model,
solution::Solution;
p
) -> Extremal
Construct an Extremal from a Solution from a Model.
Arguments
- model : a
Model - solution: a
Solution
Keyword arguments (optional)
- p : a vector of parameter for the model (default is the parametes of the model).
Return
- extremal : the
Extremal
Filtration.control — Method
control(extremal::Extremal) -> Control
Getter for the Control of an Extremal.
Arguments
- extremal : an
Extremal
Return
- control : the
Controlof theExtremal
Filtration.control — Method
control(solution::Solution) -> Control
Getter for the Control of a Solution.
Arguments
- solution : a
Solution
Return
- control : the
Controlof theSolution
Filtration.costate — Method
costate(extremal::Extremal) -> Costate
Getter for the Costate of an Extremal.
Arguments
- extremal : an
Extremal
Return
- costate : the
Costateof theExtremal
Filtration.cut_SL — Method
cut_SL(
model::Model,
SL::SciMLBase.ODESolution,
xlim::Tuple{Real, Real},
ylim::Tuple{Real, Real}
) -> Any
Comute the cut associated to the switching locus which corresponds to the trajectory which leads to the point $(x,y)$ at the final time, where $(x,y)$ is the last point of the switching locus.
Arguments
- model : a
Model - SL : the switching locus
- xlim : the limits of state $x_2$
- ylim : the limits of state $x_1$
Returns
- cut_SL : the cut associated to the switching locus
Filtration.cuts — Method
cuts(
model::Model,
xlim::Tuple{Real, Real},
ylim::Tuple{Real, Real}
) -> Tuple{SciMLBase.ODESolution, SciMLBase.ODESolution}
Compute the cuts $c_-(t)$ and $c_+(t)$, which corresponds to the curves which leads to the last point of the singular locus. Function $c_-(t)$ is associated to the control $u = -1$ and $c_+(t)$ is associated to the control $u = 1$.
Arguments
- model : a
Model - xlim : the limits of state $x_2$
- ylim : the limits of state $x_1$
Returns
- cut₋ : the function $c_-$
- cut₊ : the function $c_+$
Filtration.dispersal_locus — Method
dispersal_locus(
model::Model,
xlim::Tuple{Real, Real},
ylim::Tuple{Real, Real},
SL::SciMLBase.ODESolution,
cut₋::SciMLBase.ODESolution;
method,
cutSL,
n
) -> Union{ODELike, SciMLBase.ODESolution}
Compute the dispersal locus curve with a direct or a continuation method. The method is initialized to $:direct$.
If you have already computed the cut associated to the switching locus with the function cut_SL and want to use the method $:direct$, please provide it in order to avoid computing it again.
Arguments
- model : the
Model - xlim : the limits of state $x_2$
- ylim : the limits of state $x_1$
- SL : the switching locus curve
- cut₋ : the cut₋ curve
Keyword arguments
- method : the method used to compute the dispersal locus
- cutSL : the cut associated to the switching locus
- n : the number of points used to compute the dispersal locus
Returns
- DL : the dispersal locus curve
Filtration.dispersal_locus_2 — Method
dispersal_locus_2(
model::Model,
xlim::Tuple{Real, Real},
ylim::Tuple{Real, Real},
DL::Union{ODELike, SciMLBase.ODESolution};
method,
cutSL,
n
) -> SciMLBase.ODESolution
Compute the second dispersal locus curve with a direct or a continuation method. The method is initialized to $:continuation$.
Arguments
- model : the
Model - xlim : the limits of state $x_2$
- ylim : the limits of state $x_1$
- DL : the first dispersal locus curve
Keyword arguments
- method : the method used to compute the second dispersal locus, either
:continuationor:direct - cutSL : the cut associated to the switching locus, required for the
:directmethod - n : the number of points used to compute the second dispersal locus with the
:directmethod
Returns
- DL2 : the second dispersal locus curve
Filtration.fit — Method
fit(
model::Model,
control::Control,
time::Vector{<:Real},
data_x0::AbstractVecOrMat{<:Real},
initial_p::Vector{<:Real},
x0::Vector{<:Real};
method,
obs_indices,
get_m,
u,
slope,
lb,
ub,
max_iter,
verbose
) -> Any
Fit the model parameters to the given data by minimizing the least square error between the simulated and observed data. The initial state can be known, partially unknown, or fully free. See here for more information.
Arguments
- model : a
Model - control : a
Control - time : vector of time points where data are observed
- datax0 : observed data — a vector (one state index) or an `ntime × length(obsindices)
matrix (several indices, columns matchingobsindices`'s order) - initial_p : initial guess for the model parameters
- x0 : initial state (known value for
:known, initial guess for:unknown/:free)
Keyword Arguments
- method : $:known$, $:unknown$ or $:free$ (default : $:known$)
- obsindices : which state indices `datax0
holds data for —:known/:freeonly (default :[1]`) - get_m : function to compute the unknown initial state variable from control and parameters (required if $method == :unknown$)
- u : singular control applied before initial time (required if $method == :unknown$)
- slope : slope of state $x_0$ before initial time (required if $method == :unknown$)
- lb : lower bounds for the model parameters (default : zeros)
- ub : upper bounds for the model parameters (default : Inf)
- maxiter : cap on Ipopt's iteration count — $:known$/$:free$ only (default :
nothing, Ipopt's own default). See `fitknown/fit_free` for why the returned point is unaffected by whether this cap actually triggers. - verbose : whether to print optimization details (default : false)
Return
fitted_pfor $:known$/$:unknown$ ;(p, x0)for $:free$ — the return shape depends onmethod.
Filtration.infinite_horizon_control — Method
infinite_horizon_control(model::Model, x₁::Real) -> Real
The optimal control in feedback form $u = k(x_1)$ — as a function of the current state $x_1$ rather than of time — for the infinite-horizon regime: go towards the singular level $x_s$ at maximum rate, and apply the singular control once reached.
This is the limit, far from the terminal time, of the finite-horizon PMP synthesis (solve/Synthesis): every optimal trajectory long enough spends almost all its time on the singular arc at $x_1 = x_s$, reached and left as fast as possible. Unlike solve, this needs none of cuts/switching_locus/dispersal_locus — only model.xₛ/model.uₛ, already computed once at Model construction.
Arguments
- model : a
Model - x₁ : the current state $x_1$
Return
- u : the feedback control — $\pm 1$ while away from the singular level,
model.uₛonce $x_1 = x_s$
Filtration.infinite_horizon_solve — Method
infinite_horizon_solve(
model::Model,
init_x₂::Real,
end_x₂::Real,
init_x₁::Real
) -> Solution
Solve the optimal control problem in the infinite-horizon regime, using infinite_horizon_control: integrate with $u = \pm 1$ (whichever infinite_horizon_control commands from init_x₁) until $x_1 = x_s$, then continue on the singular arc until $x_2 =$ end_x₂.
Unlike solve_MSP/solve_PSP (the finite-horizon solutions with the same $u_\mp \circ u_s$ structure), there is no final bang arc to land exactly on end_x₂ at the optimal final time — that correction is exactly what this function skips to stay cheap. It is only a good approximation of solve when end_x₂ is far enough from init_x₂ for the infinite-horizon regime to apply; for a short horizon, use solve instead. It also assumes $x_2$ has not already reached end_x₂ before $x_1$ reaches $x_s$ — again, only valid far enough from the terminal time.
Arguments
- model : a
Model - init_x₂ : the initial state $x_2(t_0)$
- end_x₂ : the final state $x_2(t_f)$
- init_x₁ : the initial state $x_1(t_0)$
Returns
- sol : the
Solution
Filtration.interpolate_cut — Method
interpolate_cut(cut, y) -> Any
Interpolate a cut at a given $y$, and provide the associated $x$.
Arguments
- cut : a
ODESolution - y : the value of $y$
Returns
- x : the value of $x$
Filtration.real_solve — Method
real_solve(
model::Model,
init_x₂::Real,
end_x₂::Real,
init_x₁::Real,
N::Int64;
method,
verbose
) -> Solution
Provide a real solution, where the control is only composed by -1 and 1 values, by the method. method can be :control, :singular or :optimal.
Arguments
- model : a
Model - init_x₂ : the initial state $x_2(t_0)$
- end_x₂ : the final state $x_2(t_f)$
- init_x₁ : the initial state $x_1(t_0)$
- N : the number of subdivision of the singular arc
Keyword arguments (optional)
- method : method used to get the real solution. Can be
:control,:singularor:optimal. Initialized to:singular - verbose : if true, print the optimization process (default is false)
Return
- real_sol : the
Solution
Filtration.simulate — Method
simulate(
model::Model,
control::Control,
x0::Vector{<:Real};
p
) -> Solution
Simulate a Control on a Model, starting from an initial state $x(t_0) = x_0$.
Arguments
- model : a
Model - control : a
Control - x0: an initial state $x(t_0) = x_0$
Keyword arguments (optional)
- p : a vector of parameter for the model, (default is the parametes of the model).
Return
- solution : the
Solution
Filtration.solution — Method
solution(
synthesis::Synthesis,
init_x₂::Real,
end_x₂::Real,
init_x₁::Real
) -> Solution
Wrapper to get solution from synthesis.
Arguments
- synthesis : a
Synthesis - init_x₂ : the initial state $x_2(t_0)$
- end_x₂ : the final state $x_2(t_f)$
- init_x₁ : the initial state $x_1(t_0)$
Returns
- sol: the
Solution
Filtration.solve — Method
solve(
model::Model,
init_x₂::Real,
end_x₂::Real,
init_x₁::Real;
cut₋,
cut₊,
cutSL,
SL,
DL,
DL2
) -> Solution
Solve the optimal control problem associated to a Model model by indirect shooting.
Arguments
- model : a
Model - init_x₂ : the initial state $x_2(t_0)$
- end_x₂ : the final state $x_2(t_f)$
- init_x₁ : the initial state $x_1(t_0)$
Returns
- sol: the
Solution
Filtration.solve_MP — Method
solve_MP(
model::Model,
init_x₂::Real,
end_x₂::Real,
init_x₁::Real;
SL
) -> Solution
Solve the optimal control problem associated to a Model model by indirect method, with the structure given by $u_- \circ u_+$, and when the change is done by intersection with the switching curve
This function must be used only if we know the structure. If you don't know the structure of the solution, use solve function instead.
Arguments
- model : a
Model - init_x₂ : the initial state $x_2(t_0)$
- end_x₂ : the final state $x_2(t_f)$
- init_x₁ : the initial state $x_1(t_0)$
Returns
- sol: the
Solution
Filtration.solve_MSP — Method
solve_MSP(
model::Model,
init_x₂::Real,
end_x₂::Real,
init_x₁::Real
) -> Solution
Solve the optimal control problem associated to a Model model, with the structure given by $u_- \circ u_s \circ u_+$.
This function must be used only if we know the structure. If you don't know the structure of the solution, use solve function instead.
Arguments
- model : a
Model - init_x₂ : the initial state $x_2(t_0)$
- end_x₂ : the final state $x_2(t_f)$
- init_x₁ : the initial state $x_1(t_0)$
Returns
- sol: the
Solution
Filtration.solve_P — Method
solve_P(
model::Model,
init_x₂::Real,
end_x₂::Real,
init_x₁::Real
) -> Solution
Solve the optimal control problem associated to a Model model, with the structure given by $u_+$.
This function must be used only if we know the structure. If you don't know the structure of the solution, use solve function instead.
Arguments
- model : a
Model - init_x₂ : the initial state $x_2(t_0)$
- end_x₂ : the final state $x_2(t_f)$
- init_x₁ : the initial state $x_1(t_0)$
Returns
- sol: the
Solution
Filtration.solve_PSP — Method
solve_PSP(
model::Model,
init_x₂::Real,
end_x₂::Real,
init_x₁::Real
) -> Solution
Solve the optimal control problem associated to the membrane filtration model by indirect shooting, with the structure given by $u_+ \circ u_s \circ u_+$
This function must be used only if we know the structure. If you don't know the structure of the solution, use solve function instead.
Arguments
- model : a
Model - init_x₂ : the initial state $x_2(t_0)$
- end_x₂ : the final state $x_2(t_f)$
- init_x₁ : the initial state $x_1(t_0)$
Returns
- sol: the
Solution
Filtration.solve_SP — Method
solve_SP(
model::Model,
init_x₂::Real,
end_x₂::Real,
init_x₁::Real
) -> Solution
Solve the optimal control problem associated to the membrane filtration model by indirect shooting, with the structure given by $u_s \circ u_+$
This function must be used only if we know the structure. If you don't know the structure of the solution, use solve function instead.
Arguments
- model : a
Model - init_x₂ : the initial state $x_2(t_0)$
- end_x₂ : the final state $x_2(t_f)$
- init_x₁ : the initial state $x_1(t_0)$
Returns
- sol: the
Solution
Filtration.state — Method
state(extremal::Extremal) -> State
Getter for the State of an Extremal.
Arguments
- extremal : an
Extremal
Return
- state : the
Stateof theExtremal
Filtration.state — Method
state(solution::Solution) -> State
Getter for the State of a Solution.
Arguments
- solution : a
Solution
Return
- state : the
Stateof theSolution
Filtration.switching_locus — Method
switching_locus(
model::Model,
xlim::Tuple{Real, Real},
ylim::Tuple{Real, Real}
) -> SciMLBase.ODESolution
Switching locus function computed by continuation method.
A state $[x_1, x_2]$ belongs to the switching curve if $S(x_2, x_1) = 0$, where $S \colon \mathbb R^2 \to \mathbb R$ is defined by
\[S(x_2, x_1) = H(x_1, \varphi_1(x_1, x_2))\]
The function $\varphi_1$ coresponds to the solution at the final time of the state $x_1$ by applying the control $u_+$, and the function $H$ is defined by
\[ H(x_1, x_{1,f}) = \lambda_1(x_1, x_{1,f}) (f_+(x_1) + f_-(x_1)) + \lambda_2(x_{1,f})(g_+(x_1) + g_-(x_1)) - (e_+(x_1) + e_-(x_1))\]
where
\[ \lambda_1(x_1, x_{1,f}) = \frac{e_+(x_1) - \lambda_2(x_{1,f}) g_+(x_1)}{f_+(x_1)}\]
and
\[ \lambda_2(x_{1,f}) = \frac{e_+(x_1) + e_-(x_1)}{g_+(x_1) + g_-(x_1)}. \]
We suppose that there exsits the switching locus $SL(x_1)$ such that $S(x_1, SL(x_1)) = 0$. Since $S$ is constant, we have
\[ \frac{\partial S}{\partial x_1}(x_1, SL(x_1)) + \frac{\partial S}{\partial x_2}(x_1, SL(x_1)) SL'(x_1) = 0\]
By the previous hypothesis, $\frac{\partial S}{\partial x_2}(x_1, SL(x_1))$ is invertible. We have so
\[SL'(x_1) = -\left( \frac{\partial S}{\partial x_2}(x_1, SL(x_1)) \right)^{-1} \frac{\partial S}{\partial x_1}(x_1, SL(x_1)).\]
The continuation method consists to solve this ODE with the initial condition $SL(x_s) = x_f - \Delta x_2$. Thanks to the combinaison of ForwardDiff and OrdinaryDiffEq package, the derivative of $\varphi_1$ is computed by automatic differentiation methods by using the variatomal equations.
Arguments
- model: a
Model - xlim : the limits of the state $x_2$
- ylim : the limits of the state $x_1$
Return
- SL : the switching locus function, as an
ODESolution