Skip to content

Commit ca55db1

Browse files
committed
Updates
1 parent 57c0af0 commit ca55db1

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/Nonlinear/types.jl

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,25 @@ mutable struct NonlinearData <: MOI.AbstractNLPEvaluator
183183
end
184184
end
185185

186+
_bound(s::MOI.LessThan) = MOI.NLPBoundsPair(-Inf, s.upper)
187+
_bound(s::MOI.GreaterThan) = MOI.NLPBoundsPair(s.lower, Inf)
188+
_bound(s::MOI.EqualTo) = MOI.NLPBoundsPair(s.value, s.value)
189+
_bound(s::MOI.Interval) = MOI.NLPBoundsPair(s.lower, s.upper)
190+
191+
"""
192+
MOI.NLPBlockData(data::NonlinearData)
193+
194+
Create an [`MOI.NLPBlockData`](@ref) object from a [`NonlinearData`](@ref)
195+
object.
196+
"""
197+
function MOI.NLPBlockData(data::NonlinearData)
198+
return MOI.NLPBlockData(
199+
[_bound(c.set) for (_, c) in data.constraints],
200+
data,
201+
data.objective !== nothing,
202+
)
203+
end
204+
186205
"""
187206
AbstractAutomaticDifferentiation
188207
@@ -223,16 +242,3 @@ function set_differentiation_backend(
223242
return
224243
end
225244

226-
"""
227-
MOI.NLPBlockData(data::NonlinearData)
228-
229-
Create an [`MOI.NLPBlockData`](@ref) object from a [`NonlinearData`](@ref)
230-
object.
231-
"""
232-
function MOI.NLPBlockData(data::NonlinearData)
233-
return MOI.NLPBlockData(
234-
[_bound(c.set) for (_, c) in data.constraints],
235-
data,
236-
data.objective !== nothing,
237-
)
238-
end

0 commit comments

Comments
 (0)