@@ -14,17 +14,20 @@ addprocs(np - 1)
1414 [n for n in names (mod) if isdefined (mod, n)]
1515end
1616
17- const list_problems =
18- setdiff (union (defined_names (ADNLPProblems), defined_names (PureJuMP)), [:PureJuMP , :ADNLPProblems ])
17+ @everywhere const list_problems = setdiff (union (defined_names (ADNLPProblems), defined_names (PureJuMP)), [:PureJuMP , :ADNLPProblems ])
18+
19+ @testset " Test that all problems have a meta" begin
20+ @test sort (list_problems) == sort (Symbol .(OptimizationProblems. meta[! , :name ]))
21+ end
1922
2023# The problems included should be carefully argumented and issues
2124# to create them added.
2225# TODO : tests are limited for JuMP-only problems
23- const list_problems_not_ADNLPProblems =
26+ @everywhere const list_problems_not_ADNLPProblems =
2427 Symbol[:catmix , :gasoil , :glider , :methanol , :minsurf , :pinene , :rocket , :steering , :torsion ]
25- const list_problems_ADNLPProblems = setdiff (list_problems, list_problems_not_ADNLPProblems)
26- const list_problems_not_PureJuMP = Symbol[]
27- const list_problems_PureJuMP = setdiff (list_problems, list_problems_not_PureJuMP)
28+ @everywhere const list_problems_ADNLPProblems = setdiff (list_problems, list_problems_not_ADNLPProblems)
29+ @everywhere const list_problems_not_PureJuMP = Symbol[]
30+ @everywhere const list_problems_PureJuMP = setdiff (list_problems, list_problems_not_PureJuMP)
2831
2932include (" test-defined-problems.jl" )
3033include (" test-utils.jl" )
5760 return ctor (matrix_free = true ; kwargs... )
5861end
5962
63+ include (" test-in-place-residual.jl" )
64+
6065@everywhere function test_one_problem (prob:: Symbol )
6166 pb = string (prob)
6267
7580
7681 nlp_ad = timed_info (" Instantiating $(pb) " , make_nlp, prob)
7782
78- @test nlp_ad. meta. name == pb
83+ @testset " Sanity check (name, obj)" begin
84+ @test nlp_ad. meta. name == pb
85+ @test ! isnothing (obj (nlp_ad, nlp_ad. meta. x0))
86+ end
7987
8088 if pb in meta[(meta. contype .== :quadratic ) .| (meta. contype .== :general ), :name ]
8189 @testset " Test In-place Nonlinear Constraints for AD-$prob " begin
8290 test_in_place_constraints (prob, nlp_ad)
8391 end
8492 end
8593
86- @testset " Test multi-precision ADNLPProblems for $prob " begin
87- test_multi_precision (prob, nlp_ad)
88- end
89-
90- if pb in meta[meta. objtype .== :least_squares , :name ]
91- @testset " Test Nonlinear Least Squares for $prob " begin
92- test_in_place_residual (prob)
94+ if typeof (nlp_ad) <: ADNLPModels.AbstractADNLPModel
95+ @testset " Test multi-precision ADNLPProblems for $prob " begin
96+ test_multi_precision (prob, nlp_ad)
9397 end
9498 end
9599
96- model = begin
97- mod = PureJuMP
98- if isdefined (mod, prob)
99- getfield (mod, prob)(n = ndef)
100- else
101- nothing
102- end
103- end
104- if ! isnothing (model)
100+ if mod in intersect (list_problems_PureJuMP, list_problems_ADNLPProblems)
105101 @testset " Test problems compatibility for $prob " begin
106- nlp_jump = MathOptNLPModel (model )
102+ nlp_jump = make_jump_nlp (prob; n = ndef )
107103 test_compatibility (prob, nlp_jump, nlp_ad, ndef)
108104 end
109105 end
0 commit comments