Skip to content

Commit 999cd0e

Browse files
authored
Update example-double-integrator-energy.md
1 parent 781d27f commit 999cd0e

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

docs/src/example-double-integrator-energy.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -104,39 +104,3 @@ sol = solve(ocp)
104104
105105
plot(sol)
106106
```
107-
108-
## Exporting and importing the solution
109-
110-
We can export (or save) the solution in a Julia `.jld2` data file and reload it later, and also export a discretised version of the solution in a more portable [JSON](https://en.wikipedia.org/wiki/JSON) format. Note that the optimal control problem is needed when loading a solution.
111-
112-
See the two functions:
113-
114-
- [`import_ocp_solution`](@ref),
115-
- [`export_ocp_solution`](@ref).
116-
117-
### JLD2
118-
119-
```@example main
120-
# using JLD2
121-
using Suppressor # hide
122-
@suppress_err begin # hide
123-
# export_ocp_solution(sol; filename="my_solution")
124-
end # hide
125-
# sol_jld = import_ocp_solution(ocp; filename="my_solution")
126-
# println("Objective from computed solution: ", objective(sol))
127-
# println("Objective from imported solution: ", objective(sol_jld))
128-
```
129-
130-
!!! danger "Bug"
131-
132-
The code above does not work in the documentation but works locally. This bug will be fixed.
133-
134-
### JSON
135-
136-
```@example main
137-
using JSON3
138-
export_ocp_solution(sol; filename="my_solution", format=:JSON)
139-
sol_json = import_ocp_solution(ocp; filename="my_solution", format=:JSON)
140-
println("Objective from computed solution: ", objective(sol))
141-
println("Objective from imported solution: ", objective(sol_json))
142-
```

0 commit comments

Comments
 (0)