Skip to content

Commit

Permalink
specify nlpmeta type
Browse files Browse the repository at this point in the history
  • Loading branch information
tmigot committed Apr 30, 2024
1 parent 460cf12 commit 2cb5dbb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/slack-model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The slack variables are implicitly ordered as linear and then nonlinear, and
``c_L ≤ c(x) < ∞``, ``-∞ < c(x) ≤ c_U`` and
``c_L ≤ c(x) ≤ c_U``, respectively.
"""
mutable struct SlackModel{T, S, M <: AbstractNLPModel{T}} <: AbstractNLPModel{T, S}
mutable struct SlackModel{T, S, M <: AbstractNLPModel{T, S}} <: AbstractNLPModel{T, S}
meta::NLPModelMeta{T, S}
model::M

Expand All @@ -90,7 +90,7 @@ end

"""Like `SlackModel`, this model converts inequalities into equalities and bounds.
"""
mutable struct SlackNLSModel{T, S, M <: AbstractNLPModel{T}} <: AbstractNLSModel{T, S}
mutable struct SlackNLSModel{T, S, M <: AbstractNLPModel{T, S}} <: AbstractNLSModel{T, S}
meta::NLPModelMeta{T, S}
nls_meta::NLSMeta{T, S}
model::M
Expand Down Expand Up @@ -131,7 +131,7 @@ function slack_meta(meta::AbstractNLPModelMeta{T, S}; name = meta.name * "-slack
x0 = similar(meta.x0, meta.nvar + ns)
x0[1:(meta.nvar)] .= meta.x0
x0[(meta.nvar + 1):end] .= zero(T)
return NLPModelMeta(
return NLPModelMeta{T, S}(
meta.nvar + ns,
x0 = x0,
lvar = lvar,
Expand Down Expand Up @@ -177,7 +177,7 @@ function SlackNLSModel(
x0 = similar(model.meta.x0, model.meta.nvar + ns)
x0[(model.meta.nvar + 1):end] .= zero(T)
x0[1:(model.meta.nvar)] .= model.meta.x0
nls_meta = NLSMeta{T, typeof(meta.x0)}( # might differ from S
nls_meta = NLSMeta{T, S}(
model.nls_meta.nequ,
model.meta.nvar + ns,
x0 = x0,
Expand Down

0 comments on commit 2cb5dbb

Please sign in to comment.