@@ -15,18 +15,33 @@ julia> f = Flow(ocp, (x, p) -> p)
1515 The dimension of the output of the control function must be consistent with the dimension usage of the control of the optimal control problem.
1616"""
1717function CTFlows. Flow (
18- ocp:: OptimalControlModel{T,V} ,
19- u_:: Union{Function, ControlLaw{<:Function,T,V}} ;
18+ ocp:: CTModels.Model ,
19+ u_:: CTFlows. ControlLaw ;
2020 alg= __alg (),
2121 abstol= __abstol (),
2222 reltol= __reltol (),
2323 saveat= __saveat (),
2424 kwargs_Flow... ,
25- ) where {T,V}
25+ )
2626 h, u = __create_hamiltonian (ocp, u_) # construction of the Hamiltonian
2727 return __ocp_Flow (ocp, h, u, alg, abstol, reltol, saveat; kwargs_Flow... )
2828end
2929
30+ function CTFlows. Flow (
31+ ocp:: CTModels.Model ,
32+ u_:: Function ;
33+ autonomous:: Bool = __autonomous (),
34+ variable:: Bool = __variable (ocp),
35+ alg= __alg (),
36+ abstol= __abstol (),
37+ reltol= __reltol (),
38+ saveat= __saveat (),
39+ kwargs_Flow... ,
40+ )
41+ h, u = __create_hamiltonian (ocp, u_; autonomous= autonomous, variable= variable) # construction of the Hamiltonian
42+ return __ocp_Flow (ocp, h, u, alg, abstol, reltol, saveat; kwargs_Flow... )
43+ end
44+
3045# ---------------------------------------------------------------------------------------------------
3146"""
3247$(TYPEDSIGNATURES)
@@ -46,10 +61,10 @@ julia> f = Flow(ocp, (t, x, p) -> p[1], (t, x, u) -> x[1] - 1, (t, x, p) -> x[1]
4661 The dimension of the output of the control function must be consistent with the dimension usage of the control of the optimal control problem.
4762"""
4863function CTFlows. Flow (
49- ocp:: OptimalControlModel{T,V} ,
50- u_:: Union{Function, ControlLaw{<:Function,T,V},FeedbackControl{<:Function,T,V}} ,
51- g_:: Union{Function, MixedConstraint{<:Function,T,V},StateConstraint{<:Function,T,V}} ,
52- μ_:: Union{Function, Multiplier{<:Function,T,V}} ;
64+ ocp:: CTModels.Model ,
65+ u_:: Union{CTFlows. ControlLaw{<:Function,T,V},CTFlows. FeedbackControl{<:Function,T,V}} ,
66+ g_:: Union{CTFlows. MixedConstraint{<:Function,T,V},CTFlows. StateConstraint{<:Function,T,V}} ,
67+ μ_:: Union{CTFlows. Multiplier{<:Function,T,V}} ;
5368 alg= __alg (),
5469 abstol= __abstol (),
5570 reltol= __reltol (),
@@ -60,17 +75,34 @@ function CTFlows.Flow(
6075 return __ocp_Flow (ocp, h, u, alg, abstol, reltol, saveat; kwargs_Flow... )
6176end
6277
78+ function CTFlows. Flow (
79+ ocp:: CTModels.Model ,
80+ u_:: Function ,
81+ g_:: Function ,
82+ μ_:: Function ;
83+ autonomous:: Bool = __autonomous (),
84+ variable:: Bool = __variable (ocp),
85+ alg= __alg (),
86+ abstol= __abstol (),
87+ reltol= __reltol (),
88+ saveat= __saveat (),
89+ kwargs_Flow... ,
90+ )
91+ h, u = __create_hamiltonian (ocp, u_, g_, μ_; autonomous= autonomous, variable= variable) # construction of the Hamiltonian
92+ return __ocp_Flow (ocp, h, u, alg, abstol, reltol, saveat; kwargs_Flow... )
93+ end
94+
6395# ---------------------------------------------------------------------------------------------------
6496function __ocp_Flow (
65- ocp:: OptimalControlModel{T,V} ,
66- h:: Hamiltonian ,
67- u:: ControlLaw ,
97+ ocp:: CTModels.Model ,
98+ h:: CTFlows. Hamiltonian ,
99+ u:: CTFlows. ControlLaw ,
68100 alg,
69101 abstol,
70102 reltol,
71103 saveat;
72104 kwargs_Flow... ,
73- ) where {T,V}
105+ )
74106 rhs! = rhs (h) # right and side: same as for a flow from a Hamiltonian
75107 f = hamiltonian_usage (alg, abstol, reltol, saveat; kwargs_Flow... ) # flow function
76108 kwargs_Flow = (kwargs_Flow... , alg= alg, abstol= abstol, reltol= reltol, saveat= saveat)
0 commit comments