Skip to content

Commit 728796b

Browse files
committed
Merge branch 'main' of github.com:control-toolbox/CTModels.jl
2 parents 6c95c42 + 8eacdb1 commit 728796b

8 files changed

Lines changed: 86 additions & 31 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ CTModelsExportImport = ["JLD2", "JSON3"]
2424
CTModelsPlots = "Plots"
2525

2626
[compat]
27-
CTBase = "0.15"
27+
CTBase = "0.16"
2828
DocStringExtensions = "0.9"
2929
Interpolations = "0.15"
3030
JLD2 = "0.5"

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ makedocs(;
1616
asset("https://control-toolbox.org/assets/js/documentation.js"),
1717
],
1818
),
19-
pages=["Introduction" => "index.md", "API" => "api.md"],
19+
pages=["Introduction" => "index.md", "Developers" => "dev.md"],
2020
checkdocs=:none,
2121
)
2222

docs/src/api.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/src/dev.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Private functions
2+
3+
```@meta
4+
CollapsedDocStrings = false
5+
CurrentModule = CTModels
6+
```
7+
8+
## CTModels
9+
10+
```@autodocs
11+
Modules = [CTModels]
12+
Order = [:module]
13+
Pages = ["CTModels.jl"]
14+
Private = false
15+
```
16+
17+
## Index
18+
19+
```@index
20+
Pages = ["dev.md"]
21+
Modules = [CTModels]
22+
Order = [:constant, :type, :function, :macro]
23+
```
24+
25+
## Documentation
26+
27+
```@autodocs
28+
Modules = [CTModels]
29+
Order = [:constant, :type, :function, :macro]
30+
Public = false
31+
```
32+

docs/src/index.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
# CTModels
1+
# CTModels.jl
22

3-
Documentation for [CTModels](https://github.com/control-toolbox/CTModels.jl).
3+
The `CTModels.jl` package is part of the [control-toolbox ecosystem](https://github.com/control-toolbox).
44

5-
## Dependencies
6-
7-
All the numerical simulations to generate this documentation are performed with the following packages.
8-
9-
```@example
10-
using Pkg
11-
Pkg.status()
12-
```
5+
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.

src/CTModels.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
"""
2+
[`CTModels`](@ref) module.
3+
4+
Lists all the imported modules and packages:
5+
6+
$(IMPORTS)
7+
"""
18
module CTModels
29

310
# imports

src/constraints.jl

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,44 @@
22
$(TYPEDSIGNATURES)
33
44
Add a constraint to a dictionary of constraints.
5+
6+
## Arguments
7+
8+
- `ocp_constraints`: The dictionary of constraints to which the constraint will be added.
9+
- `type`: The type of the constraint. It can be :state, :control, :variable, :boundary or :path.
10+
- `n`: The dimension of the state.
11+
- `m`: The dimension of the control.
12+
- `q`: The dimension of the variable.
13+
- `rg`: The range of the constraint. It can be an integer or a range of integers.
14+
- `f`: The function that defines the constraint. It must return a vector of the same dimension as the constraint.
15+
- `lb`: The lower bound of the constraint. It can be a number or a vector.
16+
- `ub`: The upper bound of the constraint. It can be a number or a vector.
17+
- `label`: The label of the constraint. It must be unique in the dictionary of constraints.
18+
19+
## Requirements
20+
21+
- The constraint must not be set before.
22+
- The lower bound `lb` and the upper bound `ub` cannot be both nothing.
23+
- The lower bound `lb` and the upper bound `ub` must have the same length, if both provided.
24+
25+
If `rg` and `f` are not provided then,
26+
27+
- `type` must be :state, :control or :variable
28+
- `lb` and `ub` must be of dimension n, m or q respectively, when provided.
29+
30+
If `rg` is provided, then:
31+
32+
- `f` must not be provided.
33+
- `type` must be :state, :control or :variable.
34+
- `rg` must be a range of integers, and must be contained in 1:n, 1:m or 1:q respectively.
35+
36+
If `f` is provided, then:
37+
38+
- `rg` must not be provided.
39+
- `type` must be :boundary or :path.
40+
- `f` must be a function that returns a vector of the same dimension as the constraint.
41+
- `lb` and `ub` must be of the same dimension as the output of `f`, when provided.
42+
543
"""
644
function __constraint!(
745
ocp_constraints::ConstraintsDictType,
@@ -124,7 +162,7 @@ end
124162
"""
125163
$(TYPEDSIGNATURES)
126164
127-
Add a constraint to a pre-model.
165+
Add a constraint to a pre-model. See `[__constraint!](@ref)` for more details.
128166
"""
129167
function constraint!(
130168
ocp::PreModel,

test/Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
88

99
[compat]
1010
Aqua = "0.8"
11-
CTBase = "0.15"
12-
JSON3 = "1"
11+
CTBase = "0.16"
1312
JLD2 = "0.5"
14-
Plots = "1.40"
13+
JSON3 = "1"
14+
Plots = "1.40"

0 commit comments

Comments
 (0)