Skip to content
Merged
Changes from all commits
Commits
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
51 changes: 22 additions & 29 deletions src/Test/test_nonlinear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,12 @@ function MOI.eval_hessian_lagrangian(d::FeasibilitySenseEvaluator, H, x, σ, μ)
return
end

# Skip for non-Float64 solvers!
_test_HS071(::MOI.ModelLike, ::Config, ::HS071) = nothing

function _test_HS071(
model::MOI.ModelLike,
config::Config{Float64},
config::Config{T},
evaluator::HS071,
)
) where {T}
@requires T == Float64
@requires MOI.supports(model, MOI.NLPBlock())
@requires _supports(config, MOI.optimize!)
@requires MOI.supports_constraint(
Expand Down Expand Up @@ -464,8 +462,9 @@ Test NLPBlockDual.
"""
function test_nonlinear_hs071_NLPBlockDual(
model::MOI.ModelLike,
config::Config{Float64},
)
config::Config{T},
) where {T}
@requires T == Float64
@requires MOI.supports(model, MOI.NLPBlock())
@requires _supports(config, MOI.optimize!)
@requires MOI.supports(model, MOI.VariablePrimalStart(), MOI.VariableIndex)
Expand Down Expand Up @@ -513,9 +512,6 @@ function test_nonlinear_hs071_NLPBlockDual(
return
end

# Skip for non-Float64 solvers
test_nonlinear_hs071_NLPBlockDual(::MOI.ModelLike, ::Config) = nothing

function setup_test(
::typeof(test_nonlinear_hs071_NLPBlockDual),
model::MOIU.MockOptimizer,
Expand Down Expand Up @@ -571,8 +567,9 @@ Test that nonlinear objectives take precedence over MOI.ObjectiveFunction.
"""
function test_nonlinear_objective_and_moi_objective_test(
model::MOI.ModelLike,
config::Config{Float64},
)
config::Config{T},
) where {T}
@requires T == Float64
@requires MOI.supports(model, MOI.NLPBlock())
@requires _supports(config, MOI.optimize!)
@requires MOI.supports(model, MOI.VariablePrimalStart(), MOI.VariableIndex)
Expand Down Expand Up @@ -602,13 +599,6 @@ function test_nonlinear_objective_and_moi_objective_test(
return
end

function test_nonlinear_objective_and_moi_objective_test(
::MOI.ModelLike,
::Config,
)
return
end

function setup_test(
::typeof(test_nonlinear_objective_and_moi_objective_test),
model::MOIU.MockOptimizer,
Expand All @@ -635,7 +625,11 @@ end

Test a nonlinear objective only.
"""
function test_nonlinear_objective(model::MOI.ModelLike, config::Config{Float64})
function test_nonlinear_objective(
model::MOI.ModelLike,
config::Config{T},
) where {T}
@requires T == Float64
@requires MOI.supports(model, MOI.NLPBlock())
@requires _supports(config, MOI.optimize!)
@requires MOI.supports(model, MOI.VariablePrimalStart(), MOI.VariableIndex)
Expand All @@ -662,8 +656,6 @@ function test_nonlinear_objective(model::MOI.ModelLike, config::Config{Float64})
return
end

test_nonlinear_objective(::MOI.ModelLike, ::Config) = nothing

function setup_test(
::typeof(test_nonlinear_objective),
model::MOIU.MockOptimizer,
Expand Down Expand Up @@ -692,8 +684,9 @@ Test a nonlinear problem without an objective.
"""
function test_nonlinear_without_objective(
model::MOI.ModelLike,
config::Config{Float64},
)
config::Config{T},
) where {T}
@requires T == Float64
@requires MOI.supports(model, MOI.NLPBlock())
@requires _supports(config, MOI.optimize!)
@requires MOI.supports(model, MOI.VariablePrimalStart(), MOI.VariableIndex)
Expand All @@ -719,8 +712,6 @@ function test_nonlinear_without_objective(
return
end

test_nonlinear_without_objective(::MOI.ModelLike, ::Config) = nothing

function setup_test(
::typeof(test_nonlinear_without_objective),
model::MOIU.MockOptimizer,
Expand Down Expand Up @@ -1085,7 +1076,11 @@ end
Test that a nonlinear model returns the TerminationStatus `INVALID_MODEL` if a
NaN is detected in a function evaluation.
"""
function test_nonlinear_invalid(model::MOI.ModelLike, config::Config{Float64})
function test_nonlinear_invalid(
model::MOI.ModelLike,
config::Config{T},
) where {T}
@requires T == Float64
@requires MOI.supports(model, MOI.NLPBlock())
@requires _supports(config, MOI.optimize!)
MOI.add_variable(model)
Expand All @@ -1100,8 +1095,6 @@ function test_nonlinear_invalid(model::MOI.ModelLike, config::Config{Float64})
return
end

test_nonlinear_invalid(::MOI.ModelLike, ::Config) = nothing

function setup_test(
::typeof(test_nonlinear_invalid),
model::MOIU.MockOptimizer,
Expand Down