Skip to content
Permalink
Browse files

Error on complex values in NLP (#1978)

  • Loading branch information...
odow committed May 29, 2019
1 parent 2201c60 commit 45235ca9dffeda34dff6b7a4eb6a0c08a231a95e
Showing with 12 additions and 3 deletions.
  1. +1 −1 src/parse_nlp.jl
  2. +11 −2 test/nlp.jl
@@ -167,7 +167,7 @@ function _parse_NL_expr(m, x, tapevar, parent, values)

end

function _parse_NL_expr_runtime(m::Model, x::Number, tape, parent, values)
function _parse_NL_expr_runtime(m::Model, x::Real, tape, parent, values)
push!(values, x)
push!(tape, NodeData(VALUE, length(values), parent))
nothing
@@ -619,7 +619,7 @@
evaluator = JuMP.NLPEvaluator(model)
@test !(:Hess in MOI.features_available(evaluator))
end

@testset "Error on using AffExpr in NLexpression" begin
model = Model()
@variable(model, x)
@@ -632,7 +632,7 @@
)
@test_throws expected_exception @NLexpression(model, A)
end

@testset "Error on using QuadExpr in NLexpression" begin
model = Model()
@variable(model, x)
@@ -645,4 +645,13 @@
)
@test_throws expected_exception @NLexpression(model, A)
end
@testset "Error on complex values" begin
model = Model()
@variable(model, x)
c = sqrt(Complex(-1))
expected_exception = ErrorException(
"Unexpected object $c (of type $(typeof(c)) in nonlinear expression."
)
@test_throws expected_exception @NLobjective(model, Min, c * x)
end
end

0 comments on commit 45235ca

Please sign in to comment.
You can’t perform that action at this time.