Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
NLPModels = "0.14"
NLPModelsModifiers = "0.1"
NLPModels = "0.15"
NLPModelsModifiers = "0.2"
julia = "^1.3.0"
9 changes: 5 additions & 4 deletions src/nlp/problems/brownden.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ export BROWNDEN

Starting point: `[25.0; 5.0; -5.0; -1.0]`
"""
mutable struct BROWNDEN <: AbstractNLPModel
meta :: NLPModelMeta
mutable struct BROWNDEN{T, S} <: AbstractNLPModel{T, S}
meta :: NLPModelMeta{T, S}
counters :: Counters
end

function BROWNDEN()
meta = NLPModelMeta(4, x0=[25.0; 5.0; -5.0; -1.0], name="BROWNDEN_manual", nnzh=10)
function BROWNDEN(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(4, x0=T[25; 5; -5; -1], name="BROWNDEN_manual", nnzh=10)

return BROWNDEN(meta, Counters())
end
BROWNDEN() = BROWNDEN(Float64)

function NLPModels.obj(nlp :: BROWNDEN, x :: AbstractVector{T}) where T
@lencheck 4 x
Expand Down
17 changes: 12 additions & 5 deletions src/nlp/problems/hs10.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,24 @@ export HS10

Starting point: `[-10; 10]`.
"""
mutable struct HS10 <: AbstractNLPModel
meta :: NLPModelMeta
mutable struct HS10{T, S} <: AbstractNLPModel{T, S}
meta :: NLPModelMeta{T, S}
counters :: Counters
end

