generated from control-toolbox/CTAppTemplate.jl
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathruntests.jl
More file actions
84 lines (75 loc) · 2.75 KB
/
runtests.jl
File metadata and controls
84 lines (75 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using Aqua
using CTBase
using CTDirect
using Ipopt
using JuMP
using NLPModels
using NLPModelsIpopt
using MadNLPMumps
using OptimalControl
using OptimalControlProblems
using Test
using Plots
using Plots.PlotMeasures # for leftmargin, bottommargin
using Printf
using Interpolations
include("utils.jl")
# Parameters for the solvers
const TOL = 1e-8
const MU_STRATEGY = "adaptive"
const SB = "yes"
const MAX_ITER = 1000
const MAX_WALL_TIME = 500.0
# Collect all the problems from OptimalControlProblems
list_of_problems = OptimalControlProblems.problems()
# Remove from the tests the following problems
problems_to_exclude = [
# :bioreactor, # no need to remove here since already removed in OptimalControlProblems.jl
# :cart_pendulum, # no need to remove here since already removed in OptimalControlProblems.jl
# :dielectrophoretic_particle, # no need to remove here since already removed in OptimalControlProblems.jl
# :moonlander, # no need to remove here since already removed in OptimalControlProblems.jl
:ducted_fan,
:insurance,
:robot,
:space_shuttle,
]
list_of_problems = setdiff(list_of_problems, problems_to_exclude)
# list_of_problems = [
# :jackson,
# ]
# The list of all the problems to test
const LIST_OF_PROBLEMS = deepcopy(list_of_problems)
# The final list of problems for which the tests pass
LIST_OF_PROBLEMS_FINAL = deepcopy(list_of_problems)
# Tests
const DEBUG = true
const VERBOSE = true # print or not details during tests
@testset "OptimalControlProblems tests" verbose=VERBOSE showtiming=true begin
for name in (
#:aqua,
:kwargs,
:JuMP, # convergence tests for JuMP models
:OptimalControl, # convergence tests for OptimalControl models
:OptimalControl_s, # convergence tests for OptimalControl models
:init, # comparison between OptimalControl and JuMP: init
:solution, # comparison between OptimalControl and JuMP: solution
:quick, # quick comparison: objective rel error only
:parameters, # tests with different parameters values, does no depend on `list_of_problems`
)
@testset "$(name)" verbose=VERBOSE begin
test_name = Symbol(:test_, name)
println("Testing: " * string(name))
include("$(test_name).jl")
@eval $test_name()
end
end
# compare the list of problems that passed the tests to the available problems
println("\nProblems that passed the tests: ");
display(LIST_OF_PROBLEMS_FINAL)
println("\nList of available problems: ");
display(problems());
println()
# @testset "available_problems" verbose=VERBOSE begin
# @test LIST_OF_PROBLEMS_FINAL == problems()
# end
end