@@ -16,12 +16,18 @@ import Base
16
16
using DocStringExtensions
17
17
using ForwardDiff: jacobian, gradient, ForwardDiff # automatic differentiation
18
18
using Interpolations: linear_interpolation, Line, Interpolations # for default interpolation
19
- using MLStyle
19
+ using Reexport
20
+ @reexport using MLStyle # pattern matching
20
21
using Parameters # @with_kw: to have default values in struct
21
22
using Plots
22
23
import Plots: plot, plot! # import instead of using to overload the plot and plot! functions
23
24
using Printf # to print an OptimalControlModel
24
- using Reexport
25
+ using DataStructures # OrderedDict for aliases
26
+ using Unicode # unicode primitives
27
+ using PrettyTables # to print a table
28
+ using ReplMaker
29
+ using MacroTools: inexpr, striplines, MacroTools
30
+ using LinearAlgebra
25
31
26
32
# --------------------------------------------------------------------------------------------------
27
33
# Aliases for types
@@ -30,12 +36,10 @@ using Reexport
30
36
Type alias for a real number.
31
37
"""
32
38
const ctNumber = Real
33
- const MyNumber = Real
34
39
"""
35
40
Type alias for a vector of real numbers.
36
41
"""
37
- const ctVector = AbstractVector{<: ctNumber }
38
- const MyVector = AbstractVector{<: MyNumber }
42
+ const ctVector = Union{ctNumber, AbstractVector{<: ctNumber }} # [] must be defined as Vector{Real}()
39
43
"""
40
44
Type alias for a time.
41
45
"""
@@ -53,51 +57,62 @@ Type alias for a state.
53
57
"""
54
58
const State = ctVector
55
59
"""
56
- Type alias for an adjoint .
60
+ Type alias for an costate .
57
61
"""
58
- const Adjoint = ctVector # todo: add ajoint to write p*f(x, u) instead of p'*f(x,u)
62
+ const Costate = ctVector # todo: add ajoint to write p*f(x, u) instead of p'*f(x,u)
59
63
"""
60
64
Type alias for a control.
61
65
"""
62
66
const Control = ctVector
63
67
"""
68
+ Type alias for a variable.
69
+ """
70
+ const Variable = ctVector
71
+ """
64
72
Type alias for a vector of states.
65
73
"""
66
- const States = Vector {<: State }
74
+ const States = AbstractVector {<: State }
67
75
"""
68
- Type alias for a vector of adjoints .
76
+ Type alias for a vector of costates .
69
77
"""
70
- const Adjoints = Vector {<: Adjoint }
78
+ const Costates = AbstractVector {<: Costate }
71
79
"""
72
80
Type alias for a vector of controls.
73
81
"""
74
- const Controls = Vector {<: Control }
82
+ const Controls = AbstractVector {<: Control }
75
83
"""
76
84
Type alias for a dimension.
77
85
"""
78
86
const Dimension = Integer
79
87
80
88
#
81
- include (" exceptions .jl" )
89
+ include (" exception .jl" )
82
90
include (" description.jl" )
83
- include (" callbacks.jl" )
84
- include (" functions.jl" )
85
- #
91
+ include (" callback.jl" )
86
92
include (" default.jl" )
87
93
include (" utils.jl" )
88
- include (" model.jl" )
89
94
#
90
- include (" ctparser_utils .jl" )
91
- # include("ctparser.jl")
92
- # @reexport using .CtParser
95
+ include (" types .jl" )
96
+ #
97
+ include ( " checking.jl " )
93
98
#
94
99
include (" print.jl" )
95
- include (" solution.jl" )
96
100
include (" plot.jl" )
101
+ #
102
+ include (" functions.jl" )
103
+ include (" model.jl" )
104
+ #
105
+ include (" ctparser_utils.jl" )
106
+ # include("ctparser.jl")
107
+ include (" onepass.jl" )
108
+ include (" repl.jl" )
97
109
98
110
# numeric types
99
111
export ctNumber, ctVector, Time, Times, TimesDisc
100
- export States, Adjoints, Controls, State, Adjoint, Dimension, Index
112
+
113
+ export States, Costates, Controls, State, Costate, Control, Variable, Dimension, Index
114
+ export TimeDependence, Autonomous, NonAutonomous
115
+ export VariableDependence, NonFixed, Fixed
101
116
102
117
# callback
103
118
export CTCallback, CTCallbacks, PrintCallback, StopCallback
@@ -107,29 +122,35 @@ export get_priority_print_callbacks, get_priority_stop_callbacks
107
122
export Description, makeDescription, add, getFullDescription
108
123
109
124
# exceptions
110
- export CTException, AmbiguousDescription, InconsistentArgument , IncorrectMethod
125
+ export CTException, ParsingError, AmbiguousDescription , IncorrectMethod
111
126
export IncorrectArgument, IncorrectOutput, NotImplemented, UnauthorizedCall
112
127
113
128
# functions
114
129
export Hamiltonian, HamiltonianVectorField, VectorField
115
130
export Mayer, Lagrange, Dynamics, ControlLaw, FeedbackControl, Multiplier
116
- export BoundaryConstraint, StateConstraint, ControlConstraint, MixedConstraint
131
+ export BoundaryConstraint, StateConstraint, ControlConstraint, MixedConstraint, VariableConstraint
117
132
118
133
# model
119
134
export OptimalControlModel
120
135
export Model
121
- export time!, constraint!, objective!, state!, control!, remove_constraint!, constraint
122
- export isautonomous, isnonautonomous, ismin, ismax
136
+ export variable!, time!, constraint!, dynamics !, objective!, state!, control!, remove_constraint!, constraint
137
+ export is_time_independent, is_time_dependent, is_min, is_max, is_variable_dependent, is_variable_independent
123
138
export nlp_constraints, constraints_labels
124
139
125
140
# solution
126
141
export OptimalControlSolution
127
- export plot
142
+ export plot, plot!
128
143
129
144
# utils
130
145
export Ad, Poisson, ctgradient, ctjacobian, ctinterpolate, ctindices, ctupperscripts
131
146
132
- # _Time
133
- export _Time
147
+ # ctparser_utils
148
+ export replace_call, constraint_type
149
+
150
+ # onepass
151
+ export @def
152
+
153
+ # repl
154
+ isdefined (Base, :active_repl ) && __init_repl ()
134
155
135
156
end
0 commit comments