File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,19 @@ The default value is true.
66"""
77__display () = true
88
9+ """
10+ Return the version of the current module as a string.
11+
12+ This function returns the version number defined in the `Project.toml` of the package
13+ to which the current module belongs. It uses `@__MODULE__` to infer the calling context.
14+
15+ # Example
16+ ```julia-repl
17+ julia> version() # e.g., "1.2.3"
18+ ```
19+ """
20+ version () = string (pkgversion (@__MODULE__ ))
21+
922"""
1023$(TYPEDSIGNATURES)
1124
@@ -112,12 +125,11 @@ function CommonSolve.solve(
112125
113126 # display the chosen method
114127 if display
115- print (" ▫ This is OptimalControl running with: " )
128+ print (" ▫ This is OptimalControl version v $( version ()) running with: " )
116129 for (i, m) in enumerate (method)
117- sep = i == length (method) ? " ." : " , "
130+ sep = i == length (method) ? " .\n\n " : " , "
118131 printstyled (string (m) * sep, color = :cyan , bold = true )
119132 end
120- println (" \n " )
121133 end
122134
123135 # solve the problem
Original file line number Diff line number Diff line change 1+ using Pkg
2+ Pkg. activate (" ." )
3+
4+ using OptimalControl
5+
6+ # activate NLP modelers
7+ using ADNLPModels
8+ # + using ExaModels (in test_exa for now)
9+
10+ # activate NLP solvers
11+ using NLPModelsIpopt
12+ using MadNLP
13+
14+ @def ocp begin
15+ tf ∈ R, variable
16+ t ∈ [0 , tf], time
17+ x ∈ R², state
18+ u ∈ R, control
19+ - 1 ≤ u (t) ≤ 1
20+ x (0 ) == [0 , 0 ]
21+ x (tf) == [1 , 0 ]
22+ 0.05 ≤ tf ≤ Inf
23+ ẋ (t) == [x₂ (t), u (t)]
24+ tf → min
25+ end
26+
27+ sol = solve (ocp, :adnlp , :ipopt ; print_level= 5 );
You can’t perform that action at this time.
0 commit comments