1- ndef = OptimizationProblems. default_nvar
2- test_nvar = Int (round (ndef / 2 ))
1+ const ndef = OptimizationProblems. default_nvar
2+ const test_nvar = Int (round (ndef / 2 ))
33meta = OptimizationProblems. meta
44
55# Avoid SparseADJacobian/Hessian for too large problem as it requires a lot of memory for CIs
6- simp_backend = " jacobian_backend = ADNLPModels.ForwardDiffADJacobian, hessian_backend = ADNLPModels.ForwardDiffADHessian"
6+ const simp_backend = " jacobian_backend = ADNLPModels.ForwardDiffADJacobian, hessian_backend = ADNLPModels.ForwardDiffADHessian"
77
8- # list of functions used in unit tests
9-
10- function meta_sanity_check (prob:: Symbol , nlp:: AbstractNLPModel )
8+ @everywhere function meta_sanity_check (prob:: Symbol , nlp:: AbstractNLPModel )
119 meta = OptimizationProblems. eval (Symbol (prob, :_meta ))
1210 getnvar = OptimizationProblems. eval (Symbol (:get_ , prob, :_nvar ))(n = test_nvar)
1311 @test getnvar == meta[:nvar ] || meta[:variable_nvar ]
@@ -29,12 +27,12 @@ function meta_sanity_check(prob::Symbol, nlp::AbstractNLPModel)
2927 @test meta[:has_fixed_variables ] == (get_ifix (nlp) != [])
3028end
3129
32- function test_in_place_constraints (prob:: Symbol )
30+ @everywhere function test_in_place_constraints (prob:: Symbol )
3331 nlp = OptimizationProblems. ADNLPProblems. eval (prob)()
3432 return test_in_place_constraints (prob, nlp)
3533end
3634
37- function test_in_place_constraints (prob:: Symbol , nlp:: AbstractNLPModel )
35+ @everywhere function test_in_place_constraints (prob:: Symbol , nlp:: AbstractNLPModel )
3836 x = get_x0 (nlp)
3937 ncon = nlp. meta. nnln
4038 @test ncon > 0
@@ -47,13 +45,13 @@ function test_in_place_constraints(prob::Symbol, nlp::AbstractNLPModel)
4745 @test ncon == m
4846end
4947
50- function test_in_place_residual (prob:: Symbol )
48+ @everywhere function test_in_place_residual (prob:: Symbol )
5149 nls = OptimizationProblems. ADNLPProblems. eval (prob)(use_nls = true )
5250 @test typeof (nls) <: ADNLPModels.ADNLSModel
5351 return test_in_place_residual (prob, nls)
5452end
5553
56- function test_in_place_residual (prob:: Symbol , nls:: AbstractNLSModel )
54+ @everywhere function test_in_place_residual (prob:: Symbol , nls:: AbstractNLSModel )
5755 x = nls. meta. x0
5856 Fx = similar (x, nls. nls_meta. nequ)
5957 pb = String (prob)
@@ -65,7 +63,7 @@ function test_in_place_residual(prob::Symbol, nls::AbstractNLSModel)
6563 @test nls. nls_meta. nequ == m
6664end
6765
68- function test_compatibility (prob:: Symbol , ndef:: Integer = ndef)
66+ @everywhere function test_compatibility (prob:: Symbol , ndef:: Integer = ndef)
6967 prob_fn = eval (Meta. parse (" PureJuMP.$(prob) " ))
7068 model = prob_fn (n = ndef)
7169 nlp_jump = MathOptNLPModel (model)
@@ -83,7 +81,7 @@ function test_compatibility(prob::Symbol, ndef::Integer = ndef)
8381 return test_compatibility (prob, nlp_jump, nlp_ad, ndef)
8482end
8583
86- function test_compatibility (
84+ @everywhere function test_compatibility (
8785 prob:: Symbol ,
8886 nlp_jump,
8987 nlp_ad:: ADNLPModels.ADModel ,
@@ -126,7 +124,7 @@ function test_compatibility(
126124 meta_sanity_check (prob, nlp_ad)
127125end
128126
129- function test_multi_precision (
127+ @everywhere function test_multi_precision (
130128 prob:: Symbol ,
131129 nlp_ad:: ADNLPModels.ADNLPModel{T} ;
132130 list_types = [Float32, Float64],
@@ -135,7 +133,7 @@ function test_multi_precision(
135133 test_multi_precision (prob, list_types = setdiff (list_types, [T]))
136134end
137135
138- function test_multi_precision (prob:: Symbol ; list_types = [Float32, Float64])
136+ @everywhere function test_multi_precision (prob:: Symbol ; list_types = [Float32, Float64])
139137 nvar = OptimizationProblems. eval (Symbol (:get_ , prob, :_nvar ))()
140138 ncon = OptimizationProblems. eval (Symbol (:get_ , prob, :_ncon ))()
141139
@@ -149,7 +147,7 @@ function test_multi_precision(prob::Symbol; list_types = [Float32, Float64])
149147 end
150148end
151149
152- function test_multi_precision (:: Type{T} , nlp:: AbstractNLPModel ) where {T}
150+ @everywhere function test_multi_precision (:: Type{T} , nlp:: AbstractNLPModel ) where {T}
153151 x0 = get_x0 (nlp)
154152 @test eltype (x0) == T
155153 @test typeof (obj (nlp, x0)) == T
0 commit comments