From c458939c8a4a21e5db0358f9866d2cfba7c948e3 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Sat, 29 Jun 2024 16:58:47 +0000 Subject: [PATCH] build based on 4afac10 --- dev/.documenter-siteinfo.json | 2 +- dev/api-callbacks.html | 6 +- dev/api-ctbase.html | 2 +- dev/api-description.html | 8 +-- dev/api-developers.html | 108 +++++++++++++++++----------------- dev/api-diffgeom.html | 46 +++++++-------- dev/api-exceptions.html | 2 +- dev/api-init.html | 2 +- dev/api-model.html | 70 +++++++++++----------- dev/api-parser.html | 10 ++-- dev/api-plot.html | 2 +- dev/api-print.html | 2 +- dev/api-repl.html | 4 +- dev/api-types.html | 32 +++++----- dev/api-utils.html | 20 +++---- dev/index.html | 2 +- 16 files changed, 159 insertions(+), 159 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 95278399..eb5693ce 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-29T11:59:28","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-29T16:58:42","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/dev/api-callbacks.html b/dev/api-callbacks.html index 7e31a283..0ab049b1 100644 --- a/dev/api-callbacks.html +++ b/dev/api-callbacks.html @@ -1,8 +1,8 @@ -Callbacks · CTBase.jl

Callbacks

Index

Documentation

