Skip to content

Commit d5779af

Browse files
authored
Update api.jl
close #491
1 parent 9cbe4d8 commit d5779af

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/nlp/api.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,18 @@ function cons!(nlp::AbstractNLPModel, x::AbstractVector, cx::AbstractVector)
5858
@lencheck nlp.meta.nvar x
5959
@lencheck nlp.meta.ncon cx
6060
increment!(nlp, :neval_cons)
61-
nlp.meta.nlin > 0 && cons_lin!(nlp, x, view(cx, nlp.meta.lin))
62-
nlp.meta.nnln > 0 && cons_nln!(nlp, x, view(cx, nlp.meta.nln))
61+
if nlp.meta.nlin > 0
62+
if nlp.meta.nnln > 0
63+
cons_lin!(nlp, x, view(cx, nlp.meta.lin))
64+
cons_nln!(nlp, x, view(cx, nlp.meta.nln))
65+
else
66+
cons_lin!(nlp, x, cx)
67+
end
68+
else
69+
if nlp.meta.nnln > 0
70+
cons_nln!(nlp, x, cx)
71+
end
72+
end
6373
return cx
6474
end
6575

0 commit comments

Comments
 (0)