Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
734fdc7
comp
Nico77310 Jun 17, 2025
9643762
comparison
Nico77310 Jun 26, 2025
ac397be
comparisonv2
Nico77310 Jun 26, 2025
5ffa2ff
up
ocots Jun 26, 2025
545c11a
list_of_problems_final
Nico77310 Jun 27, 2025
6e90683
init
Nico77310 Jun 30, 2025
2caf579
available_problems
antoinepichon03 Jun 30, 2025
cf80b8c
objectives
Nico77310 Jun 30, 2025
96b960b
Merge branch '78-dev-comparison-tests' of https://github.com/control-…
Nico77310 Jun 30, 2025
6e8c5e3
all_tests
Nico77310 Jul 1, 2025
d9810de
small refactoring
ocots Jul 2, 2025
3429581
available_problems dans OptimalControlProbleme.jl et exporté
antoinepichon03 Jul 4, 2025
e11596f
Merge branch '78-dev-comparison-tests-olivier' into 78-dev-comparison…
Nico77310 Jul 4, 2025
5ba5fe7
fixed_init
Nico77310 Jul 9, 2025
81b585e
moonlander, shuttle, truck
PierreMartinon Jul 11, 2025
c42938e
fixed cart
PierreMartinon Jul 17, 2025
e46404f
update direct transcription call
PierreMartinon Jul 17, 2025
3b25090
objective test only
PierreMartinon Jul 17, 2025
7adad2d
vanderpol
PierreMartinon Jul 17, 2025
16a9874
ok except vehicle and truck
PierreMartinon Jul 18, 2025
3c025b8
truck ok
PierreMartinon Jul 18, 2025
7b34e25
test_jump ok
PierreMartinon Jul 18, 2025
6a1022b
test OC ok
PierreMartinon Jul 18, 2025
d886522
test quick ok except electric_vehicle
PierreMartinon Jul 18, 2025
7424828
relative_comparison
Nico77310 Jul 18, 2025
e8fc84b
todo: fix shuttle error (test_comparison:89, * with nh vector)
PierreMartinon Jul 18, 2025
648a430
sync problems from problems_update
PierreMartinon Jul 18, 2025
e5e84ef
remove obsolete option const_violation_tol; use objective(sol)
PierreMartinon Jul 18, 2025
416e92d
update available problems
Nico77310 Jul 29, 2025
e0bf084
english
Nico77310 Jul 29, 2025
dc3a646
removed_costate_comparison
Nico77310 Aug 1, 2025
ff9e463
fixed_costate_figures
Nico77310 Aug 1, 2025
442b8f8
up compat
ocots Aug 7, 2025
4034039
beam, bioreactor: nh=500, trapeze
ocots Aug 8, 2025
37345b1
cart_pendulum
ocots Aug 8, 2025
0a4e108
metadata update
ocots Aug 8, 2025
b95dcbc
chain
ocots Aug 8, 2025
1cc5d98
dielectrophoretic_particle
ocots Aug 8, 2025
0c791d4
dielectrophoretic_particle
ocots Aug 8, 2025
e4f9636
double_oscillator
ocots Aug 8, 2025
f191521
ducted_fan
ocots Aug 8, 2025
ff358b8
fix
ocots Aug 8, 2025
98c9503
metadata ∂
ocots Aug 9, 2025
0496d76
electric_vehicle
ocots Aug 9, 2025
10dbace
insurance
ocots Aug 9, 2025
557bb43
jackson
ocots Aug 9, 2025
ca89406
quadrotor
ocots Aug 9, 2025
c9ad300
quadrotor
ocots Aug 9, 2025
cf6b024
robbins
ocots Aug 9, 2025
01d8893
robot
ocots Aug 9, 2025
b91f159
rocket
ocots Aug 9, 2025
123f82e
space_shuttle
ocots Aug 9, 2025
6e2baf4
steering
ocots Aug 9, 2025
0a2e603
truck_trailer
ocots Aug 9, 2025
d2eed55
vanderpol
ocots Aug 9, 2025
fd79a8d
test quick ok
ocots Aug 9, 2025
4bd56ba
starting updating init test
ocots Aug 10, 2025
18dea3f
test init ok but objective
ocots Aug 10, 2025
8b57de6
init ok + plots, pb with some objective
ocots Aug 10, 2025
f87884c
init ok + plots, pb with some objective
ocots Aug 10, 2025
2e11c5d
add some files
ocots Aug 10, 2025
da7638b
debut test solution
ocots Aug 11, 2025
93cbf24
debut test solution
ocots Aug 11, 2025
7841473
fix trapeze
ocots Aug 11, 2025
607ce10
fix trapeze
ocots Aug 11, 2025
3379e12
final?
ocots Aug 11, 2025
b1db5f0
all tests
ocots Aug 11, 2025
bdb2fc6
add pdf fig
ocots Aug 11, 2025
1e7c78b
fix
ocots Aug 11, 2025
f3f8550
test quick
ocots Aug 11, 2025
8d428be
all tests
ocots Aug 11, 2025
605c194
try L1 norm on control: bioreactor
ocots Aug 11, 2025
0cea014
test moonlander
ocots Aug 11, 2025
7fd134f
change init tf moonlander
ocots Aug 11, 2025
26b035a
add constraint on tf moonlander
ocots Aug 11, 2025
ef41cc9
all tests
ocots Aug 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions available_problems_cache.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
beam
bioreactor
dielectrophoretic_particle
insurance
jackson
robbins
rocket
4 changes: 2 additions & 2 deletions ext/JuMPModels/glider.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function OptimalControlProblems.glider(::JuMPBackend; nh::Int64=100)
@variables(
model,
begin
0 <= t_f, (start = 1.0)
0 <= tf, (start = 1.0)
0.0 <= x[k=0:nh], (start = x_0 + vx_0 * (k / nh))
y[k=0:nh], (start = y_0 + (k / nh) * (y_f - y_0))
0.0 <= vx[k=0:nh], (start = vx_0)
Expand All @@ -44,7 +44,7 @@ function OptimalControlProblems.glider(::JuMPBackend; nh::Int64=100)
@expressions(
model,
begin
step, t_f / nh
step, tf / nh
r[i=0:nh], (x[i] / r_0 - 2.5)^2
u[i=0:nh], u_c * (1 - r[i]) * exp(-r[i])
w[i=0:nh], vy[i] - u[i]
Expand Down
28 changes: 17 additions & 11 deletions ext/JuMPModels/steering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ function OptimalControlProblems.steering(::JuMPBackend; nh::Int64=100)
model = JuMP.Model()

@variable(model, u_min <= u[i=1:(nh + 1)] <= u_max, start = 0.0) # control
@variable(model, x[i=1:(nh + 1), j=1:4], start = gen_x0(i, j)) # state
@variable(model, tf, start = 1.0) # final time
@variable(model, x1[i=1:(nh + 1)], start = gen_x0(i, 1)) # state x1
@variable(model, x2[i=1:(nh + 1)], start = gen_x0(i, 2)) # state x2
@variable(model, x3[i=1:(nh + 1)], start = gen_x0(i, 3)) # state x3
@variable(model, x4[i=1:(nh + 1)], start = gen_x0(i, 4)) # state x4
@variable(model, tf, start = 1.0) # final time

@expression(model, h, tf / nh) # step size
@objective(model, Min, tf)
Expand All @@ -35,18 +38,21 @@ function OptimalControlProblems.steering(::JuMPBackend; nh::Int64=100)
@constraints(
model,
begin
con_x1[i=1:nh], x[i + 1, 1] == x[i, 1] + 0.5 * h * (x[i, 3] + x[i + 1, 3])
con_x2[i=1:nh], x[i + 1, 2] == x[i, 2] + 0.5 * h * (x[i, 4] + x[i + 1, 4])
con_x3[i=1:nh],
x[i + 1, 3] == x[i, 3] + 0.5 * h * (a * cos(u[i]) + a * cos(u[i + 1]))
con_x4[i=1:nh],
x[i + 1, 4] == x[i, 4] + 0.5 * h * (a * sin(u[i]) + a * sin(u[i + 1]))
con_x1[i=1:nh], x1[i + 1] == x1[i] + 0.5 * h * (x3[i] + x3[i + 1])
con_x2[i=1:nh], x2[i + 1] == x2[i] + 0.5 * h * (x4[i] + x4[i + 1])
con_x3[i=1:nh], x3[i + 1] == x3[i] + 0.5 * h * (a * cos(u[i]) + a * cos(u[i + 1]))
con_x4[i=1:nh], x4[i + 1] == x4[i] + 0.5 * h * (a * sin(u[i]) + a * sin(u[i + 1]))
end
)

# Boundary conditions
@constraint(model, [j = 1:4], x[1, j] == xs[j])
@constraint(model, [j = 2:4], x[nh + 1, j] == xf[j])
@constraint(model, x1[1] == xs[1])
@constraint(model, x2[1] == xs[2])
@constraint(model, x3[1] == xs[3])
@constraint(model, x4[1] == xs[4])
@constraint(model, x2[nh + 1] == xf[2])
@constraint(model, x3[nh + 1] == xf[3])
@constraint(model, x4[nh + 1] == xf[4])

return model
end
end
12 changes: 11 additions & 1 deletion ext/MetaData/beam.jl
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
beam_meta = Dict(:name => "beam", :nh => 100, :nvar => 404, :ncon => 305, :minimize => true)
beam_meta = Dict(
:name => "beam",
:nh => 100,
:nvar => 404,
:ncon => 305,
:minimize => true,
:state_name => ["x1", "x2"],
:costate_name => ["con_x1", "con_x2"],
:control_name => ["u"],
:time => ("final_time", "tf", 1.0)
)
12 changes: 10 additions & 2 deletions ext/MetaData/bioreactor.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
bioreactor_meta = Dict(
:name => "bioreactor", :nh => 100, :nvar => 505, :ncon => 404, :minimize => false
)
:name => "bioreactor",
:nh => 100,
:nvar => 505,
:ncon => 404,
:minimize => false,
:state_name => ["y", "s", "b"],
:costate_name => ["con_y", "con_s", "con_b"],
:control_name => ["u"],
:time => ("final_time", "T", 300.0) # T = 10 * N where N = 30 by default
)
12 changes: 10 additions & 2 deletions ext/MetaData/cart_pendulum.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
cart_pendulum_meta = Dict(
:name => "cart_pendulum", :nh => 100, :nvar => 507, :ncon => 405, :minimize => true
)
:name => "cart_pendulum",
:nh => 100,
:nvar => 507,
:ncon => 405,
:minimize => true,
:state_name => ["x", "dx", "theta", "omega"],
:costate_name => ["d_x", "d_dx", "d_theta", "d_omega"],
:control_name => "Fex",
:time => ("final_time", "tf", nothing)
)
12 changes: 10 additions & 2 deletions ext/MetaData/chain.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
chain_meta = Dict(
:name => "chain", :nh => 100, :nvar => 404, :ncon => 305, :minimize => true
)
:name => "chain",
:nh => 100,
:nvar => 404,
:ncon => 305,
:minimize => true,
:state_name => ["x1", "x2", "x3"],
:costate_name => ["con_x1", "con_x2", "con_x3"],
:control_name => ["u"],
:time => ("final_time", "tf", 1.0)
)
6 changes: 5 additions & 1 deletion ext/MetaData/dielectrophoretic_particle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ dielectrophoretic_particle_meta = Dict(
:nvar => 304,
:ncon => 203,
:minimize => true,
)
:state_name => ["x", "y"],
:costate_name => ["con_x", "con_y"],
:control_name => "u",
:time => ("final_time", "tf", nothing)
)
8 changes: 6 additions & 2 deletions ext/MetaData/double_oscillator.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
double_oscillator_meta = Dict(
:name => "double_oscillator",
:nh => nothing,
:nh => 100, #:nh => nothing,
:nvar => nothing,
:ncon => nothing,
:minimize => true,
)
:state_name => ["x1", "x2", "x3", "x4"],
:costate_name => ["con_x1", "con_x2", "con_x3", "con_x4"],
:control_name => "u",
:time => ("final_time", "tf", 2π)
)
8 changes: 6 additions & 2 deletions ext/MetaData/ducted_fan.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
ducted_fan_meta = Dict(
:name => "ducted_fan",
:nh => nothing,
:nh => 100, # :nh => nothing,
:nvar => nothing,
:ncon => nothing,
:minimize => true,
)
:state_name => ["x1", "v1", "x2", "v2", "α", "vα"],
:costate_name => ["con_x1", "con_v1", "con_x2", "con_v2", "con_α", "con_vα"],
:control_name => ["u1", "u2"],
:time => ("final_time", "tf", nothing)
)
8 changes: 6 additions & 2 deletions ext/MetaData/electrical_vehicle.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
electrical_vehicle_meta = Dict(
:name => "electrical_vehicle",
:nh => nothing,
:nh => 100, #:nh => nothing,
:nvar => nothing,
:ncon => nothing,
:minimize => true,
)
:state_name => ["x", "v"],
:costate_name => ["cond_x", "cond_v"],
:control_name => "u",
:time => ("final_time", "tf", 1.0)
)
12 changes: 10 additions & 2 deletions ext/MetaData/glider.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
glider_meta = Dict(
:name => "glider", :nh => 100, :nvar => 506, :ncon => 407, :minimize => false
)
:name => "glider",
:nh => 100,
:nvar => 506,
:ncon => 407,
:minimize => false,
:state_name => ["x", "y", "vx", "vy"],
:costate_name => ["x_eqn", "y_eqn", "vx_eqn", "vy_eqn"],
:control_name => "cL",
:time => ("final_time", "tf", nothing)
)
12 changes: 10 additions & 2 deletions ext/MetaData/insurance.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
insurance_meta = Dict(
:name => "insurance", :nh => 100, :nvar => 910, :ncon => 809, :minimize => false
)
:name => "insurance",
:nh => 100, #:nh => nothing,
:nvar => nothing,
:ncon => nothing,
:minimize => false,
:state_name => ["I", "m", "x3"],
:costate_name => ["con_dI", "con_dm", "con_dx3"],
:control_name => ["h", "R", "H", "U", "dUdR"],
:time => ("final_time", "tf", 10)
)
12 changes: 10 additions & 2 deletions ext/MetaData/jackson.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
jackson_meta = Dict(
:name => "jackson", :nh => 100, :nvar => 404, :ncon => 303, :minimize => false
)
:name => "jackson",
:nh => 100,
:nvar => 404,
:ncon => 303,
:minimize => false,
:state_name => ["a", "b", "x3"],
:costate_name => ["con_da", "con_db", "con_dx3"],
:control_name => ["u"],
:time => ("final_time", "tf", 4.0)
)
12 changes: 10 additions & 2 deletions ext/MetaData/moonlander.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
moonlander_meta = Dict(
:name => "moonlander", :nh => 100, :nvar => 610, :ncon => 809, :minimize => true
)
:name => "moonlander",
:nh => 100,
:nvar => 610,
:ncon => 809,
:minimize => true,
:state_name => ["p1", "p2", "dp1", "dp2", "theta", "dtheta"],
:costate_name => ["d_p1", "d_p2", "d_dp1", "d_dp2", "d_theta", "d_dtheta"],
:control_name => ["F1", "F2"],
:time => ("final_time", "tf", nothing)
)
8 changes: 6 additions & 2 deletions ext/MetaData/quadrotor.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
quadrotor_meta = Dict(
:name => "quadrotor",
:nh => nothing,
:nh => 60, #:nh => nothing,
:nvar => nothing,
:ncon => nothing,
:minimize => true,
)
:state_name => ["p1", "p2", "p3", "v1", "v2", "v3"],
:costate_name => ["d_p1", "d_p2", "d_p3", "d_v1", "d_v2", "d_v3"],
:control_name => ["at", "ϕ", "θ", "ψ"],
:time => ("final_time", "tf", nothing)
)
12 changes: 10 additions & 2 deletions ext/MetaData/robbins.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
robbins_meta = Dict(
:name => "robbins", :nh => 100, :nvar => 505, :ncon => 407, :minimize => true
)
:name => "robbins",
:nh => 100,
:nvar => 505,
:ncon => 407,
:minimize => true,
:state_name => ["x1", "x2", "x3"],
:costate_name => ["con_x1", "con_x2", "con_dx3"],
:control_name => ["u"],
:time => ("final_time", "tf", 10)
)
12 changes: 10 additions & 2 deletions ext/MetaData/robot.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
robot_meta = Dict(
:name => "robot", :nh => 100, :nvar => 910, :ncon => 612, :minimize => true
)
:name => "robot",
:nh => 100,
:nvar => 910,
:ncon => 612,
:minimize => true,
:state_name => ["rho", "rho_dot", "the", "the_dot", "phi", "phi_dot"],
:costate_name => ["con_rho", "con_rho_dot", "con_the", "con_the_dot", "con_phi", "con_phi_dot"],
:control_name => ["u_rho", "u_the", "u_phi"],
:time => ("final_time", "tf", nothing)
)
12 changes: 10 additions & 2 deletions ext/MetaData/rocket.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
rocket_meta = Dict(
:name => "rocket", :nh => 100, :nvar => 405, :ncon => 304, :minimize => false
)
:name => "rocket",
:nh => 100,
:nvar => 405,
:ncon => 304,
:minimize => false,
:state_name => ["h", "v", "m"],
:costate_name => ["con_dh", "con_dv", "con_dm"],
:control_name => ["T"],
:time => ("step", "step", nothing)
)
8 changes: 6 additions & 2 deletions ext/MetaData/space_shuttle.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
space_shuttle_meta = Dict(
:name => "space_shuttle",
:nh => nothing,
:nh => 503, #:nh => nothing,
:nvar => nothing,
:ncon => nothing,
:minimize => false,
)
:state_name => ["scaled_h", "ϕ", "θ", "scaled_v", "γ", "ψ"],
:costate_name => ["con_dh", "con_dϕ", "con_dθ", "con_dv", "con_dγ", "con_dψ"],
:control_name => ["α", "β"],
:time => ("step", "Δt", nothing)
)
12 changes: 10 additions & 2 deletions ext/MetaData/steering.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
steering_meta = Dict(
:name => "steering", :nh => 100, :nvar => 506, :ncon => 408, :minimize => true
)
:name => "steering",
:nh => 100,
:nvar => 506,
:ncon => 408,
:minimize => true,
:state_name => ["x1", "x2", "x3", "x4"],
:costate_name => ["con_x1", "con_x2", "con_x3", "con_x4"],
:control_name => "u",
:time => ("final_time", "tf", nothing)
)
12 changes: 10 additions & 2 deletions ext/MetaData/truck_trailer.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
truck_trailer_meta = Dict(
:name => "truck", :nh => nothing, :nvar => nothing, :ncon => nothing, :minimize => true
)
:name => "truck_trailer",
:nh => 100, #:nh => nothing,
:nvar => nothing,
:ncon => nothing,
:minimize => true,
:state_name => ["x2", "y2", "theta2", "theta1", "theta0"],
:costate_name => ["d_x2", "d_y2", "d_theta2", "d_theta1", "d_theta0"],
:control_name => ["v0", "delta0"],
:time => ("final_time", "tf", nothing)
)
12 changes: 10 additions & 2 deletions ext/MetaData/vanderpol.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
vanderpol_meta = Dict(
:name => "vanderpol", :nh => 100, :nvar => 404, :ncon => 303, :minimize => true
)
:name => "vanderpol",
:nh => 100,
:nvar => 404,
:ncon => 303,
:minimize => true,
:state_name => ["x1", "x2"],
:costate_name => ["con_x1", "con_x2"],
:control_name => "u",
:time => ("final_time", "tf", 2.0)
)
8 changes: 8 additions & 0 deletions src/OptimalControlProblems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ const infos = [
:nvar
:ncon
:minimize
:state_name
:costate_name
:control_name
:time
]

const types = [
Expand All @@ -45,6 +49,10 @@ const types = [
Union{Int,Nothing},
Union{Int,Nothing},
Union{Bool,Nothing},
Union{Vector{String}, String, Nothing},
Union{Vector{String}, String, Nothing},
Union{Vector{String}, String, Nothing},
Union{Tuple{String, String, Union{Real,Nothing}}, Nothing},
]

"""
Expand Down
Loading
Loading