Skip to content

Commit 6c71c4d

Browse files
authored
Merge pull request #530 from control-toolbox/529-dev-export-dual-function
add export dual
2 parents 0d0d20f + 429f306 commit 6c71c4d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/OptimalControl.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import CTModels:
3434
Model,
3535
PreModel,
3636
# getters
37+
dual,
3738
initial_time,
3839
final_time,
3940
time_name,
@@ -65,7 +66,8 @@ import CTModels:
6566
message,
6667
infos
6768
export Model
68-
export initial_time,
69+
export dual,
70+
initial_time,
6971
final_time,
7072
time_name,
7173
variable_dimension,

test/extras/cons.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ t_flow = time_grid(sol_flow);
9090
x_flow = state(sol_flow);
9191
p_flow = costate(sol_flow);
9292
u_flow = control(sol_flow);
93-
η_flow = t -> 2x(t) * (t1 t t2)
93+
η_flow = dual(sol, ocp, :eq1) # t -> 2x(t) * (t1 ≤ t ≤ t2)
9494

9595
H_flow(t) = H(x_flow(t), p_flow(t), u_flow(t), η_flow(t));
9696
plot!(plt_H, t, H_flow; color=:blue, label="indirect")
97+
98+
plot(t_flow, η_flow)

0 commit comments

Comments
 (0)