Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify how we specify the type in AD models #315

Merged
merged 2 commits into from
Oct 25, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions docs/src/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The documentation should be added to the file in the `PureJuMP` folder.
end
```

* Problems modeled with `ADNLPModels` should be type-stable, i.e. they should all have keyword argument `type::Val{T} = Val(Float64)` where `T` is the type of the initial guess and the type used by the `NLPModel` API.
* Problems modeled with `ADNLPModels` should be type-stable, i.e. they should all have keyword argument `type::Type{T} = Float64` where `T` is the type of the initial guess and the type used by the `NLPModel` API.

## Templates for the new functions

Expand Down Expand Up @@ -67,7 +67,7 @@ Next, we describe the `ADNLPProblems` file `function_name.jl`.
```
export function_name

function function_name(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function function_name(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
# define f
# define x0
# nlp = ADNLPModels.ADNLPModel(f, x0, name = "function_name"; kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ nlp_120 = woods(n=120)
```
One of the advantages of these problems is that they are type-stable. Indeed, one can specify the output type with the keyword `type` as follows.
``` @example ex2
nlp16_12 = woods(n=12, type=Val(Float16))
nlp16_12 = woods(n=12, type=Float16)
```
Then, all the API will be compatible with the precised type.
``` @example ex2
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO02.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO02

function AMPGO02(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO02(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
return sin(x[1]) + sin(10 // 3 * x[1])
end
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO03.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO03

function AMPGO03(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO03(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return -(
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO04.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO04

function AMPGO04(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO04(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return -(16 * x[1]^2 - 24 * x[1] + 5) * exp(-x[1])
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO05.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO05

function AMPGO05(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO05(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return -(14 // 10 - 3 * x[1]) * sin(18 * x[1])
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO06.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO06

function AMPGO06(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO06(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return -(x[1] + sin(x[1])) * exp(-x[1]^2)
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO07.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO07

function AMPGO07(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO07(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
return (x[1] <= 0) * convert(eltype(x), Inf) +
sin(x[1]) +
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO08.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO08

function AMPGO08(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO08(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return -(
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO09.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO09

function AMPGO09(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO09(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
return sin(x[1]) + sin(2 // 3 * x[1])
end
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO10.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO10

function AMPGO10(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO10(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return -x[1] * sin(x[1])
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO11.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO11

function AMPGO11(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO11(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return 2 * cos(x[1]) + cos(2 * x[1])
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO12.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO12

function AMPGO12(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO12(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return sin(x[1])^3 + cos(x[1])^3
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO13.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO13

function AMPGO13(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO13(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
# return 0 < x[1] < 1 ? -(x[1]^(2 // 3) + (1 - x[1]^2)^(1 // 3)) : convert(eltype(x), Inf)
return (x[1] ≤ 0) * convert(eltype(x), Inf) + (x[1] ≥ 1) * convert(eltype(x), Inf) -
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO14.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO14

function AMPGO14(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO14(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return -exp(-x[1]) * sin(2 * (pi * x[1]))
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO15.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO15

function AMPGO15(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO15(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return (x[1]^2 - 5 * x[1] + 6) / (x[1]^2 + 1)
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO18.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO18

function AMPGO18(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO18(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
# return x[1] <= 3 ? (x[1] - 2)^2 : log(x[1] - 2) + log(x[1] - 2) + 1
return (x[1] <= 3) * (x[1] - 2)^2 + (x[1] > 3) * (2 * log(abs(x[1] - 2)) + 1)
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO20.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO20

function AMPGO20(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO20(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return -(x[1] - sin(x[1])) * exp(-x[1]^2)
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO21.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO21

function AMPGO21(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO21(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return (x[1] * sin(x[1])) + (x[1] * cos(2 * x[1]))
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/AMPGO22.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AMPGO22

function AMPGO22(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function AMPGO22(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return exp(-3 * x[1]) - sin(x[1])^3
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/BOX2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export BOX2
function BOX2(
args...;
n::Int = default_nvar,
type::Val{T} = Val(Float64),
type::Type{T} = Float64,
m::Int = 10,
kwargs...,
) where {T}
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/BOX3.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export BOX3
function BOX3(
args...;
n::Int = default_nvar,
type::Val{T} = Val(Float64),
type::Type{T} = Float64,
m::Int = 2n,
kwargs...,
) where {T}
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/Dus2_1.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export Dus2_1

function Dus2_1(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function Dus2_1(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return exp(x[1] * (x[1] - 1))
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/Dus2_3.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export Dus2_3

function Dus2_3(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function Dus2_3(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return 1 - (1 / (5 * (x[1]^2) - 6 * x[1] + 5))
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/Dus2_9.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export Dus2_9

function Dus2_9(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function Dus2_9(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return 1 - 12 * x[1] + 15 // 2 * x[1]^2 - x[1]^3
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/Duscube.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export Duscube

function Duscube(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function Duscube(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
n = length(x)
return x[1]^3 - (x[1] - 4)^2 - 100 * x[1]
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/NZF1.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export NZF1

function NZF1(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function NZF1(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
nbis = max(2, div(n, 13))
n = 13 * nbis
function f(x; nbis = nbis, n = n)
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/aircrfta.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export aircrfta

function aircrfta(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function aircrfta(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
return zero(eltype(x))
end
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/allinit.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export allinit

function allinit(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function allinit(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
return x[3] - 1 + x[1]^2 + x[2]^2 + (x[3] + x[4])^2 + sin(x[3])^2 + x[1]^2 * x[2]^2 + x[4] - 3 +
sin(x[3])^2 +
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/allinitc.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export allinitc

function allinitc(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function allinitc(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
return x[3] - 1 + x[1]^2 + x[2]^2 + (x[3] + x[4])^2 + sin(x[3])^2 + x[1]^2 * x[2]^2 + x[4] - 3 +
sin(x[3])^2 +
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/allinitu.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export allinitu

function allinitu(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function allinitu(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
return x[3] - 1 + x[1]^2 + x[2]^2 + (x[3] + x[4])^2 + sin(x[3])^2 + x[1]^2 * x[2]^2 + x[4] - 3 +
sin(x[3])^2 +
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/alsotame.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export alsotame

function alsotame(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function alsotame(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
x, y = x[1], x[2]
return exp(x - 2 * y)
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/argauss.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export argauss

function argauss(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function argauss(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
xinit = T[
0.4
1.0
Expand Down
4 changes: 2 additions & 2 deletions src/ADNLPProblems/arglina.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end
function arglina(
::Val{:nlp};
n::Int = default_nvar,
type::Val{T} = Val(Float64),
type::Type{T} = Float64,
kwargs...,
) where {T}
function f(x; n = length(x))
Expand All @@ -24,7 +24,7 @@ end
function arglina(
::Val{:nls};
n::Int = default_nvar,
type::Val{T} = Val(Float64),
type::Type{T} = Float64,
kwargs...,
) where {T}
function F!(r, x)
Expand Down
4 changes: 2 additions & 2 deletions src/ADNLPProblems/arglinb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end
function arglinb(
::Val{:nlp};
n::Int = default_nvar,
type::Val{T} = Val(Float64),
type::Type{T} = Float64,
kwargs...,
) where {T}
function f(x; n = length(x))
Expand All @@ -23,7 +23,7 @@ end
function arglinb(
::Val{:nls};
n::Int = default_nvar,
type::Val{T} = Val(Float64),
type::Type{T} = Float64,
kwargs...,
) where {T}
function F!(r, x; n = length(x))
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/arglinc.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export arglinc

function arglinc(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function arglinc(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x; n = length(x))
m = 2 * n
sj = sum(j * x[j] for j = 2:(n - 1))
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/argtrig.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export argtrig

function argtrig(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function argtrig(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x; n = length(x))
return n - sum(cos(x[j]) + j * (1 - cos(x[j])) - sin(x[j]) for j = 1:n)
end
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/arwhead.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export arwhead

function arwhead(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function arwhead(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
n < 2 && @warn("arwhead: number of variables must be ≥ 2")
n = max(2, n)
function f(x; n = length(x))
Expand Down
2 changes: 1 addition & 1 deletion src/ADNLPProblems/avion2.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export avion2

function avion2(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function avion2(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
SR,
LR,
Expand Down
4 changes: 2 additions & 2 deletions src/ADNLPProblems/bard.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function bard(; use_nls::Bool = false, kwargs...)
return bard(Val(model); kwargs...)
end

function bard(::Val{:nlp}; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function bard(::Val{:nlp}; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
y = Rational{Int}[0.14 0.18 0.22 0.25 0.29 0.32 0.35 0.39 0.37 0.58 0.73 0.16 1.34 2.10 4.39]
function f(x)
return 1 // 2 * sum(y[i] - (x[1] + i / ((16 - i) * x[2] + min(i, 16 - i) * x[3])) for i = 1:15)
Expand All @@ -14,7 +14,7 @@ function bard(::Val{:nlp}; n::Int = default_nvar, type::Val{T} = Val(Float64), k
return ADNLPModels.ADNLPModel(f, x0, name = "bard"; kwargs...)
end

function bard(::Val{:nls}; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function bard(::Val{:nls}; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
y = Rational{Int}[0.14 0.18 0.22 0.25 0.29 0.32 0.35 0.39 0.37 0.58 0.73 0.16 1.34 2.10 4.39]
function F!(r, x, y = y)
for i = 1:15
Expand Down
4 changes: 2 additions & 2 deletions src/ADNLPProblems/bdqrtic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end
function bdqrtic(
::Val{:nlp};
n::Int = default_nvar,
type::Val{T} = Val(Float64),
type::Type{T} = Float64,
kwargs...,
) where {T}
n < 5 && @warn("bdqrtic: number of variables must be ≥ 5")
Expand All @@ -26,7 +26,7 @@ end
function bdqrtic(
::Val{:nls};
n::Int = default_nvar,
type::Val{T} = Val(Float64),
type::Type{T} = Float64,
kwargs...,
) where {T}
n < 5 && @warn("bdqrtic: number of variables must be ≥ 5")
Expand Down
4 changes: 2 additions & 2 deletions src/ADNLPProblems/beale.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function beale(; use_nls::Bool = false, kwargs...)
return beale(Val(model); kwargs...)
end

function beale(::Val{:nlp}; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function beale(::Val{:nlp}; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function f(x)
return 1 // 2 * (15 // 10 - x[1] * (1 - x[2]))^2 +
1 // 2 * (225 // 100 - x[1] * (1 - x[2]^2))^2 +
Expand All @@ -15,7 +15,7 @@ function beale(::Val{:nlp}; n::Int = default_nvar, type::Val{T} = Val(Float64),
return ADNLPModels.ADNLPModel(f, x0, name = "beale"; kwargs...)
end

function beale(::Val{:nls}; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function beale(::Val{:nls}; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
function F!(r, x)
r[1] = 15 // 10 - x[1] * (1 - x[2])
r[2] = 225 // 100 - x[1] * (1 - x[2]^2)
Expand Down
Loading
Loading