Skip to content

Commit 1203afa

Browse files
authored
Merge pull request #75 from control-toolbox/74-dev-up-compat
up compat ctbase
2 parents ed639b9 + 5c2f516 commit 1203afa

File tree

6 files changed

+41
-30
lines changed

6 files changed

+41
-30
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ JuMPModels = "JuMP"
1515
OptimalControlModels = "OptimalControl"
1616

1717
[compat]
18-
CTBase = "0.15"
18+
CTBase = "0.16"
1919
JuMP = "1.25"
2020
OptimalControl = "1.0"
2121
julia = "1.10"

docs/src/list_of_problems.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ The table below summarizes the names and status of the each problem:
3737
| glider |||
3838
| insurance |||
3939
| jackson |||
40-
| moonlander || 🟠 |
41-
| quadrotor | 🟠 | 🟠 |
40+
| moonlander || |
41+
| quadrotor | 🟠 | |
4242
| robbins |||
4343
| robot |||
4444
| rocket |||
@@ -54,10 +54,10 @@ The problems are solved with Ipopt and the parameters:
5454
```julia
5555
tol = 1e-8
5656
constr_viol_tol = 1e-6
57-
max_iter = 500
57+
max_iter = 1000
5858
mu_strategy = "adaptive"
5959
linear_solver = "mumps"
60-
max_wall_time = 240.0
60+
max_wall_time = 500
6161
sb = "yes"
6262
```
6363
The symbols in the table means:

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
99

1010
[compat]
1111
Aqua = "0.8"
12-
CTBase = "0.15"
12+
CTBase = "0.16"
1313
Ipopt = "1.9"
1414
JuMP = "1.25"
1515
NLPModelsIpopt = "0.10"

test/runtests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ using OptimalControl
77
using OptimalControlProblems
88
using Test
99

10+
# Parameters
11+
const tol = 1e-6
12+
const mu_strategy = "adaptive"
13+
const sb = "yes"
14+
const constr_viol_tol = 1e-6
15+
const max_iter = 1000
16+
const max_wall_time = 500.0
17+
1018
#
1119
@testset verbose = true showtiming = true "OptimalControlProblems tests" begin
1220
for name in (

test/test_JuMP.jl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,28 @@ function test_JuMP()
1111
all_names,
1212
)
1313

14-
pbs_with_issues = [:cart_pendulum]
14+
pbs_with_issues = [:cart_pendulum, :truck_trailer]
1515
functions_list = setdiff(functions_list, pbs_with_issues)
1616

1717
for f in functions_list
1818
@testset "$(f)" begin
19-
println(" $f")
19+
println(" $f:")
2020
# Set up the model
2121
model = OptimalControlProblems.eval(f)(JuMPBackend())
2222
set_optimizer(model, Ipopt.Optimizer)
2323
set_silent(model)
24-
set_optimizer_attribute(model, "tol", 1e-8)
25-
set_optimizer_attribute(model, "constr_viol_tol", 1e-6)
26-
set_optimizer_attribute(model, "max_iter", 500)
27-
set_optimizer_attribute(model, "mu_strategy", "adaptive")
24+
set_optimizer_attribute(model, "tol", tol)
25+
set_optimizer_attribute(model, "constr_viol_tol", constr_viol_tol)
26+
set_optimizer_attribute(model, "max_iter", max_iter)
27+
set_optimizer_attribute(model, "mu_strategy", mu_strategy)
2828
set_optimizer_attribute(model, "linear_solver", "mumps")
29-
set_optimizer_attribute(model, "max_wall_time", 240.0)
30-
set_optimizer_attribute(model, "sb", "yes")
29+
set_optimizer_attribute(model, "max_wall_time", max_wall_time)
30+
set_optimizer_attribute(model, "sb", sb)
3131
# Solve the model
32-
optimize!(model)
32+
print(" First solve: "); @time optimize!(model)
33+
print(" Second solve: "); @time optimize!(model)
3334
# Test that the solver found an optimal solution
35+
println(" termination_status = $(termination_status(model))\n")
3436
if f == :truck_trailer || f == :quadrotor
3537
@test (termination_status(model) == MOI.LOCALLY_INFEASIBLE) || (termination_status(model) == MOI.ITERATION_LIMIT)
3638
else

test/test_OptimalControl.jl

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,29 @@ function test_OptimalControl()
1111
all_names,
1212
)
1313

14-
pbs_with_issues = [:glider]
14+
pbs_with_issues = [:glider, :moonlander]
1515
functions_list = setdiff(functions_list, pbs_with_issues)
1616

17+
kwargs = Dict(
18+
:print_level => 0,
19+
:tol => tol,
20+
:mu_strategy => mu_strategy,
21+
:sb => sb,
22+
:constr_viol_tol => constr_viol_tol,
23+
:max_iter => max_iter,
24+
:max_wall_time => max_wall_time,
25+
)
26+
1727
for f in functions_list
18-
println(" $f")
28+
println(" $f:")
1929
@testset "$(f)" begin
2030
# Set up the model
2131
_, model = OptimalControlProblems.eval(f)(OptimalControlBackend())
22-
sol = NLPModelsIpopt.ipopt(
23-
model;
24-
print_level=0,
25-
tol=1e-8,
26-
mu_strategy="adaptive",
27-
sb="yes",
28-
constr_viol_tol=1e-6,
29-
max_iter=500,
30-
max_wall_time=240.0,
31-
)
32+
print(" First solve: "); @time sol = NLPModelsIpopt.ipopt(model; kwargs...)
33+
print(" Second solve: "); @time sol = NLPModelsIpopt.ipopt(model; kwargs...)
34+
println(" sol.status = $(sol.status)\n")
3235
# Test that the solver found an optimal solution
33-
if f == :moonlander ||
34-
f == :truck_trailer ||
35-
f == :quadrotor ||
36+
if f == :truck_trailer ||
3637
f == :space_shuttle
3738
@test (sol.status == :infeasible) || (sol.status == :max_iter)
3839
else

0 commit comments

Comments
 (0)