Skip to content

Commit 201fa59

Browse files
authored
Add error in slack model for nonsensical constraints (#125)
* Add error in slack model for nonsensical constraints
1 parent 722d517 commit 201fa59

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/slack-model.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ function slack_meta(meta::AbstractNLPModelMeta{T, S}; name = meta.name * "-slack
131131
x0 = similar(meta.x0, meta.nvar + ns)
132132
x0[1:(meta.nvar)] .= meta.x0
133133
x0[(meta.nvar + 1):end] .= zero(T)
134+
135+
if (length(x0) != length(lvar)) && any((meta.lcon .== -Inf) .& (meta.ucon .== Inf))
136+
throw(error("NLPModels with constraints of the form -∞ ≤ cᵢ(x) ≤ ∞ are not supported by slack models."))
137+
end
138+
134139
return NLPModelMeta{T, S}(
135140
meta.nvar + ns,
136141
x0 = x0,

0 commit comments

Comments
 (0)