Skip to content

Commit

Permalink
remove invalid assertion in nlp.jl (#2271)
Browse files Browse the repository at this point in the history
Closes #2115
  • Loading branch information
mlubin authored Jul 11, 2020
1 parent 9aa2bf6 commit a62cc35
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/nlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ function _FunctionStorage(nd::Vector{NodeData}, const_values, num_variables, col
edgelist = compute_hessian_sparsity(nd, adj, linearity, coloring_storage, subexpression_edgelist, subexpression_variables)
hess_I, hess_J, rinfo = Coloring.hessian_color_preprocess(edgelist, num_variables, coloring_storage)
seed_matrix = Coloring.seed_matrix(rinfo)
if linearity[1] == NONLINEAR
@assert length(hess_I) > 0
end
else
hess_I = hess_J = Int[]
rinfo = Coloring.RecoveryInfo()
Expand Down
11 changes: 11 additions & 0 deletions test/nlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,17 @@
@test V == [0.0, 0.0, 1.0]
end

@testset "Constant ifelse (Issue #2115)" begin
model = Model()
@variable(model, x)
@NLobjective(model, Min, ifelse(x >= 1, 1, 0))

d = JuMP.NLPEvaluator(model)
MOI.initialize(d, [:Hess])
hessian_sparsity = MOI.hessian_lagrangian_structure(d)
@test length(hessian_sparsity) == 0
end

@testset "Hessians and Hess-vec" begin
m = Model()
@variable(m, a)
Expand Down

0 comments on commit a62cc35

Please sign in to comment.