CTBase.get_priority_print_callbacksMethod
get_priority_print_callbacks(
+Callbacks · CTBase.jl

Callbacks

Index

Documentation

+

Get the highest priority stop callbacks.

source
diff --git a/dev/api-ctbase.html b/dev/api-ctbase.html index bf138925..3369888f 100644 --- a/dev/api-ctbase.html +++ b/dev/api-ctbase.html @@ -1,2 +1,2 @@ -CTBase.jl · CTBase.jl

CTBase.jl

Index

Documentation

CTBase.CTBaseModule

CTBase module.

Lists all the imported modules and packages:

  • Base
  • Core
  • DataStructures
  • DocStringExtensions
  • LinearAlgebra
  • MLStyle
  • Parameters
  • PrettyTables
  • Printf
  • ReplMaker
  • Unicode

List of all the exported names:

source
CTBase.TimesDiscType

Type alias for a grid of times. This is used to define a discretization of time interval given to solvers.

julia> const TimesDisc = Union{Times, StepRangeLen}

See also: Time, Times.

source
CTBase.DimensionType

Type alias for a dimension. This is used to define the dimension of the state space, the costate space, the control space, etc.

julia> const Dimension = Integer
source
+CTBase.jl · CTBase.jl

CTBase.jl

Index

Documentation

CTBase.CTBaseModule

CTBase module.

Lists all the imported modules and packages:

  • Base
  • Core
  • DataStructures
  • DocStringExtensions
  • LinearAlgebra
  • MLStyle
  • Parameters
  • PrettyTables
  • Printf
  • ReplMaker
  • Unicode

List of all the exported names:

source
CTBase.TimesDiscType

Type alias for a grid of times. This is used to define a discretization of time interval given to solvers.

julia> const TimesDisc = Union{Times, StepRangeLen}

See also: Time, Times.

source
CTBase.DimensionType

Type alias for a dimension. This is used to define the dimension of the state space, the costate space, the control space, etc.

julia> const Dimension = Integer
source
diff --git a/dev/api-description.html b/dev/api-description.html index d9530eaa..2307ec15 100644 --- a/dev/api-description.html +++ b/dev/api-description.html @@ -1,7 +1,7 @@ Description · CTBase.jl

Description

Index

Documentation

CTBase.DescriptionType

A description is a tuple of symbols. Description is a type alias for a tuple of symbols.

julia> const Description = Tuple{DescVarArg}

See also: DescVarArg.

Example

Base.show is overloaded for descriptions, that is tuple of descriptions are printed as follows:

julia> display( ( (:a, :b), (:b, :c) ) )
 (:a, :b)
-(:b, :c)
source
CTBase.addMethod
add(
     x::Tuple{Vararg{Tuple{Vararg{Symbol}}}},
     y::Tuple{Vararg{Symbol}}
 ) -> Tuple{Tuple{Vararg{Symbol}}}
@@ -12,7 +12,7 @@
 (:a,)
 (:b,)
 julia> descriptions = add(descriptions, (:b,))
-ERROR: IncorrectArgument: the description (:b,) is already in ((:a,), (:b,))
source
CTBase.addMethod
add(
+ERROR: IncorrectArgument: the description (:b,) is already in ((:a,), (:b,))
source
CTBase.addMethod
add(
     x::Tuple{},
     y::Tuple{Vararg{Symbol}}
 ) -> Tuple{Tuple{Vararg{Symbol}}}
@@ -22,7 +22,7 @@
 julia> print(descriptions)
 ((:a,),)
 julia> descriptions[1]
-(:a,)
source
CTBase.getFullDescriptionMethod
getFullDescription(
     desc::Tuple{Vararg{Symbol}},
     desc_list::Tuple{Vararg{Tuple{Vararg{Symbol}}}}
 ) -> Tuple{Vararg{Symbol}}
@@ -31,4 +31,4 @@
 (:b, :c)
 (:a, :c)
 julia> getFullDescription((:a,), desc_list)
-(:a, :b)
source
+(:a, :b)source diff --git a/dev/api-developers.html b/dev/api-developers.html index 63f746fc..dffe57bc 100644 --- a/dev/api-developers.html +++ b/dev/api-developers.html @@ -1,91 +1,91 @@ -Developers · CTBase.jl

Private functions

Index

Documentation

CTBase.DescVarArgConstant

DescVarArg is a Vararg of symbols. DescVarArg is a type alias for a Vararg of symbols.

julia> const DescVarArg = Vararg{Symbol}

See also: Description.

source
Base.:\Method
\(
+Developers · CTBase.jl

Private functions

Index

Documentation

CTBase.DescVarArgConstant

DescVarArg is a Vararg of symbols. DescVarArg is a type alias for a Vararg of symbols.

julia> const DescVarArg = Vararg{Symbol}

See also: Description.

source
Base.:\Method
\(
     x::Tuple{Vararg{Symbol}},
     y::Tuple{Vararg{Symbol}}
 ) -> Tuple{Vararg{Symbol}}
 

Return the difference between the description x and the description y.

Example

julia> (:a, :b) \ (:a,)
-(:b,)
source
Base.showMethod
show(
     io::IO,
     _::MIME{Symbol("text/plain")},
     ocp::OptimalControlModel
 )
-

Print the optimal control problem.

source
Base.showMethod
show(
     io::IO,
     _::MIME{Symbol("text/plain")},
     sol::OptimalControlSolution
 )
-

Prints the solution.

source
Base.showMethod
show(
     io::IO,
     _::MIME{Symbol("text/plain")},
     descriptions::Tuple{Vararg{Tuple{Vararg{Symbol}}}}
 )
 

Print a tuple of descriptions.

Example

julia> display( ( (:a, :b), (:b, :c) ) )
 (:a, :b)
-(:b, :c)
source
CTBase.:⅋Method
⅋(
     X::VectorField{Autonomous, V<:VariableDependence},
     Y::VectorField{Autonomous, V<:VariableDependence}
 ) -> VectorField
 

"Directional derivative" of a vector field: internal and only used to compute efficiently the Lie bracket of two vector fields, autonomous case

Example

julia> X = VectorField(x -> [x[2], -x[1]])
 julia> Y = VectorField(x -> [x[1], x[2]])
 julia> CTBase.:(⅋)(X, Y)([1, 2])
-[2, -1]
source
CTBase.:⅋Method
⅋(
     X::VectorField{NonAutonomous, V<:VariableDependence},
     Y::VectorField{NonAutonomous, V<:VariableDependence}
 ) -> VectorField{NonAutonomous}
 

"Directional derivative" of a vector field: internal and only used to compute efficiently the Lie bracket of two vector fields, nonautonomous case

Example

julia> X = VectorField((t, x, v) -> [t + v[1] + v[2] + x[2], -x[1]], NonFixed, NonAutonomous)
 julia> Y = VectorField((t, x, v) ->  [v[1] + v[2] + x[1], x[2]], NonFixed, NonAutonomous)
 julia> CTBase.:(⅋)(X, Y)(1, [1, 2], [2, 3])
-[8, -1]
source
CTBase.__callbacksMethod
__callbacks() -> Tuple{}
-

Used to set the default value of the callbacks argument. The default value is (), which means that no additional callback is given.

source
CTBase.__callbacksMethod
__callbacks() -> Tuple{}
+

Used to set the default value of the callbacks argument. The default value is (), which means that no additional callback is given.

source
CTBase.__check_all_setMethod
__check_all_set(
     ocp::OptimalControlModel
 ) -> Union{Nothing, Bool}
-

Check if the parameters of an ocp are set.

source
CTBase.__check_control_setMethod
__check_control_set(ocp::OptimalControlModel) -> Bool
-

Throw UnauthorizedCall exception if the control of an ocp is not set.

source
CTBase.__check_control_setMethod
__check_control_set(ocp::OptimalControlModel) -> Bool
+

Throw UnauthorizedCall exception if the control of an ocp is not set.

source
CTBase.__check_dependenciesMethod
__check_dependencies(
     dependencies::Tuple{Vararg{DataType}}
 ) -> Bool
-

Throw IncorrectArgument exception if dependencies arguments are incorrect.

source
CTBase.__check_is_time_setMethod
__check_is_time_set(ocp::OptimalControlModel) -> Bool
-

Throw UnauthorizedCall exception if the time of an ocp is not set.

source
CTBase.__check_state_setMethod
__check_state_set(ocp::OptimalControlModel) -> Bool
-

Throw UnauthorizedCall exception if the state of an ocp is not set.

source
CTBase.__check_is_time_setMethod
__check_is_time_set(ocp::OptimalControlModel) -> Bool
+

Throw UnauthorizedCall exception if the time of an ocp is not set.

source
CTBase.__check_state_setMethod
__check_state_set(ocp::OptimalControlModel) -> Bool
+

Throw UnauthorizedCall exception if the state of an ocp is not set.

source
CTBase.__check_variable_setMethod
__check_variable_set(
     ocp::OptimalControlModel{<:TimeDependence, NonFixed}
 ) -> Bool
-

Throw UnauthorizedCall exception if the variable of an ocp is not set.

source
CTBase.__constraint_labelMethod
__constraint_label() -> Symbol
-

Used to set the default value of the label of a constraint. A unique value is given to each constraint using the gensym function and prefixing by :unamed.

source
CTBase.__control_components_namesMethod
__control_components_names(m::Integer, name::String) -> Any
-

Used to set the default value of the names of the controls. The default value is ["u"] for a one dimensional control, and ["u₁", "u₂", ...] for a multi dimensional control.

source
CTBase.__control_nameMethod
__control_name() -> String
-

Used to set the default value of the names of the control. The default value is "u".

source
CTBase.__criterion_typeMethod
__criterion_type() -> Symbol
-

Used to set the default value of the type of criterion. Either :min or :max. The default value is :min. The other possible criterion type is :max.

source
CTBase.__displayMethod
__display() -> Bool
-

Used to set the default value of the display argument. The default value is true, which means that the output is printed during resolution.

source
CTBase.__fun_time_dependenceMethod
__fun_time_dependence() -> Type{Autonomous}
-

Used to set the default value of the time dependence of the functions.

The default value is Autonomous, which means that the functions are considered time independent. The other possible time dependence is NonAutonomous, which means that the functions are considered time dependent.

source
CTBase.__fun_variable_dependenceMethod
__fun_variable_dependence() -> Type{Fixed}
-

Used to set the default value of the variable dependence of the functions.

The default value is Fixed, which means that the functions are considered variable independent. The other possible variable dependence is NonFixed, which means that the functions are considered variable dependent.

source
CTBase.__constraint_labelMethod
__constraint_label() -> Symbol
+

Used to set the default value of the label of a constraint. A unique value is given to each constraint using the gensym function and prefixing by :unamed.

source
CTBase.__control_components_namesMethod
__control_components_names(m::Integer, name::String) -> Any
+

Used to set the default value of the names of the controls. The default value is ["u"] for a one dimensional control, and ["u₁", "u₂", ...] for a multi dimensional control.

source
CTBase.__control_nameMethod
__control_name() -> String
+

Used to set the default value of the names of the control. The default value is "u".

source
CTBase.__criterion_typeMethod
__criterion_type() -> Symbol
+

Used to set the default value of the type of criterion. Either :min or :max. The default value is :min. The other possible criterion type is :max.

source
CTBase.__displayMethod
__display() -> Bool
+

Used to set the default value of the display argument. The default value is true, which means that the output is printed during resolution.

source
CTBase.__fun_time_dependenceMethod
__fun_time_dependence() -> Type{Autonomous}
+

Used to set the default value of the time dependence of the functions.

The default value is Autonomous, which means that the functions are considered time independent. The other possible time dependence is NonAutonomous, which means that the functions are considered time dependent.

source
CTBase.__fun_variable_dependenceMethod
__fun_variable_dependence() -> Type{Fixed}
+

Used to set the default value of the variable dependence of the functions.

The default value is Fixed, which means that the functions are considered variable independent. The other possible variable dependence is NonFixed, which means that the functions are considered variable dependent.

source
CTBase.__get_AD_backendMethod
__get_AD_backend(
 
 ) -> ADTypes.AutoForwardDiff{nothing, Nothing}
-

Used to set the default value of Automatic Differentiation backend.

The default value is AutoForwardDiff(), that is the ForwardDiff package is used by default.

source
CTBase.__init_interpolationMethod
__init_interpolation() -> CTBase.var"#13#14"
-

Used to set the default interpolation function used for initialisation. The default value is Interpolations.linear_interpolation, which means that the initial guess is linearly interpolated.

source
CTBase.__mu_strategy_ipoptMethod
__mu_strategy_ipopt() -> String
-

Used to set the default value of the μ strategy of ipopt for the direct method. The default value is adaptive.

source
CTBase.__ocp_time_dependenceMethod
__ocp_time_dependence() -> Type{Autonomous}
-

Used to set the default value of the time dependence of the Optimal Control Problem. The default value is Autonomous, which means that the Optimal Control Problem is considered time independent. The other possible time dependence is NonAutonomous, which means that all the functions used to define the Optimal Control Problem are considered time dependent.

source
CTBase.__ocp_variable_dependenceMethod
__ocp_variable_dependence() -> Type{Fixed}
-

Used to set the default value of the variable dependence of the Optimal Control Problem. The default value is Fixed, which means that the Optimal Control Problem is considered variable independent. The other possible variable dependence is NonFixed, which means that all the functions used to define the Optimal Control Problem are considered variable dependent.

source
CTBase.__print_level_ipoptMethod
__print_level_ipopt() -> Int64
-

Used to set the default value of the print level of ipopt for the direct method. The default value is 5.

source
CTBase.__state_components_namesMethod
__state_components_names(n::Integer, name::String) -> Any
-

Used to set the default value of the names of the states. The default value is ["x"] for a one dimensional state, and ["x₁", "x₂", ...] for a multi dimensional state.

source
CTBase.__state_nameMethod
__state_name() -> String
-

Used to set the default value of the name of the state. The default value is "x".

source
CTBase.__time_nameMethod
__time_name() -> String
-

Used to set the default value of the name of the time. The default value is t.

source
CTBase.__variable_components_namesMethod
__variable_components_names(q::Integer, name::String) -> Any
-

Used to set the default value of the names of the variables. The default value is ["v"] for a one dimensional variable, and ["v₁", "v₂", ...] for a multi dimensional variable.

source
CTBase.__variable_nameMethod
__variable_name() -> String
-

Used to set the default value of the names of the variables. The default value is "v".

source
CTBase.expandMethod
expand(x::Matrix{<:Real}) -> Vector{<:Real}
-

Return expand(matrix2vec(x, 1))

source
CTBase.expandMethod
expand(x::Vector{<:Vector{<:Real}}) -> Vector{<:Real}
-

Equivalent to vec2vec(x)

source
CTBase.expr_itMethod
expr_it(e, _Expr, f) -> Any
-

Expr iterator: apply _Expr to nodes and f to leaves of the AST.

Example

julia> id(e) = expr_it(e, Expr, x -> x)
source
CTBase.hasMethod
has(e, x, t) -> Union{Missing, Bool}
+

Used to set the default value of Automatic Differentiation backend.

The default value is AutoForwardDiff(), that is the ForwardDiff package is used by default.

source
CTBase.__init_interpolationMethod
__init_interpolation() -> CTBase.var"#13#14"
+

Used to set the default interpolation function used for initialisation. The default value is Interpolations.linear_interpolation, which means that the initial guess is linearly interpolated.

source
CTBase.__mu_strategy_ipoptMethod
__mu_strategy_ipopt() -> String
+

Used to set the default value of the μ strategy of ipopt for the direct method. The default value is adaptive.

source
CTBase.__ocp_time_dependenceMethod
__ocp_time_dependence() -> Type{Autonomous}
+

Used to set the default value of the time dependence of the Optimal Control Problem. The default value is Autonomous, which means that the Optimal Control Problem is considered time independent. The other possible time dependence is NonAutonomous, which means that all the functions used to define the Optimal Control Problem are considered time dependent.

source
CTBase.__ocp_variable_dependenceMethod
__ocp_variable_dependence() -> Type{Fixed}
+

Used to set the default value of the variable dependence of the Optimal Control Problem. The default value is Fixed, which means that the Optimal Control Problem is considered variable independent. The other possible variable dependence is NonFixed, which means that all the functions used to define the Optimal Control Problem are considered variable dependent.

source
CTBase.__print_level_ipoptMethod
__print_level_ipopt() -> Int64
+

Used to set the default value of the print level of ipopt for the direct method. The default value is 5.

source
CTBase.__state_components_namesMethod
__state_components_names(n::Integer, name::String) -> Any
+

Used to set the default value of the names of the states. The default value is ["x"] for a one dimensional state, and ["x₁", "x₂", ...] for a multi dimensional state.

source
CTBase.__state_nameMethod
__state_name() -> String
+

Used to set the default value of the name of the state. The default value is "x".

source
CTBase.__time_nameMethod
__time_name() -> String
+

Used to set the default value of the name of the time. The default value is t.

source
CTBase.__variable_components_namesMethod
__variable_components_names(q::Integer, name::String) -> Any
+

Used to set the default value of the names of the variables. The default value is ["v"] for a one dimensional variable, and ["v₁", "v₂", ...] for a multi dimensional variable.

source
CTBase.__variable_nameMethod
__variable_name() -> String
+

Used to set the default value of the names of the variables. The default value is "v".

source
CTBase.expandMethod
expand(x::Matrix{<:Real}) -> Vector{<:Real}
+

Return expand(matrix2vec(x, 1))

source
CTBase.expandMethod
expand(x::Vector{<:Vector{<:Real}}) -> Vector{<:Real}
+

Equivalent to vec2vec(x)

source
CTBase.expr_itMethod
expr_it(e, _Expr, f) -> Any
+

Expr iterator: apply _Expr to nodes and f to leaves of the AST.

Example

julia> id(e) = expr_it(e, Expr, x -> x)
source
CTBase.hasMethod
has(e, x, t) -> Union{Missing, Bool}
 

Return true if e contains a (...x...)(t) call.

Example

julia> e = :( ∫( x[1](t)^2 + 2*u(t) ) → min )
 :(∫((x[1])(t) ^ 2 + 2 * u(t)) → min)
 
@@ -93,7 +93,7 @@
 true
 
 julia> has(e, :u, :t)
-true
source
CTBase.hasMethod
has(e, e1) -> Union{Missing, Bool}
 

Return true if e contains e1.

Example

julia> e = :( ∫( x[1](t)^2 + 2*u(t) ) → min )
 :(∫((x[1])(t) ^ 2 + 2 * u(t)) → min)
 
@@ -125,13 +125,13 @@
 true
 
 julia> !has(:x, :y)
-true
source
CTBase.matrix2vecFunction
matrix2vec(x::Matrix{<:Real}) -> Vector{<:Vector{<:Real}}
 matrix2vec(
     x::Matrix{<:Real},
     dim::Integer
 ) -> Vector{<:Vector{<:Real}}
-

Transforms x to a Vector{<:Vector{<:ctNumber}}.

Note. dim ∈ {1, 2} is the dimension along which the matrix is transformed.

source
CTBase.parse!Method
parse!(p, ocp, e; log) -> Union{Expr, LineNumberNode}
-

Foo

Example

Foo
source
CTBase.subsMethod
subs(e, e1::Union{Real, Symbol}, e2) -> Any
+

Transforms x to a Vector{<:Vector{<:ctNumber}}.

Note. dim ∈ {1, 2} is the dimension along which the matrix is transformed.

source
CTBase.parse!Method
parse!(p, ocp, e; log) -> Union{Expr, LineNumberNode}
+

Foo

Example

Foo
source
CTBase.subsMethod
subs(e, e1::Union{Real, Symbol}, e2) -> Any
 

Substitute expression e1 by expression e2 in expression e.

Examples

julia> e = :( ∫( r(t)^2 + 2u₁(t)) → min )
 :(∫(r(t) ^ 2 + 2 * u₁(t)) → min)
 
@@ -152,9 +152,9 @@
 :((x[1])(0) * (2 * x(tf)) - (x[2])(tf) * (2 * x(0)))
 
 julia> x0 = Symbol(x, 0); subs(e, :( $x[1]($(t0)) ), :( $x0[1] ))
-:(x0[1] * (2 * x(tf)) - (x[2])(tf) * (2 * x(0)))
source
CTBase.vec2vecMethod
vec2vec(
     x::Vector{<:Real},
     n::Integer
 ) -> Vector{<:Vector{<:Real}}
-

Transforms x to a Vector{<:Vector{<:ctNumber}}.

source
CTBase.vec2vecMethod
vec2vec(x::Vector{<:Vector{<:Real}}) -> Vector{<:Real}
-

Transforms x to a Vector{<:ctNumber}.

source
+

Transforms x to a Vector{<:Vector{<:ctNumber}}.

source
CTBase.vec2vecMethod
vec2vec(x::Vector{<:Vector{<:Real}}) -> Vector{<:Real}
+

Transforms x to a Vector{<:ctNumber}.

source
diff --git a/dev/api-diffgeom.html b/dev/api-diffgeom.html index 7f4dbbe0..cd53b885 100644 --- a/dev/api-diffgeom.html +++ b/dev/api-diffgeom.html @@ -1,5 +1,5 @@ -Differential geometry · CTBase.jl

Differential geometry

Index

Documentation

CTBase.:⋅Method
⋅(X::Function, f::Function) -> Function
+Differential geometry · CTBase.jl

Differential geometry

Index

Documentation

CTBase.:⋅Method
⋅(X::Function, f::Function) -> Function
 

Lie derivative of a scalar function along a function. In this case both functions will be considered autonomous and non-variable.

Example

julia> φ = x -> [x[2], -x[1]]
 julia> f = x -> x[1]^2 + x[2]^2
 julia> (φ⋅f)([1, 2])
@@ -7,7 +7,7 @@
 julia> φ = (t, x, v) -> [t + x[2] + v[1], -x[1] + v[2]]
 julia> f = (t, x, v) -> t + x[1]^2 + x[2]^2
 julia> (φ⋅f)(1, [1, 2], [2, 1])
-MethodError
source
CTBase.:⋅Method
⋅(
     X::VectorField{Autonomous, <:VariableDependence},
     f::Function
 ) -> CTBase.var"#97#99"{VectorField{Autonomous, var"#s98"}, <:Function} where var"#s98"<:VariableDependence
@@ -15,7 +15,7 @@
 julia> X = VectorField(φ)
 julia> f = x -> x[1]^2 + x[2]^2
 julia> (X⋅f)([1, 2])
-0
source
CTBase.:⋅Method
⋅(
     X::VectorField{NonAutonomous, <:VariableDependence},
     f::Function
 ) -> CTBase.var"#101#103"{VectorField{NonAutonomous, var"#s98"}, <:Function} where var"#s98"<:VariableDependence
@@ -23,7 +23,7 @@
 julia> X = VectorField(φ, NonAutonomous, NonFixed)
 julia> f = (t, x, v) -> t + x[1]^2 + x[2]^2
 julia> (X⋅f)(1, [1, 2], [2, 1])
-10
source
CTBase.LieMethod
Lie(
     X::Function,
     f::Function,
     dependences::DataType...
@@ -35,7 +35,7 @@
 julia> φ = (t, x, v) -> [t + x[2] + v[1], -x[1] + v[2]]
 julia> f = (t, x, v) -> t + x[1]^2 + x[2]^2
 julia> Lie(φ, f, NonAutonomous, NonFixed)(1, [1, 2], [2, 1])
-10
source
CTBase.LieMethod
Lie(
     X::Function,
     f::Function;
     autonomous,
@@ -48,7 +48,7 @@
 julia> φ = (t, x, v) -> [t + x[2] + v[1], -x[1] + v[2]]
 julia> f = (t, x, v) -> t + x[1]^2 + x[2]^2
 julia> Lie(φ, f, autonomous=false, variable=true)(1, [1, 2], [2, 1])
-10
source
CTBase.LieMethod
Lie(X::VectorField, f::Function) -> Function
 

Lie derivative of a scalar function along a vector field.

Example

julia> φ = x -> [x[2], -x[1]]
 julia> X = VectorField(φ)
 julia> f = x -> x[1]^2 + x[2]^2
@@ -58,7 +58,7 @@
 julia> X = VectorField(φ, NonAutonomous, NonFixed)
 julia> f = (t, x, v) -> t + x[1]^2 + x[2]^2
 julia> Lie(X, f)(1, [1, 2], [2, 1])
-10
source
CTBase.LieMethod
Lie(
     X::VectorField{Autonomous, V<:VariableDependence},
     Y::VectorField{Autonomous, V<:VariableDependence}
 ) -> VectorField
@@ -67,7 +67,7 @@
 julia> X = VectorField(f)
 julia> Y = VectorField(g)
 julia> Lie(X, Y)([1, 2])
-[7, -14]
source
CTBase.LieMethod
Lie(
     X::VectorField{NonAutonomous, V<:VariableDependence},
     Y::VectorField{NonAutonomous, V<:VariableDependence}
 ) -> VectorField{NonAutonomous}
@@ -76,7 +76,7 @@
 julia> X = VectorField(f, NonAutonomous, NonFixed)
 julia> Y = VectorField(g, NonAutonomous, NonFixed)
 julia> Lie(X, Y)(1, [1, 2], 1)
-[-7,12]
source
CTBase.LiftMethod
Lift(
     X::Function,
     dependences::DataType...
 ) -> HamiltonianLift
@@ -85,13 +85,13 @@
 2
 julia> H = Lift((t, x, v) -> 2x + t - v, NonAutonomous, NonFixed)
 julia> H(1, 1, 1, 1)
-2
source
CTBase.LiftMethod
Lift(X::Function; autonomous, variable) -> HamiltonianLift
+2
source
CTBase.LiftMethod
Lift(X::Function; autonomous, variable) -> HamiltonianLift
 

Return the HamiltonianLift of a function. Dependencies are specified with boolean : autonomous and variable.

Example

julia> H = Lift(x -> 2x)
 julia> H(1, 1)
 2
 julia> H = Lift((t, x, v) -> 2x + t - v, autonomous=false, variable=true)
 julia> H(1, 1, 1, 1)
-2
source
CTBase.LiftMethod
Lift(X::VectorField) -> HamiltonianLift
 

Return the HamiltonianLift of a VectorField.

Example

julia> HL = Lift(VectorField(x -> [x[1]^2,x[2]^2], autonomous=true, variable=false))
 julia> HL([1, 0], [0, 1])
 0
@@ -106,7 +106,7 @@
 2
 julia> H = Lift((t, x, v) -> 2x + t - v, NonAutonomous, NonFixed)
 julia> H(1, 1, 1, 1)
-2
source
CTBase.PoissonMethod
Poisson(
     f::Function,
     g::Function,
     dependences::DataType...
@@ -118,7 +118,7 @@
 julia> f = (t, x, p, v) -> t*v[1]*x[2]^2 + 2x[1]^2 + p[1]^2 + v[2]
 julia> g = (t, x, p, v) -> 3x[2]^2 + -x[1]^2 + p[2]^2 + p[1] + t - v[2]
 julia> Poisson(f, g, NonAutonomous, NonFixed)(2, [1, 2], [2, 1], [4, 4])
--76
source
CTBase.PoissonMethod
Poisson(
     f::Function,
     g::Function;
     autonomous,
@@ -131,7 +131,7 @@
 julia> f = (t, x, p, v) -> t*v[1]*x[2]^2 + 2x[1]^2 + p[1]^2 + v[2]
 julia> g = (t, x, p, v) -> 3x[2]^2 + -x[1]^2 + p[2]^2 + p[1] + t - v[2]
 julia> Poisson(f, g, autonomous=false, variable=true)(2, [1, 2], [2, 1], [4, 4])
--76
source
CTBase.PoissonMethod
Poisson(
     f::AbstractHamiltonian{Autonomous, V<:VariableDependence},
     g::AbstractHamiltonian{Autonomous, V<:VariableDependence}
 ) -> HamiltonianLift
@@ -144,7 +144,7 @@
 julia> Poisson(f, G)([1, 2], [2, 1])
 -20
 julia> Poisson(F, g)([1, 2], [2, 1])
--20
source
CTBase.PoissonMethod
Poisson(
     f::AbstractHamiltonian{NonAutonomous, V<:VariableDependence},
     g::AbstractHamiltonian{NonAutonomous, V<:VariableDependence}
 ) -> HamiltonianLift
@@ -155,7 +155,7 @@
 julia> Poisson(F, G)(2, [1, 2], [2, 1], [4, 4])
 -76
 julia> Poisson(f, g, NonAutonomous, NonFixed)(2, [1, 2], [2, 1], [4, 4])
--76
source
CTBase.PoissonMethod
Poisson(
     f::AbstractHamiltonian{T<:TimeDependence, V<:VariableDependence},
     g::Function
 ) -> Hamiltonian
@@ -168,7 +168,7 @@
 julia> g = (t, x, p, v) -> 3x[2]^2 + -x[1]^2 + p[2]^2 + p[1] + t - v[2]
 julia> F = Hamiltonian(f, autonomous=false, variable=true)
 julia> Poisson(F, g)(2, [1, 2], [2, 1], [4, 4])
--76
source
CTBase.PoissonMethod
Poisson(
     f::Function,
     g::AbstractHamiltonian{T<:TimeDependence, V<:VariableDependence}
 ) -> Hamiltonian
@@ -181,7 +181,7 @@
 julia> g = (t, x, p, v) -> 3x[2]^2 + -x[1]^2 + p[2]^2 + p[1] + t - v[2]
 julia> G = Hamiltonian(g, autonomous=false, variable=true)
 julia> Poisson(f, G)(2, [1, 2], [2, 1], [4, 4])
--76
source
CTBase.PoissonMethod
Poisson(
     f::HamiltonianLift{T<:TimeDependence, V<:VariableDependence},
     g::HamiltonianLift{T<:TimeDependence, V<:VariableDependence}
 ) -> HamiltonianLift
@@ -196,9 +196,9 @@
 julia> F = Lift(f, NonAutonomous, NonFixed)
 julia> G = Lift(g, NonAutonomous, NonFixed)
 julia> Poisson(F, G)(2, [1, 2], [2, 1], [4, 4])
-100
source
CTBase.∂ₜMethod
∂ₜ(f) -> CTBase.var"#106#108"
 

Partial derivative wrt time of a function.

Example

julia> ∂ₜ((t,x) -> t*x)(0,8)
-8
source
CTBase.@LieMacro

Macros for Poisson brackets

Example

julia> H0 = (x, p) -> 0.5*(x[1]^2+x[2]^2+p[1]^2)
+8
source
CTBase.@LieMacro

Macros for Poisson brackets

Example

julia> H0 = (x, p) -> 0.5*(x[1]^2+x[2]^2+p[1]^2)
 julia> H1 = (x, p) -> 0.5*(x[1]^2+x[2]^2+p[2]^2)
 julia> @Lie {H0, H1}([1, 2, 3], [1, 0, 7]) autonomous=true variable=false
 #
@@ -212,14 +212,14 @@
 #
 julia> H0 = (t, x, p, v) -> 0.5*(x[1]^2+x[2]^2+p[1]^2+v)
 julia> H1 = (t, x, p, v) -> 0.5*(x[1]^2+x[2]^2+p[2]^2+v)
-julia> @Lie {H0, H1}(1, [1, 2, 3], [1, 0, 7], 2) autonomous=false variable=true
source
CTBase.@LieMacro

Macros for Lie and Poisson brackets

Example

julia> H0 = (t, x, p) -> 0.5*(x[1]^2+x[2]^2+p[1]^2)
+julia> @Lie {H0, H1}(1, [1, 2, 3], [1, 0, 7], 2) autonomous=false variable=true
source
CTBase.@LieMacro

Macros for Lie and Poisson brackets

Example

julia> H0 = (t, x, p) -> 0.5*(x[1]^2+x[2]^2+p[1]^2)
 julia> H1 = (t, x, p) -> 0.5*(x[1]^2+x[2]^2+p[2]^2)
 julia> @Lie {H0, H1}(1, [1, 2, 3], [1, 0, 7]) autonomous=false
 #
 julia> H0 = (x, p, v) -> 0.5*(x[1]^2+x[2]^2+p[1]^2+v)
 julia> H1 = (x, p, v) -> 0.5*(x[1]^2+x[2]^2+p[2]^2+v)
 julia> @Lie {H0, H1}([1, 2, 3], [1, 0, 7], 2) variable=true
-#
source
CTBase.@LieMacro

Macros for Lie and Poisson brackets

Example

julia> F0 = VectorField(x -> [x[1], x[2], (1-x[3])])
+#
source
CTBase.@LieMacro

Macros for Lie and Poisson brackets

Example

julia> F0 = VectorField(x -> [x[1], x[2], (1-x[3])])
 julia> F1 = VectorField(x -> [0, -x[3], x[2]])
 julia> @Lie [F0, F1]([1, 2, 3])
 [0, 5, 4]
@@ -252,4 +252,4 @@
 julia> H0 = Hamiltonian((t, x, p, v) -> 0.5*(x[1]^2+x[2]^2+p[1]^2+v), autonomous=false, variable=true)
 julia> H1 = Hamiltonian((t, x, p, v) -> 0.5*(x[1]^2+x[2]^2+p[2]^2+v), autonomous=false, variable=true)
 julia> @Lie {H0, H1}(1, [1, 2, 3], [1, 0, 7], 2)
-#
source
+#
source
diff --git a/dev/api-exceptions.html b/dev/api-exceptions.html index f5364456..7a277f08 100644 --- a/dev/api-exceptions.html +++ b/dev/api-exceptions.html @@ -1,2 +1,2 @@ -Exceptions · CTBase.jl

Exceptions

Index

Documentation

CTBase.AmbiguousDescriptionType
struct AmbiguousDescription <: CTException

Exception thrown when the description is ambiguous / incorrect.

Fields

  • var::Tuple{Vararg{Symbol}}
source
CTBase.NotImplementedType
struct NotImplemented <: CTException

Exception thrown when a method is not implemented.

Fields

  • var::String
source
CTBase.ParsingErrorType
struct ParsingError <: CTException

Exception thrown for syntax error during abstract parsing.

Fields

  • var::String
source
CTBase.UnauthorizedCallType
struct UnauthorizedCall <: CTException

Exception thrown when a call to a function is not authorized.

Fields

  • var::String
source
+Exceptions · CTBase.jl

Exceptions

Index

Documentation

CTBase.AmbiguousDescriptionType
struct AmbiguousDescription <: CTException

Exception thrown when the description is ambiguous / incorrect.

Fields

  • var::Tuple{Vararg{Symbol}}
source
CTBase.NotImplementedType
struct NotImplemented <: CTException

Exception thrown when a method is not implemented.

Fields

  • var::String
source
CTBase.ParsingErrorType
struct ParsingError <: CTException

Exception thrown for syntax error during abstract parsing.

Fields

  • var::String
source
CTBase.UnauthorizedCallType
struct UnauthorizedCall <: CTException

Exception thrown when a call to a function is not authorized.

Fields

  • var::String
source
diff --git a/dev/api-init.html b/dev/api-init.html index e188924f..4abbd4dd 100644 --- a/dev/api-init.html +++ b/dev/api-init.html @@ -3,4 +3,4 @@ julia> init = OptimalControlInit(x_init=[0.1, 0.2], u_init=0.3) julia> init = OptimalControlInit(x_init=[0.1, 0.2], u_init=0.3, v_init=0.5) julia> init = OptimalControlInit(x_init=[0.1, 0.2], u_init=t->sin(t), v_init=0.5) -julia> init = OptimalControlInit(sol)source +julia> init = OptimalControlInit(sol)source diff --git a/dev/api-model.html b/dev/api-model.html index 920d8b79..70c6f5d0 100644 --- a/dev/api-model.html +++ b/dev/api-model.html @@ -4,14 +4,14 @@ ) -> OptimalControlModel{Autonomous, Fixed}

Return a new OptimalControlModel instance, that is a model of an optimal control problem.

The model is defined by the following argument:

Examples

julia> ocp = Model()
 julia> ocp = Model(NonAutonomous)
-julia> ocp = Model(Autonomous, NonFixed)
Note
  • If the time dependence of the model is defined as nonautonomous, then, the dynamics function, the lagrange cost and the path constraints must be defined as functions of time and state, and possibly control. If the model is defined as autonomous, then, the dynamics function, the lagrange cost and the path constraints must be defined as functions of state, and possibly control.
source
CTBase.ModelMethod
Model(
+julia> ocp = Model(Autonomous, NonFixed)
Note
  • If the time dependence of the model is defined as nonautonomous, then, the dynamics function, the lagrange cost and the path constraints must be defined as functions of time and state, and possibly control. If the model is defined as autonomous, then, the dynamics function, the lagrange cost and the path constraints must be defined as functions of state, and possibly control.
source
CTBase.ModelMethod
Model(
 ;
     autonomous,
     variable
 ) -> OptimalControlModel{Autonomous, Fixed}
 

Return a new OptimalControlModel instance, that is a model of an optimal control problem.

The model is defined by the following optional keyword argument:

  • autonomous: either true or false. Default is true.
  • variable: either true or false. Default is false.

Examples

julia> ocp = Model()
 julia> ocp = Model(autonomous=false)
-julia> ocp = Model(autonomous=false, variable=true)
Note
  • If the time dependence of the model is defined as nonautonomous, then, the dynamics function, the lagrange cost and the path constraints must be defined as functions of time and state, and possibly control. If the model is defined as autonomous, then, the dynamics function, the lagrange cost and the path constraints must be defined as functions of state, and possibly control.
source
CTBase.constraint!Method
constraint!(
+julia> ocp = Model(autonomous=false, variable=true)
Note
  • If the time dependence of the model is defined as nonautonomous, then, the dynamics function, the lagrange cost and the path constraints must be defined as functions of time and state, and possibly control. If the model is defined as autonomous, then, the dynamics function, the lagrange cost and the path constraints must be defined as functions of state, and possibly control.
source
CTBase.constraint!Method
constraint!(
     ocp::OptimalControlModel{T<:TimeDependence, V<:VariableDependence},
     type::Symbol;
     rg,
@@ -55,17 +55,17 @@
 # time dependent and variable dependent ocp
 julia> constraint!(ocp, :control; f = (t, u, v) -> 2u+v[2], lb=0, ub=1)
 julia> constraint!(ocp, :state; f = (t, x, v) -> x-t*v[1], lb=[ 0, 0, 0 ], ub=[ 1, 2, 1 ])
-julia> constraint!(ocp, :mixed; f = (t, x, u, v) -> x[1]*v[2]-u, lb=0, ub=1)
source
CTBase.constraintMethod
constraint(
+julia> constraint!(ocp, :mixed; f = (t, x, u, v) -> x[1]*v[2]-u, lb=0, ub=1)
source
CTBase.constraintMethod
constraint(
     ocp::OptimalControlModel{T<:TimeDependence, V<:VariableDependence},
     label::Symbol
 ) -> Any
 

Retrieve a labeled constraint. The result is a function associated with the constraint computation (not taking into account provided value / bounds).

Example

julia> constraint!(ocp, :initial, 0, :c0)
 julia> c = constraint(ocp, :c0)
 julia> c(1)
-1
source
CTBase.constraints_labelsMethod
constraints_labels(
+1
source
CTBase.constraints_labelsMethod
constraints_labels(
     ocp::OptimalControlModel
 ) -> Base.KeySet{Symbol, Dict{Symbol, Tuple}}
-

Return the labels of the constraints as a Base.keys.

Example

julia> constraints_labels(ocp)
source
CTBase.control!Function
control!(ocp::OptimalControlModel, m::Integer)
+

Return the labels of the constraints as a Base.keys.

Example

julia> constraints_labels(ocp)
source
CTBase.control!Function
control!(ocp::OptimalControlModel, m::Integer)
 control!(ocp::OptimalControlModel, m::Integer, name::String)
 control!(
     ocp::OptimalControlModel,
@@ -101,54 +101,54 @@
 julia> ocp.control_dimension
 2
 julia> ocp.control_components_names
-["v₁", "v₂"]
source
CTBase.dim_boundary_constraintsMethod
dim_boundary_constraints(
+["v₁", "v₂"]
source
CTBase.dim_boundary_constraintsMethod
dim_boundary_constraints(
     ocp::OptimalControlModel
 ) -> Union{Nothing, Integer}
-

Return the dimension of the boundary constraints (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_control_constraintsMethod
dim_control_constraints(
+

Return the dimension of the boundary constraints (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_control_constraintsMethod
dim_control_constraints(
     ocp::OptimalControlModel
 ) -> Union{Nothing, Integer}
-

Return the dimension of nonlinear control constraints (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_control_rangeMethod
dim_control_range(
+

Return the dimension of nonlinear control constraints (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_control_rangeMethod
dim_control_range(
     ocp::OptimalControlModel
 ) -> Union{Nothing, Integer}
-

Return the dimension of range constraints on control (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_mixed_constraintsMethod
dim_mixed_constraints(
+

Return the dimension of range constraints on control (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_mixed_constraintsMethod
dim_mixed_constraints(
     ocp::OptimalControlModel
 ) -> Union{Nothing, Integer}
-

Return the dimension of nonlinear mixed constraints (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_path_constraintsMethod
dim_path_constraints(ocp::OptimalControlModel) -> Any
-

Return the dimension of nonlinear path (state + control + mixed) constraints (nothing if one of them is not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_state_constraintsMethod
dim_state_constraints(
+

Return the dimension of nonlinear mixed constraints (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_path_constraintsMethod
dim_path_constraints(ocp::OptimalControlModel) -> Any
+

Return the dimension of nonlinear path (state + control + mixed) constraints (nothing if one of them is not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_state_constraintsMethod
dim_state_constraints(
     ocp::OptimalControlModel
 ) -> Union{Nothing, Integer}
-

Return the dimension of nonlinear state constraints (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_state_rangeMethod
dim_state_range(
+

Return the dimension of nonlinear state constraints (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_state_rangeMethod
dim_state_range(
     ocp::OptimalControlModel
 ) -> Union{Nothing, Integer}
-

Return the dimension of range constraints on state (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_variable_constraintsMethod
dim_variable_constraints(
+

Return the dimension of range constraints on state (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_variable_constraintsMethod
dim_variable_constraints(
     ocp::OptimalControlModel
 ) -> Union{Nothing, Integer}
-

Return the dimension of nonlinear variable constraints (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_variable_rangeMethod
dim_variable_range(
+

Return the dimension of nonlinear variable constraints (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dim_variable_rangeMethod
dim_variable_range(
     ocp::OptimalControlModel
 ) -> Union{Nothing, Integer}
-

Return the dimension of range constraints on variable (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dynamics!Method
dynamics!(
+

Return the dimension of range constraints on variable (nothing if not knonw). Information is updated after nlp_constraints! is called.

source
CTBase.dynamics!Method
dynamics!(
     ocp::OptimalControlModel{T<:TimeDependence, V<:VariableDependence},
     f::Function
 )
-

Set the dynamics.

Note

You can use dynamics! only once to define the dynamics.

  • The state, control and variable dimensions must be set before. Use state!, control! and variable!.
  • The times must be set before. Use time!.
  • When an element is of dimension 1, consider it as a scalar.

Example

julia> dynamics!(ocp, f)
source
CTBase.has_free_final_timeMethod
has_free_final_time(ocp::OptimalControlModel) -> Bool
-

Return true if the model has been defined with free final time.

source
CTBase.has_free_initial_timeMethod
has_free_initial_time(ocp::OptimalControlModel) -> Bool
-

Return true if the model has been defined with free initial time.

source
CTBase.has_lagrange_costMethod
has_lagrange_cost(ocp::OptimalControlModel) -> Bool
-

Return true if the model has been defined with lagrange cost.

source
CTBase.has_mayer_costMethod
has_mayer_cost(ocp::OptimalControlModel) -> Bool
-

Return true if the model has been defined with mayer cost.

source
CTBase.is_autonomousMethod
is_autonomous(ocp::OptimalControlModel{Autonomous}) -> Bool
-

Return true if the model is autonomous.

source
CTBase.is_fixedMethod
is_fixed(
+

Set the dynamics.

Note

You can use dynamics! only once to define the dynamics.

  • The state, control and variable dimensions must be set before. Use state!, control! and variable!.
  • The times must be set before. Use time!.
  • When an element is of dimension 1, consider it as a scalar.

Example

julia> dynamics!(ocp, f)
source
CTBase.has_free_final_timeMethod
has_free_final_time(ocp::OptimalControlModel) -> Bool
+

Return true if the model has been defined with free final time.

source
CTBase.has_free_initial_timeMethod
has_free_initial_time(ocp::OptimalControlModel) -> Bool
+

Return true if the model has been defined with free initial time.

source
CTBase.has_lagrange_costMethod
has_lagrange_cost(ocp::OptimalControlModel) -> Bool
+

Return true if the model has been defined with lagrange cost.

source
CTBase.has_mayer_costMethod
has_mayer_cost(ocp::OptimalControlModel) -> Bool
+

Return true if the model has been defined with mayer cost.

source
CTBase.is_autonomousMethod
is_autonomous(ocp::OptimalControlModel{Autonomous}) -> Bool
+

Return true if the model is autonomous.

source
CTBase.is_fixedMethod
is_fixed(
     ocp::OptimalControlModel{<:TimeDependence, Fixed}
 ) -> Bool
-

Return true if the model is fixed (= has no variable).

source
CTBase.is_maxMethod
is_max(ocp::OptimalControlModel) -> Bool
-

Return true if the criterion type of ocp is :max.

source
CTBase.is_minMethod
is_min(ocp::OptimalControlModel) -> Bool
-

Return true if the criterion type of ocp is :min.

source
CTBase.is_time_dependentMethod
is_time_dependent(ocp::OptimalControlModel) -> Bool
-

Return true if the model has been defined as time dependent.

source
CTBase.is_time_independentMethod
is_time_independent(ocp::OptimalControlModel) -> Bool
-

Return true if the model has been defined as time independent.

source
CTBase.is_variable_dependentMethod
is_variable_dependent(ocp::OptimalControlModel) -> Bool
-

Return true if the model has been defined as variable dependent.

source
CTBase.is_variable_independentMethod
is_variable_independent(ocp::OptimalControlModel) -> Bool
-

Return true if the model has been defined as variable independent.

source
CTBase.nlp_constraints!Method
nlp_constraints!(
+

Return true if the model is fixed (= has no variable).

source
CTBase.is_maxMethod
is_max(ocp::OptimalControlModel) -> Bool
+

Return true if the criterion type of ocp is :max.

source
CTBase.is_minMethod
is_min(ocp::OptimalControlModel) -> Bool
+

Return true if the criterion type of ocp is :min.

source
CTBase.is_time_dependentMethod
is_time_dependent(ocp::OptimalControlModel) -> Bool
+

Return true if the model has been defined as time dependent.

source
CTBase.is_time_independentMethod
is_time_independent(ocp::OptimalControlModel) -> Bool
+

Return true if the model has been defined as time independent.

source
CTBase.is_variable_dependentMethod
is_variable_dependent(ocp::OptimalControlModel) -> Bool
+

Return true if the model has been defined as variable dependent.

source
CTBase.is_variable_independentMethod
is_variable_independent(ocp::OptimalControlModel) -> Bool
+

Return true if the model has been defined as variable independent.

source
CTBase.nlp_constraints!Method
nlp_constraints!(
     ocp::OptimalControlModel
 ) -> Tuple{Tuple{Any, CTBase.var"#ξ#91", Vector{Real}}, Tuple{Any, CTBase.var"#η#92", Vector{Real}}, Tuple{Any, CTBase.var"#ψ#93", Vector{Real}}, Tuple{Any, CTBase.var"#ϕ#94", Vector{Real}}, Tuple{Any, CTBase.var"#θ#95", Vector{Real}}, Tuple{Vector{Real}, Vector{Int64}, Vector{Real}}, Tuple{Vector{Real}, Vector{Int64}, Vector{Real}}, Tuple{Vector{Real}, Vector{Int64}, Vector{Real}}}
 

Return a 6-tuple of tuples:

  • (ξl, ξ, ξu) are control constraints
  • (ηl, η, ηu) are state constraints
  • (ψl, ψ, ψu) are mixed constraints
  • (ϕl, ϕ, ϕu) are boundary constraints
  • (θl, θ, θu) are variable constraints
  • (ul, uind, uu) are control linear constraints of a subset of indices
  • (xl, xind, xu) are state linear constraints of a subset of indices
  • (vl, vind, vu) are variable linear constraints of a subset of indices

and update information about constraints dimensions of ocp.

Note
  • The dimensions of the state and control must be set before calling nlp_constraints!.
  • For a Fixed problem, dimensions associated with constraints on the variable are set to zero.

Example

julia> (ξl, ξ, ξu), (ηl, η, ηu), (ψl, ψ, ψu), (ϕl, ϕ, ϕu), (θl, θ, θu),
-    (ul, uind, uu), (xl, xind, xu), (vl, vind, vu) = nlp_constraints!(ocp)
source
CTBase.objective!Method
objective!(
+    (ul, uind, uu), (xl, xind, xu), (vl, vind, vu) = nlp_constraints!(ocp)
source
CTBase.objective!Method
objective!(
     ocp::OptimalControlModel{T<:TimeDependence, V<:VariableDependence},
     type::Symbol,
     g::Function,
@@ -161,7 +161,7 @@
     f⁰::Function,
     criterion::Symbol
 )
-

Set the criterion to the function g and f⁰. Type can be :bolza. Criterion is :min or :max.

Note

You can use objective! only once to define the objective.

  • The state, control and variable dimensions must be set before. Use state!, control! and variable!.
  • The times must be set before. Use time!.
  • When an element is of dimension 1, consider it as a scalar.

Example

julia> objective!(ocp, :bolza, (x0, xf) -> x0[1] + xf[2], (x, u) -> x[1]^2 + u^2) # the control is of dimension 1
source
CTBase.objective!Method
objective!(
+

Set the criterion to the function g and f⁰. Type can be :bolza. Criterion is :min or :max.

Note

You can use objective! only once to define the objective.

  • The state, control and variable dimensions must be set before. Use state!, control! and variable!.
  • The times must be set before. Use time!.
  • When an element is of dimension 1, consider it as a scalar.

Example

julia> objective!(ocp, :bolza, (x0, xf) -> x0[1] + xf[2], (x, u) -> x[1]^2 + u^2) # the control is of dimension 1
source
CTBase.objective!Method
objective!(
     ocp::OptimalControlModel{T<:TimeDependence, V<:VariableDependence},
     type::Symbol,
     f::Function
@@ -173,8 +173,8 @@
     criterion::Symbol
 )
 

Set the criterion to the function f. Type can be :mayer or :lagrange. Criterion is :min or :max.

Note

You can use objective! only once to define the objective.

  • The state, control and variable dimensions must be set before. Use state!, control! and variable!.
  • The times must be set before. Use time!.
  • When an element is of dimension 1, consider it as a scalar.

Examples

julia> objective!(ocp, :mayer, (x0, xf) -> x0[1] + xf[2])
-julia> objective!(ocp, :lagrange, (x, u) -> x[1]^2 + u^2) # the control is of dimension 1
Warning

If you set twice the objective, only the last one will be taken into account.

source
CTBase.remove_constraint!Method
remove_constraint!(ocp::OptimalControlModel, label::Symbol)
-

Remove a labeled constraint.

Example

julia> remove_constraint!(ocp, :con)
source
CTBase.state!Function
state!(ocp::OptimalControlModel, n::Integer)
+julia> objective!(ocp, :lagrange, (x, u) -> x[1]^2 + u^2) # the control is of dimension 1
Warning

If you set twice the objective, only the last one will be taken into account.

source
CTBase.remove_constraint!Method
remove_constraint!(ocp::OptimalControlModel, label::Symbol)
+

Remove a labeled constraint.

Example

julia> remove_constraint!(ocp, :con)
source
CTBase.state!Function
state!(ocp::OptimalControlModel, n::Integer)
 state!(ocp::OptimalControlModel, n::Integer, name::String)
 state!(
     ocp::OptimalControlModel,
@@ -210,7 +210,7 @@
 julia> ocp.state_dimension
 2
 julia> ocp.state_components_names
-["y₁", "y₂"]
source
CTBase.time!Method
time!(
+["y₁", "y₂"]
source
CTBase.time!Method
time!(
     ocp::OptimalControlModel{<:TimeDependence, VT};
     t0,
     tf,
@@ -223,7 +223,7 @@
 julia> time!(ocp, ind0=2, tf=1  ) # Free  t0 and fixed tf
 julia> time!(ocp, ind0=2, indf=3) # Free  t0 and free  tf

When you plot a solution of an optimal control problem, the name of the time variable appears. By default, the name is "t". Consider you want to set the name of the time variable to "s".

julia> time!(ocp, t0=0, tf=1, name="s") # name is a String
 # or
-julia> time!(ocp, t0=0, tf=1, name=:s ) # name is a Symbol  
source
CTBase.variable!Function
variable!(ocp::OptimalControlModel, q::Integer)
+julia> time!(ocp, t0=0, tf=1, name=:s ) # name is a Symbol  
source
CTBase.variable!Function
variable!(ocp::OptimalControlModel, q::Integer)
 variable!(
     ocp::OptimalControlModel,
     q::Integer,
@@ -236,4 +236,4 @@
     components_names::Vector{String}
 )
 

Define the variable dimension and possibly the names of each component.

Note

You can use variable! once to set the variable dimension when the model is NonFixed.

Examples

julia> variable!(ocp, 1, "v")
-julia> variable!(ocp, 2, "v", [ "v₁", "v₂" ])
source
+julia> variable!(ocp, 2, "v", [ "v₁", "v₂" ])source diff --git a/dev/api-parser.html b/dev/api-parser.html index ebe78c12..b4cd1f85 100644 --- a/dev/api-parser.html +++ b/dev/api-parser.html @@ -112,7 +112,7 @@ julia> constraint_type(:( v^2 + 1 ), t, t0, tf, x, u, v) :variable_fun julia> constraint_type(:( v[2]^2 + 1 ), t, t0, tf, x, u, v) -:variable_funsource
CTBase.replace_callMethod
replace_call(e, x::Symbol, t, y) -> Any
+:variable_fun
source
CTBase.replace_callMethod
replace_call(e, x::Symbol, t, y) -> Any
 

Replace calls in e of the form (...x...)(t) by (...y...).

Example


 julia> t = :t; t0 = 0; tf = :tf; x = :x; u = :u;
 
@@ -132,7 +132,7 @@
 :(F0(x) + u * F1(x))
 
 julia> e = :( 0.5u(t)^2 ); replace_call(e, u, t, u)
-:(0.5 * u ^ 2)
source
CTBase.replace_callMethod
replace_call(e, x::Vector{Symbol}, t, y) -> Any
+:(0.5 * u ^ 2)
source
CTBase.replace_callMethod
replace_call(e, x::Vector{Symbol}, t, y) -> Any
 

Replace calls in e of the form (...x1...x2...)(t) by (...y1...y2...) for all symbols x1, x2... in the vector x.

Example


 julia> t = :t; t0 = 0; tf = :tf; x = :x; u = :u;
 
@@ -143,7 +143,7 @@
 :(xx ^ 2 + uu[1])
 
 julia> e = :( ((x^2)(t0) + u[1])(t) ); replace_call(e, [ x, u ], t , [ :xx, :uu ])
-:((xx ^ 2)(t0) + uu[1])
source
CTBase.@defMacro

Define an optimal control problem. One pass parsing of the definition.

Example

@def ocp begin
+:((xx ^ 2)(t0) + uu[1])
source
CTBase.@defMacro

Define an optimal control problem. One pass parsing of the definition.

Example

@def ocp begin
     tf ∈ R, variable
     t ∈ [ 0, tf ], time
     x ∈ R², state
@@ -160,5 +160,5 @@
     -2 ≤ v(t) ≤ 3,      (2)
     ẋ(t) == [ v(t), u(t) ]
     tf → min
-end
source
CTBase.__OCPModelMethod
__OCPModel(args...; kwargs...) -> OptimalControlModel
-

Redirection to Model to avoid confusion with other functions Model from other packages if imported. This function is used by @def.

source
+endsource
CTBase.__OCPModelMethod
__OCPModel(args...; kwargs...) -> OptimalControlModel
+

Redirection to Model to avoid confusion with other functions Model from other packages if imported. This function is used by @def.

source
diff --git a/dev/api-plot.html b/dev/api-plot.html index 98c83cf0..92f76f4c 100644 --- a/dev/api-plot.html +++ b/dev/api-plot.html @@ -1,2 +1,2 @@ -Plot · CTBase.jl
+Plot · CTBase.jl
diff --git a/dev/api-print.html b/dev/api-print.html index b2cdf91d..e4eda779 100644 --- a/dev/api-print.html +++ b/dev/api-print.html @@ -82,4 +82,4 @@ ├────────┼────────┼──────────┼──────────┼───────────┼────────────┼─────────────┤ │ V │ V │ V │ X │ V │ V │ V │ ╰────────┴────────┴──────────┴──────────┴───────────┴────────────┴─────────────╯ - + diff --git a/dev/api-repl.html b/dev/api-repl.html index f9fc8e56..d90a2ff7 100644 --- a/dev/api-repl.html +++ b/dev/api-repl.html @@ -1,4 +1,4 @@ Repl · CTBase.jl
+

Create a ct REPL.

source
CTBase.ct_repl_update_modelMethod
ct_repl_update_model(e::Expr)
+

Update the model adding the expression e. It must be public since in the ct repl, this function is quoted each time an expression is parsed and is valid.

source
diff --git a/dev/api-types.html b/dev/api-types.html index 13d67198..9bef5157 100644 --- a/dev/api-types.html +++ b/dev/api-types.html @@ -1,5 +1,5 @@ -Types and functions · CTBase.jl

Types and functions

Index

Documentation

CTBase.BoundaryConstraintType
struct BoundaryConstraint{variable_dependence}

Fields

  • f::Function

The default value for variable_dependence is Fixed.

Constructor

The constructor BoundaryConstraint returns a BoundaryConstraint of a function. The function must take 2 or 3 arguments (x0, xf) or (x0, xf, v), if the function is variable, it must be specified. Dependencies are specified with a boolean, variable, false by default or with a DataType, NonFixed/Fixed, Fixed by default.

Examples

julia> B = BoundaryConstraint((x0, xf) -> [xf[2]-x0[1], 2xf[1]+x0[2]^2])
+Types and functions · CTBase.jl

Types and functions

Index

Documentation

CTBase.BoundaryConstraintType
struct BoundaryConstraint{variable_dependence}

Fields

  • f::Function

The default value for variable_dependence is Fixed.

Constructor

The constructor BoundaryConstraint returns a BoundaryConstraint of a function. The function must take 2 or 3 arguments (x0, xf) or (x0, xf, v), if the function is variable, it must be specified. Dependencies are specified with a boolean, variable, false by default or with a DataType, NonFixed/Fixed, Fixed by default.

Examples

julia> B = BoundaryConstraint((x0, xf) -> [xf[2]-x0[1], 2xf[1]+x0[2]^2])
 julia> B = BoundaryConstraint((x0, xf, v) -> [v[3]+xf[2]-x0[1], v[1]-v[2]+2xf[1]+x0[2]^2], variable=true)
 julia> B = BoundaryConstraint((x0, xf, v) -> [v[3]+xf[2]-x0[1], v[1]-v[2]+2xf[1]+x0[2]^2], NonFixed)
Warning

When the state is of dimension 1, consider x0 and xf as a scalar. When the constraint is dimension 1, return a scalar.

Call

The call returns the evaluation of the BoundaryConstraint for given values. If a variable is given for a non variable dependent boundary constraint, it will be ignored.

Examples

julia> B = BoundaryConstraint((x0, xf) -> [xf[2]-x0[1], 2xf[1]+x0[2]^2])
 julia> B([0, 0], [1, 1])
@@ -9,7 +9,7 @@
 [1, 2]
 julia> B = BoundaryConstraint((x0, xf, v) -> [v[3]+xf[2]-x0[1], v[1]-v[2]+2xf[1]+x0[2]^2], variable=true)
 julia> B([0, 0], [1, 1], [1, 2, 3])
-[4, 1]
source
CTBase.ControlConstraintType
struct ControlConstraint{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to VectorField in the usage, but the dimension of the output of the function f is arbitrary.

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor ControlConstraint returns a ControlConstraint of a function. The function must take 1 to 3 arguments, u to (t, u, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> IncorrectArgument ControlConstraint(u -> [u[1]^2, 2u[2]], Int64)
+[4, 1]
source
CTBase.ControlConstraintType
struct ControlConstraint{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to VectorField in the usage, but the dimension of the output of the function f is arbitrary.

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor ControlConstraint returns a ControlConstraint of a function. The function must take 1 to 3 arguments, u to (t, u, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> IncorrectArgument ControlConstraint(u -> [u[1]^2, 2u[2]], Int64)
 julia> IncorrectArgument ControlConstraint(u -> [u[1]^2, 2u[2]], Int64)
 julia> C = ControlConstraint(u -> [u[1]^2, 2u[2]], Autonomous, Fixed)
 julia> C = ControlConstraint((u, v) -> [u[1]^2, 2u[2]+v[3]], Autonomous, NonFixed)
@@ -37,7 +37,7 @@
 [2, -2]
 julia> C = ControlConstraint((t, u, v) -> [t+u[1]^2, 2u[2]+v[3]], autonomous=false, variable=true)
 julia> C(1, [1, -1], [1, 2, 3])
-[2, 1]
source
CTBase.ControlLawType
struct ControlLaw{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to Hamiltonian in the usage, but the dimension of the output of the function f is arbitrary.

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor ControlLaw returns a ControlLaw of a function. The function must take 2 to 4 arguments, (x, p) to (t, x, p, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> ControlLaw((x, p) -> x[1]^2+2p[2], Int64)
+[2, 1]
source
CTBase.ControlLawType
struct ControlLaw{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to Hamiltonian in the usage, but the dimension of the output of the function f is arbitrary.

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor ControlLaw returns a ControlLaw of a function. The function must take 2 to 4 arguments, (x, p) to (t, x, p, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> ControlLaw((x, p) -> x[1]^2+2p[2], Int64)
 IncorrectArgument
 julia> ControlLaw((x, p) -> x[1]^2+2p[2], Int64)
 IncorrectArgument
@@ -71,7 +71,7 @@
 4
 julia> u = ControlLaw((t, x, p, v) -> t+x[1]^2+2p[2]+v[3], autonomous=false, variable=true)
 julia> u(1, [1, 0], [0, 1], [1, 2, 3])
-7
source
CTBase.DynamicsType
struct Dynamics{time_dependence, variable_dependence}

Fields

  • f::Function

The default value for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor Dynamics returns a Dynamics of a function. The function must take 2 to 4 arguments, (x, u) to (t, x, u, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> Dynamics((x, u) -> [2x[2]-u^2, x[1]], Int64)
+7
source
CTBase.DynamicsType
struct Dynamics{time_dependence, variable_dependence}

Fields

  • f::Function

The default value for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor Dynamics returns a Dynamics of a function. The function must take 2 to 4 arguments, (x, u) to (t, x, u, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> Dynamics((x, u) -> [2x[2]-u^2, x[1]], Int64)
 IncorrectArgument
 julia> Dynamics((x, u) -> [2x[2]-u^2, x[1]], Int64)
 IncorrectArgument
@@ -101,7 +101,7 @@
 [0, 1]
 julia> D = Dynamics((t, x, u, v) -> [t+2x[2]-u^2+v[3], x[1]], autonomous=false, variable=true)
 julia> D(1, [1, 0], 1, [1, 2, 3])
-[3, 1]
source
CTBase.FeedbackControlType
struct FeedbackControl{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to VectorField in the usage, but the dimension of the output of the function f is arbitrary.

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor FeedbackControl returns a FeedbackControl of a function. The function must take 1 to 3 arguments, x to (t, x, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> FeedbackControl(x -> x[1]^2+2x[2], Int64)
+[3, 1]
source
CTBase.FeedbackControlType
struct FeedbackControl{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to VectorField in the usage, but the dimension of the output of the function f is arbitrary.

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor FeedbackControl returns a FeedbackControl of a function. The function must take 1 to 3 arguments, x to (t, x, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> FeedbackControl(x -> x[1]^2+2x[2], Int64)
 IncorrectArgument
 julia> FeedbackControl(x -> x[1]^2+2x[2], Int64)
 IncorrectArgument
@@ -135,7 +135,7 @@
 2
 julia> u = FeedbackControl((t, x, v) -> t+x[1]^2+2x[2]+v[3], autonomous=false, variable=true)
 julia> u(1, [1, 0], [1, 2, 3])
-5
source
CTBase.HamiltonianType
struct Hamiltonian{time_dependence, variable_dependence} <: AbstractHamiltonian{time_dependence, variable_dependence}

Fields

  • f::Function

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor Hamiltonian returns a Hamiltonian of a function. The function must take 2 to 4 arguments, (x, p) to (t, x, p, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> Hamiltonian((x, p) -> x + p, Int64)
+5
source
CTBase.HamiltonianType
struct Hamiltonian{time_dependence, variable_dependence} <: AbstractHamiltonian{time_dependence, variable_dependence}

Fields

  • f::Function

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor Hamiltonian returns a Hamiltonian of a function. The function must take 2 to 4 arguments, (x, p) to (t, x, p, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> Hamiltonian((x, p) -> x + p, Int64)
 IncorrectArgument 
 julia> Hamiltonian((x, p) -> x + p, Int64)
 IncorrectArgument
@@ -167,7 +167,7 @@
 4
 julia> H = Hamiltonian((t, x, p, v) -> t+x[1]^2+2p[2]+v[3], autonomous=false, variable=true)
 julia> H(1, [1, 0], [0, 1], [1, 2, 3])
-7
source
CTBase.HamiltonianLiftType
struct HamiltonianLift{time_dependence, variable_dependence} <: AbstractHamiltonian{time_dependence, variable_dependence}

Lifts

  • X::VectorField

The values for time_dependence and variable_dependence are deternimed by the values of those for the VectorField.

Constructor

The constructor HamiltonianLift returns a HamiltonianLift of a VectorField.

Examples

julia> H = HamiltonianLift(VectorField(x -> [x[1]^2, 2x[2]]))
+7
source
CTBase.HamiltonianLiftType
struct HamiltonianLift{time_dependence, variable_dependence} <: AbstractHamiltonian{time_dependence, variable_dependence}

Lifts

  • X::VectorField

The values for time_dependence and variable_dependence are deternimed by the values of those for the VectorField.

Constructor

The constructor HamiltonianLift returns a HamiltonianLift of a VectorField.

Examples

julia> H = HamiltonianLift(VectorField(x -> [x[1]^2, 2x[2]]))
 julia> H = HamiltonianLift(VectorField((x, v) -> [x[1]^2, 2x[2]+v[3]], variable=true))
 julia> H = HamiltonianLift(VectorField((t, x) -> [t+x[1]^2, 2x[2]], autonomous=false))
 julia> H = HamiltonianLift(VectorField((t, x, v) -> [t+x[1]^2, 2x[2]+v[3]], autonomous=false, variable=true))
@@ -200,7 +200,7 @@
 3

Alternatively, it is possible to construct the HamiltonianLift from a Function being the VectorField.

julia> HL1 = HamiltonianLift((x, v) -> [x[1]^2,x[2]^2+v], autonomous=true, variable=true)
 julia> HL2 = HamiltonianLift(VectorField((x, v) -> [x[1]^2,x[2]^2+v], autonomous=true, variable=true))
 julia> HL1([1, 0], [0, 1], 1) == HL2([1, 0], [0, 1], 1)
-true
source
CTBase.HamiltonianVectorFieldType
struct HamiltonianVectorField{time_dependence, variable_dependence} <: CTBase.AbstractVectorField{time_dependence, variable_dependence}

Fields

  • f::Function

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor HamiltonianVectorField returns a HamiltonianVectorField of a function. The function must take 2 to 4 arguments, (x, p) to (t, x, p, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> HamiltonianVectorField((x, p) -> [x[1]^2+2p[2], x[2]-3p[2]^2], Int64)
+true
source
CTBase.HamiltonianVectorFieldType
struct HamiltonianVectorField{time_dependence, variable_dependence} <: CTBase.AbstractVectorField{time_dependence, variable_dependence}

Fields

  • f::Function

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor HamiltonianVectorField returns a HamiltonianVectorField of a function. The function must take 2 to 4 arguments, (x, p) to (t, x, p, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> HamiltonianVectorField((x, p) -> [x[1]^2+2p[2], x[2]-3p[2]^2], Int64)
 IncorrectArgument
 julia> HamiltonianVectorField((x, p) -> [x[1]^2+2p[2], x[2]-3p[2]^2], Int64)
 IncorrectArgument
@@ -233,7 +233,7 @@
 [4, -3]
 julia> Hv = HamiltonianVectorField((t, x, p, v) -> [t+x[1]^2+2p[2]+v[3], x[2]-3p[2]^2+v[4]], autonomous=false, variable=true)
 julia> Hv(1, [1, 0], [0, 1], [1, 2, 3, 4])
-[7, -3]
source
CTBase.LagrangeType
struct Lagrange{time_dependence, variable_dependence}

Fields

  • f::Function

The default value for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor Lagrange returns a Lagrange cost of a function. The function must take 2 to 4 arguments, (x, u) to (t, x, u, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> Lagrange((x, u) -> 2x[2]-u[1]^2, Int64)
+[7, -3]
source
CTBase.LagrangeType
struct Lagrange{time_dependence, variable_dependence}

Fields

  • f::Function

The default value for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor Lagrange returns a Lagrange cost of a function. The function must take 2 to 4 arguments, (x, u) to (t, x, u, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> Lagrange((x, u) -> 2x[2]-u[1]^2, Int64)
 IncorrectArgument
 julia> Lagrange((x, u) -> 2x[2]-u[1]^2, Int64)
 IncorrectArgument
@@ -272,7 +272,7 @@
 0
 julia> L = Lagrange((t, x, u, v) -> t+2x[2]-u[1]^2+v[3], autonomous=false, variable=true)
 julia> L(1, [1, 0], [1], [1, 2, 3])
-3
source
CTBase.MayerType
struct Mayer{variable_dependence}

Fields

  • f::Function

The default value for variable_dependence is Fixed.

Constructor

The constructor Mayer returns a Mayer cost of a function. The function must take 2 or 3 arguments (x0, xf) or (x0, xf, v), if the function is variable, it must be specified. Dependencies are specified with a boolean, variable, false by default or with a DataType, NonFixed/Fixed, Fixed by default.

Examples

julia> G = Mayer((x0, xf) -> xf[2]-x0[1])
+3
source
CTBase.MayerType
struct Mayer{variable_dependence}

Fields

  • f::Function

The default value for variable_dependence is Fixed.

Constructor

The constructor Mayer returns a Mayer cost of a function. The function must take 2 or 3 arguments (x0, xf) or (x0, xf, v), if the function is variable, it must be specified. Dependencies are specified with a boolean, variable, false by default or with a DataType, NonFixed/Fixed, Fixed by default.

Examples

julia> G = Mayer((x0, xf) -> xf[2]-x0[1])
 julia> G = Mayer((x0, xf, v) -> v[3]+xf[2]-x0[1], variable=true)
 julia> G = Mayer((x0, xf, v) -> v[3]+xf[2]-x0[1], NonFixed)
Warning

When the state is of dimension 1, consider x0 and xf as a scalar.

Call

The call returns the evaluation of the Mayer cost for given values. If a variable is given for a non variable dependent Mayer cost, it will be ignored.

Examples

julia> G = Mayer((x0, xf) -> xf[2]-x0[1])
 julia> G([0, 0], [1, 1])
@@ -282,7 +282,7 @@
 1
 julia> G = Mayer((x0, xf, v) -> v[3]+xf[2]-x0[1], variable=true)
 julia> G([0, 0], [1, 1], [1, 2, 3])
-4
source
CTBase.MixedConstraintType
struct MixedConstraint{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to Lagrange in the usage, but the dimension of the output of the function f is arbitrary.

The default value for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor MixedConstraint returns a MixedConstraint of a function. The function must take 2 to 4 arguments, (x, u) to (t, x, u, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> MixedConstraint((x, u) -> [2x[2]-u^2, x[1]], Int64)
+4
source
CTBase.MixedConstraintType
struct MixedConstraint{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to Lagrange in the usage, but the dimension of the output of the function f is arbitrary.

The default value for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor MixedConstraint returns a MixedConstraint of a function. The function must take 2 to 4 arguments, (x, u) to (t, x, u, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> MixedConstraint((x, u) -> [2x[2]-u^2, x[1]], Int64)
 IncorrectArgument
 julia> MixedConstraint((x, u) -> [2x[2]-u^2, x[1]], Int64)
 IncorrectArgument
@@ -318,7 +318,7 @@
 [0, 1]
 julia> M = MixedConstraint((t, x, u, v) -> [t+2x[2]-u^2+v[3], x[1]], autonomous=false, variable=true)
 julia> M(1, [1, 0], 1, [1, 2, 3])
-[3, 1]
source
CTBase.MultiplierType
struct Multiplier{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to ControlLaw in the usage.

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor Multiplier returns a Multiplier of a function. The function must take 2 to 4 arguments, (x, p) to (t, x, p, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> Multiplier((x, p) -> x[1]^2+2p[2], Int64)
+[3, 1]
source
CTBase.MultiplierType
struct Multiplier{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to ControlLaw in the usage.

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor Multiplier returns a Multiplier of a function. The function must take 2 to 4 arguments, (x, p) to (t, x, p, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> Multiplier((x, p) -> x[1]^2+2p[2], Int64)
 IncorrectArgument
 julia> Multiplier((x, p) -> x[1]^2+2p[2], Int64)
 IncorrectArgument
@@ -352,7 +352,7 @@
 4
 julia> μ = Multiplier((t, x, p, v) -> t+x[1]^2+2p[2]+v[3], autonomous=false, variable=true)
 julia> μ(1, [1, 0], [0, 1], [1, 2, 3])
-7
source
CTBase.OptimalControlModelType
mutable struct OptimalControlModel{time_dependence<:TimeDependence, variable_dependence<:VariableDependence} <: CTBase.AbstractOptimalControlModel

Fields

  • model_expression::Union{Nothing, Expr}: Default: nothing

  • initial_time::Union{Nothing, Index, Real}: Default: nothing

  • initial_time_name::Union{Nothing, String}: Default: nothing

  • final_time::Union{Nothing, Index, Real}: Default: nothing

  • final_time_name::Union{Nothing, String}: Default: nothing

  • time_name::Union{Nothing, String}: Default: nothing

  • control_dimension::Union{Nothing, Integer}: Default: nothing

  • control_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • control_name::Union{Nothing, String}: Default: nothing

  • state_dimension::Union{Nothing, Integer}: Default: nothing

  • state_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • state_name::Union{Nothing, String}: Default: nothing

  • variable_dimension::Union{Nothing, Integer}: Default: nothing

  • variable_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • variable_name::Union{Nothing, String}: Default: nothing

  • lagrange::Union{Nothing, Lagrange}: Default: nothing

  • mayer::Union{Nothing, Mayer}: Default: nothing

  • criterion::Union{Nothing, Symbol}: Default: nothing

  • dynamics::Union{Nothing, Dynamics}: Default: nothing

  • constraints::Dict{Symbol, Tuple}: Default: Dict{Symbol, Tuple{Vararg{Any}}}()

  • dim_control_constraints::Union{Nothing, Integer}: Default: nothing

  • dim_state_constraints::Union{Nothing, Integer}: Default: nothing

  • dim_mixed_constraints::Union{Nothing, Integer}: Default: nothing

  • dim_boundary_constraints::Union{Nothing, Integer}: Default: nothing

  • dim_variable_constraints::Union{Nothing, Integer}: Default: nothing

  • dim_control_range::Union{Nothing, Integer}: Default: nothing

  • dim_state_range::Union{Nothing, Integer}: Default: nothing

  • dim_variable_range::Union{Nothing, Integer}: Default: nothing

source
CTBase.OptimalControlSolutionType
mutable struct OptimalControlSolution <: CTBase.AbstractOptimalControlSolution

Type of an optimal control solution.

Fields

  • times::Union{Nothing, StepRangeLen, AbstractVector{<:Real}}: Default: nothing

  • initial_time_name::Union{Nothing, String}: Default: nothing

  • final_time_name::Union{Nothing, String}: Default: nothing

  • time_name::Union{Nothing, String}: Default: nothing

  • control_dimension::Union{Nothing, Integer}: Default: nothing

  • control_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • control_name::Union{Nothing, String}: Default: nothing

  • control::Union{Nothing, Function}: Default: nothing

  • state_dimension::Union{Nothing, Integer}: Default: nothing

  • state_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • state_name::Union{Nothing, String}: Default: nothing

  • state::Union{Nothing, Function}: Default: nothing

  • variable_dimension::Union{Nothing, Integer}: Default: nothing

  • variable_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • variable_name::Union{Nothing, String}: Default: nothing

  • variable::Union{Nothing, Real, AbstractVector{<:Real}}: Default: nothing

  • costate::Union{Nothing, Function}: Default: nothing

  • objective::Union{Nothing, Real}: Default: nothing

  • iterations::Union{Nothing, Integer}: Default: nothing

  • stopping::Union{Nothing, Symbol}: Default: nothing

  • message::Union{Nothing, String}: Default: nothing

  • success::Union{Nothing, Bool}: Default: nothing

  • infos::Dict{Symbol, Any}: Default: Dict{Symbol, Any}()

source
CTBase.StateConstraintType
struct StateConstraint{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to VectorField in the usage, but the dimension of the output of the function f is arbitrary.

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor StateConstraint returns a StateConstraint of a function. The function must take 1 to 3 arguments, x to (t, x, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> StateConstraint(x -> [x[1]^2, 2x[2]], Int64)
+7
source
CTBase.OptimalControlModelType
mutable struct OptimalControlModel{time_dependence<:TimeDependence, variable_dependence<:VariableDependence} <: CTBase.AbstractOptimalControlModel

Fields

  • model_expression::Union{Nothing, Expr}: Default: nothing

  • initial_time::Union{Nothing, Index, Real}: Default: nothing

  • initial_time_name::Union{Nothing, String}: Default: nothing

  • final_time::Union{Nothing, Index, Real}: Default: nothing

  • final_time_name::Union{Nothing, String}: Default: nothing

  • time_name::Union{Nothing, String}: Default: nothing

  • control_dimension::Union{Nothing, Integer}: Default: nothing

  • control_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • control_name::Union{Nothing, String}: Default: nothing

  • state_dimension::Union{Nothing, Integer}: Default: nothing

  • state_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • state_name::Union{Nothing, String}: Default: nothing

  • variable_dimension::Union{Nothing, Integer}: Default: nothing

  • variable_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • variable_name::Union{Nothing, String}: Default: nothing

  • lagrange::Union{Nothing, Lagrange}: Default: nothing

  • mayer::Union{Nothing, Mayer}: Default: nothing

  • criterion::Union{Nothing, Symbol}: Default: nothing

  • dynamics::Union{Nothing, Dynamics}: Default: nothing

  • constraints::Dict{Symbol, Tuple}: Default: Dict{Symbol, Tuple{Vararg{Any}}}()

  • dim_control_constraints::Union{Nothing, Integer}: Default: nothing

  • dim_state_constraints::Union{Nothing, Integer}: Default: nothing

  • dim_mixed_constraints::Union{Nothing, Integer}: Default: nothing

  • dim_boundary_constraints::Union{Nothing, Integer}: Default: nothing

  • dim_variable_constraints::Union{Nothing, Integer}: Default: nothing

  • dim_control_range::Union{Nothing, Integer}: Default: nothing

  • dim_state_range::Union{Nothing, Integer}: Default: nothing

  • dim_variable_range::Union{Nothing, Integer}: Default: nothing

source
CTBase.OptimalControlSolutionType
mutable struct OptimalControlSolution <: CTBase.AbstractOptimalControlSolution

Type of an optimal control solution.

Fields

  • times::Union{Nothing, StepRangeLen, AbstractVector{<:Real}}: Default: nothing

  • initial_time_name::Union{Nothing, String}: Default: nothing

  • final_time_name::Union{Nothing, String}: Default: nothing

  • time_name::Union{Nothing, String}: Default: nothing

  • control_dimension::Union{Nothing, Integer}: Default: nothing

  • control_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • control_name::Union{Nothing, String}: Default: nothing

  • control::Union{Nothing, Function}: Default: nothing

  • state_dimension::Union{Nothing, Integer}: Default: nothing

  • state_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • state_name::Union{Nothing, String}: Default: nothing

  • state::Union{Nothing, Function}: Default: nothing

  • variable_dimension::Union{Nothing, Integer}: Default: nothing

  • variable_components_names::Union{Nothing, Vector{String}}: Default: nothing

  • variable_name::Union{Nothing, String}: Default: nothing

  • variable::Union{Nothing, Real, AbstractVector{<:Real}}: Default: nothing

  • costate::Union{Nothing, Function}: Default: nothing

  • objective::Union{Nothing, Real}: Default: nothing

  • iterations::Union{Nothing, Integer}: Default: nothing

  • stopping::Union{Nothing, Symbol}: Default: nothing

  • message::Union{Nothing, String}: Default: nothing

  • success::Union{Nothing, Bool}: Default: nothing

  • infos::Dict{Symbol, Any}: Default: Dict{Symbol, Any}()

source
CTBase.StateConstraintType
struct StateConstraint{time_dependence, variable_dependence}

Fields

  • f::Function

Similar to VectorField in the usage, but the dimension of the output of the function f is arbitrary.

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor StateConstraint returns a StateConstraint of a function. The function must take 1 to 3 arguments, x to (t, x, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> StateConstraint(x -> [x[1]^2, 2x[2]], Int64)
 IncorrectArgument
 julia> StateConstraint(x -> [x[1]^2, 2x[2]], Int64)
 IncorrectArgument
@@ -386,9 +386,9 @@
 [2, -2]
 julia> S = StateConstraint((t, x, v) -> [t+x[1]^2, 2x[2]+v[3]], autonomous=false, variable=true)
 julia>  S(1, [1, -1], [1, 2, 3])
-[2, 1]
source
CTBase.VariableConstraintType
struct VariableConstraint

Fields

  • f::Function

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor VariableConstraint returns a VariableConstraint of a function. The function must take 1 argument, v.

Examples

julia> V = VariableConstraint(v -> [v[1]^2, 2v[2]])
Warning

When the variable is of dimension 1, consider v as a scalar.

Call

The call returns the evaluation of the VariableConstraint for given values.

Examples

julia> V = VariableConstraint(v -> [v[1]^2, 2v[2]])
+[2, 1]
source
CTBase.VariableConstraintType
struct VariableConstraint

Fields

  • f::Function

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor VariableConstraint returns a VariableConstraint of a function. The function must take 1 argument, v.

Examples

julia> V = VariableConstraint(v -> [v[1]^2, 2v[2]])
Warning

When the variable is of dimension 1, consider v as a scalar.

Call

The call returns the evaluation of the VariableConstraint for given values.

Examples

julia> V = VariableConstraint(v -> [v[1]^2, 2v[2]])
 julia> V([1, -1])
-[1, -2]
source
CTBase.VectorFieldType
struct VectorField{time_dependence, variable_dependence} <: CTBase.AbstractVectorField{time_dependence, variable_dependence}

Fields

  • f::Function

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor VectorField returns a VectorField of a function. The function must take 1 to 3 arguments, x to (t, x, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> VectorField(x -> [x[1]^2, 2x[2]], Int64)
+[1, -2]
source
CTBase.VectorFieldType
struct VectorField{time_dependence, variable_dependence} <: CTBase.AbstractVectorField{time_dependence, variable_dependence}

Fields

  • f::Function

The default values for time_dependence and variable_dependence are Autonomous and Fixed respectively.

Constructor

The constructor VectorField returns a VectorField of a function. The function must take 1 to 3 arguments, x to (t, x, v), if the function is variable or non autonomous, it must be specified. Dependencies are specified either with :

  • booleans, autonomous and variable, respectively true and false by default
  • DataType, Autonomous/NonAutonomous and NonFixed/Fixed, respectively Autonomous and Fixed by default.

Examples

julia> VectorField(x -> [x[1]^2, 2x[2]], Int64)
 IncorrectArgument
 julia> VectorField(x -> [x[1]^2, 2x[2]], Int64)
 IncorrectArgument
@@ -421,4 +421,4 @@
 [2, -2]
 julia> V = VectorField((t, x, v) -> [t+x[1]^2, 2x[2]+v[3]], autonomous=false, variable=true)
 julia> V(1, [1, -1], [1, 2, 3])
-[2, 1]
source
+[2, 1]
source
diff --git a/dev/api-utils.html b/dev/api-utils.html index 2e94a4ad..f1b33d66 100644 --- a/dev/api-utils.html +++ b/dev/api-utils.html @@ -1,11 +1,11 @@ -Utils · CTBase.jl

Utils

Index

Documentation

+Utils · CTBase.jl

Utils

Index

Documentation

diff --git a/dev/index.html b/dev/index.html index 6c965d14..cdb27936 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Introduction · CTBase.jl

CTBase.jl

The CTBase.jl package is part of the control-toolbox ecosystem.

Install

To install a package from the control-toolbox ecosystem, please visit the installation page.

You may find in this package, some tools to:

You may find the imported modules and exported names but also the different types of exceptions and functions specific to the control-toolbox ecosystem.

+Introduction · CTBase.jl

CTBase.jl

The CTBase.jl package is part of the control-toolbox ecosystem.

Install

To install a package from the control-toolbox ecosystem, please visit the installation page.

You may find in this package, some tools to:

You may find the imported modules and exported names but also the different types of exceptions and functions specific to the control-toolbox ecosystem.