function HS10()
meta = NLPModelMeta(2, ncon=1, x0=[-10.0; 10.0],
lcon=[0.0], ucon=[Inf], name="HS10_manual")
function HS10(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(
2,
ncon=1,
x0=T[-10; 10],
lcon=T[0],
ucon=T[Inf],
name="HS10_manual",
)

return HS10(meta, Counters())
end
HS10() = HS10(Float64)

function NLPModels.obj(nlp :: HS10, x :: AbstractVector)
@lencheck 2 x
Expand Down
18 changes: 14 additions & 4 deletions src/nlp/problems/hs11.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,26 @@ export HS11

Starting point: `[-4.9; 0.1]`.
"""
mutable struct HS11 <: AbstractNLPModel
meta :: NLPModelMeta
mutable struct HS11{T, S} <: AbstractNLPModel{T, S}
meta :: NLPModelMeta{T, S}
counters :: Counters
end

function HS11()
meta = NLPModelMeta(2, ncon=1, nnzh=2, nnzj=2, x0=[4.9; 0.1], lcon=[-Inf], ucon=[0.0], name="HS11_manual")
function HS11(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(
2,
ncon=1,
nnzh=2,
nnzj=2,
x0=T[4.9; 0.1],
lcon=T[-Inf],
ucon=T[0],
name="HS11_manual",
)

return HS11(meta, Counters())
end
HS11() = HS11(Float64)

function NLPModels.obj(nlp :: HS11, x :: AbstractVector)
@lencheck 2 x
Expand Down
17 changes: 13 additions & 4 deletions src/nlp/problems/hs14.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@ export HS14

Starting point: `[2; 2]`.
"""
mutable struct HS14 <: AbstractNLPModel
meta :: NLPModelMeta
mutable struct HS14{T, S} <: AbstractNLPModel{T, S}
meta :: NLPModelMeta{T, S}
counters :: Counters
end

function HS14()
meta = NLPModelMeta(2, nnzh=2, ncon=2, x0=[2.0; 2.0], lcon=[0.0; 0.0], ucon=[0.0; Inf], name="HS14_manual")
function HS14(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(
2,
nnzh=2,
ncon=2,
x0=T[2; 2],
lcon=T[0; 0],
ucon=T[0; Inf],
name="HS14_manual",
)

return HS14(meta, Counters())
end
HS14() = HS14(Float64)

function NLPModels.obj(nlp :: HS14, x :: AbstractVector)
@lencheck 2 x
Expand Down
15 changes: 11 additions & 4 deletions src/nlp/problems/hs5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@ export HS5

Starting point: `[0.0; 0.0]`.
"""
mutable struct HS5 <: AbstractNLPModel
meta :: NLPModelMeta
mutable struct HS5{T, S} <: AbstractNLPModel{T, S}
meta :: NLPModelMeta{T, S}
counters :: Counters
end

function HS5()
meta = NLPModelMeta(2, x0=zeros(2), lvar=[-1.5; -3.0], uvar=[4.0; 3.0], name="HS5_manual")
function HS5(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(
2,
x0=zeros(T, 2),
lvar=T[-1.5; -3],
uvar=T[4; 3],
name="HS5_manual",
)

return HS5(meta, Counters())
end
HS5() = HS5(Float64)

function NLPModels.obj(nlp :: HS5, x :: AbstractVector)
@lencheck 2 x
Expand Down
18 changes: 14 additions & 4 deletions src/nlp/problems/hs6.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,26 @@ export HS6

Starting point: `[-1.2; 1.0]`.
"""
mutable struct HS6 <: AbstractNLPModel
meta :: NLPModelMeta
mutable struct HS6{T, S} <: AbstractNLPModel{T, S}
meta :: NLPModelMeta{T, S}
counters :: Counters
end

function HS6()
meta = NLPModelMeta(2, ncon=1, nnzh=1, nnzj=2, x0=[-1.2; 1.0], lcon=[0.0], ucon=[0.0], name="HS6_manual")
function HS6(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(
2,
ncon=1,
nnzh=1,
nnzj=2,
x0=T[-1.2; 1],
lcon=T[0],
ucon=T[0],
name="HS6_manual",
)

return HS6(meta, Counters())
end
HS6() = HS6(Float64)

function NLPModels.obj(nlp :: HS6, x :: AbstractVector)
@lencheck 2 x
Expand Down
18 changes: 14 additions & 4 deletions src/nlp/problems/lincon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,26 @@ export LINCON

Starting point: `zeros(15)`.
"""
mutable struct LINCON <: AbstractNLPModel
meta :: NLPModelMeta
mutable struct LINCON{T, S} <: AbstractNLPModel{T, S}
meta :: NLPModelMeta{T, S}
counters :: Counters
end

function LINCON()
meta = NLPModelMeta(15, nnzh=15, nnzj=17, ncon=11, x0=zeros(15), lcon = [22.0; 1.0; -Inf; -11.0; -1.0; 1.0; -5.0; -6.0; -Inf * ones(3)], ucon=[22.0; Inf; 16.0; 9.0; -1.0; 1.0; Inf * ones(2); 1.0; 2.0; 3.0], name="LINCON_manual")
function LINCON(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(
15,
nnzh=15,
nnzj=17,
ncon=11,
x0=zeros(T, 15),
lcon=T[22; 1; -Inf; -11; -1; 1; -5; -6; -Inf * ones(3)],
ucon=T[22; Inf; 16; 9; -1; 1; Inf * ones(2); 1; 2; 3],
name="LINCON_manual",
)

return LINCON(meta, Counters())
end
LINCON() = LINCON(Float64)

function NLPModels.obj(nlp :: LINCON, x :: AbstractVector)
@lencheck 15 x
Expand Down
18 changes: 14 additions & 4 deletions src/nlp/problems/linsv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,26 @@ export LINSV

Starting point: `[0; 0]`.
"""
mutable struct LINSV <: AbstractNLPModel
meta :: NLPModelMeta
mutable struct LINSV{T, S} <: AbstractNLPModel{T, S}
meta :: NLPModelMeta{T, S}
counters :: Counters
end

function LINSV()
meta = NLPModelMeta(2, nnzh=0, nnzj=3, ncon=2, x0=zeros(2), lcon = [3; 1], ucon=[Inf; Inf], name="LINSV_manual")
function LINSV(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(
2,
nnzh=0,
nnzj=3,
ncon=2,
x0=zeros(T, 2),
lcon=T[3; 1],
ucon=T[Inf; Inf],
name="LINSV_manual",
)

return LINSV(meta, Counters())
end
LINSV() = LINSV(Float64)

function NLPModels.obj(nlp :: LINSV, x :: AbstractVector)
@lencheck 2 x
Expand Down
18 changes: 14 additions & 4 deletions src/nlp/problems/mgh01feas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,26 @@ export MGH01Feas

Starting point: `[-1.2; 1]`.
"""
mutable struct MGH01Feas <: AbstractNLPModel
meta :: NLPModelMeta
mutable struct MGH01Feas{T, S} <: AbstractNLPModel{T, S}
meta :: NLPModelMeta{T, S}
counters :: Counters
end

function MGH01Feas()
meta = NLPModelMeta(2, x0=[-1.2; 1.0], name="MGH01Feas_manual", ncon=2, lcon=zeros(2), ucon=zeros(2), nnzj=3, nnzh=1)
function MGH01Feas(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(
2,
x0=T[-1.2; 1.0],
name="MGH01Feas_manual",
ncon=2,
lcon=zeros(T, 2),
ucon=zeros(T, 2),
nnzj=3,
nnzh=1,
)

return MGH01Feas(meta, Counters())
end
MGH01Feas() = MGH01Feas(Float64)

function NLPModels.obj(nlp :: MGH01Feas, x :: AbstractVector)
@lencheck 2 x
Expand Down
21 changes: 15 additions & 6 deletions src/nls/problems/lls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,27 @@ x_2 - 2

Starting point: `[0; 0]`.
"""
mutable struct LLS <: AbstractNLSModel
meta :: NLPModelMeta
nls_meta :: NLSMeta
mutable struct LLS{T, S} <: AbstractNLSModel{T, S}
meta :: NLPModelMeta{T, S}
nls_meta :: NLSMeta{T, S}
counters :: NLSCounters
end

function LLS()
meta = NLPModelMeta(2, x0=zeros(2), name="LLS_manual", ncon=1, lcon=[0.0], ucon=[Inf], nnzj=2)
nls_meta = NLSMeta(3, 2, nnzj=5, nnzh=0)
function LLS(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(
2,
x0=zeros(T, 2),
name="LLS_manual",
ncon=1,
lcon=T[0.0],
ucon=T[Inf],
nnzj=2,
)
nls_meta = NLSMeta{T, Vector{T}}(3, 2, nnzj=5, nnzh=0)

return LLS(meta, nls_meta, NLSCounters())
end
LLS() = LLS(Float64)

function NLPModels.residual!(nls :: LLS, x :: AbstractVector, Fx :: AbstractVector)
@lencheck 2 x
Expand Down
13 changes: 7 additions & 6 deletions src/nls/problems/mgh01.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,19 @@ F(x) = \\begin{bmatrix}

Starting point: `[-1.2; 1]`.
"""
mutable struct MGH01 <: AbstractNLSModel
meta :: NLPModelMeta
nls_meta :: NLSMeta
mutable struct MGH01{T, S} <: AbstractNLSModel{T, S}
meta :: NLPModelMeta{T, S}
nls_meta :: NLSMeta{T, S}
counters :: NLSCounters
end

function MGH01()
meta = NLPModelMeta(2, x0=[-1.2; 1.0], name="MGH01_manual")
nls_meta = NLSMeta(2, 2, nnzj=3, nnzh=1)
function MGH01(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(2, x0=T[-1.2; 1], name="MGH01_manual")
nls_meta = NLSMeta{T, Vector{T}}(2, 2, nnzj=3, nnzh=1)

return MGH01(meta, nls_meta, NLSCounters())
end
MGH01() = MGH01(Float64)

function NLPModels.residual!(nls :: MGH01, x :: AbstractVector, Fx :: AbstractVector)
@lencheck 2 x Fx
Expand Down
23 changes: 17 additions & 6 deletions src/nls/problems/nlshs20.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,29 @@ F(x) = \\begin{bmatrix}

Starting point: `[-2; 1]`.
"""
mutable struct NLSHS20 <: AbstractNLSModel
meta :: NLPModelMeta
nls_meta :: NLSMeta
mutable struct NLSHS20{T, S} <: AbstractNLSModel{T, S}
meta :: NLPModelMeta{T, S}
nls_meta :: NLSMeta{T, S}
counters :: NLSCounters
end

function NLSHS20()
meta = NLPModelMeta(2, x0=[-2.0; 1.0], name="NLSHS20_manual", lvar=[-0.5; -Inf], uvar=[0.5; Inf], ncon=3, lcon=zeros(3), ucon=fill(Inf, 3), nnzj=6)
nls_meta = NLSMeta(2, 2, nnzj=3, nnzh=1)
function NLSHS20(::Type{T}) where T
meta = NLPModelMeta{T, Vector{T}}(
2,
x0=T[-2.0; 1.0],
name="NLSHS20_manual",
lvar=T[-0.5; -Inf],
uvar=T[0.5; Inf],
ncon=3,
lcon=zeros(T, 3),
ucon=fill(T(Inf), 3),
nnzj=6,
)
nls_meta = NLSMeta{T, Vector{T}}(2, 2, nnzj=3, nnzh=1)

return NLSHS20(meta, nls_meta, NLSCounters())
end
NLSHS20() = NLSHS20(Float64)

function NLPModels.residual!(nls :: NLSHS20, x :: AbstractVector, Fx :: AbstractVector)
@lencheck 2 x Fx
Expand Down
Loading