You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/index.md
+262-6Lines changed: 262 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,9 @@ CurrentModule = CTBase
6
6
7
7
The `CTBase.jl` package is part of the [control-toolbox ecosystem](https://github.com/control-toolbox).
8
8
9
-
The root package is [OptimalControl.jl](https://github.com/control-toolbox/OptimalControl.jl) which aims to provide tools to model and solve optimal control problems with ordinary differential equations by direct and indirect methods, both on CPU and GPU.
9
+
!!! note
10
+
11
+
The root package is [OptimalControl.jl](https://github.com/control-toolbox/OptimalControl.jl) which aims to provide tools to model and solve optimal control problems with ordinary differential equations by direct and indirect methods, both on CPU and GPU.
10
12
11
13
!!! warning
12
14
@@ -27,15 +29,269 @@ The root package is [OptimalControl.jl](https://github.com/control-toolbox/Optim
27
29
julia> CTBase.private_fun(x)
28
30
```
29
31
30
-
If the method is re-exported by another package, there is no need to
31
-
prefix it with the original module name:
32
-
33
-
```julia-repl
34
-
julia> module OptimalControl
32
+
If the method is re-exported by another package,
33
+
34
+
```julia
35
+
module OptimalControl
35
36
import CTBase: private_fun
36
37
export private_fun
37
38
end
39
+
```
40
+
41
+
then there is no need to prefix it with the original module name:
42
+
43
+
```julia-repl
38
44
julia> using OptimalControl
39
45
julia> x = 1
40
46
julia> private_fun(x)
41
47
```
48
+
49
+
## Descriptions: encoding algorithms
50
+
51
+
One of the central ideas in CTBase is the notion of a **description**.
52
+
A description is simply a tuple of `Symbol`s that encodes an algorithm or
53
+
configuration in a declarative way.
54
+
55
+
Formally, CTBase defines:
56
+
57
+
```julia
58
+
const DescVarArg = Vararg{Symbol}
59
+
const Description = Tuple{DescVarArg}
60
+
```
61
+
62
+
For example, the tuple
63
+
64
+
```julia-repl
65
+
julia> using CTBase
66
+
67
+
julia> d = (:descent, :bfgs, :bisection)
68
+
(:descent, :bfgs, :bisection)
69
+
70
+
julia> typeof(d) <: CTBase.Description
71
+
true
72
+
```
73
+
74
+
can be read as “a descent algorithm, with BFGS directions and a bisection
75
+
line search”. Higher-level packages in the control-toolbox ecosystem use
76
+
descriptions to catalogue algorithms in a uniform way.
77
+
78
+
### Building a library of descriptions
79
+
80
+
CTBase provides a few small functions to manage collections of descriptions:
81
+
82
+
-`CTBase.add(x, y)` adds the description `y` to the tuple of descriptions `x`,
83
+
rejecting duplicates with an `IncorrectArgument` exception.
84
+
-`CTBase.complete(list; descriptions=D)` picks a complete description from a
85
+
set `D` based on a partial list of symbols.
86
+
-`CTBase.remove(x, y)` returns the set difference of two descriptions.
87
+
88
+
Here is a complete example of a small “algorithm library”:
0 commit comments