Skip to content

Commit 249fb6d

Browse files
committed
updating griewank
1 parent 49dc51a commit 249fb6d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/ADNLPProblems/griewank.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
export griewank
22

3-
function griewank(; n::Int = default_nvar, type::Type{T} = Float64, x0::AbstractVector{T} = T[], kwargs...) where {T}
3+
function griewank(; n::Int = default_nvar, type::Type{T} = Float64, x0::Union{Nothing, AbstractVector{T}} = nothing, kwargs...) where {T}
44
function f(x)
55
n = length(x)
66
sum_term = sum(x[i]^2 for i = 1:n) / 4000
77
prod_term = prod(cos(x[i] / sqrt(T(i))) for i = 1:n)
88
return sum_term - prod_term + 1
99
end
10-
x0_local = isempty(x0) ? zeros(T, n) : x0
10+
x0_local = isnothing(x0) ? zeros(T, n) : x0
1111
return ADNLPModels.ADNLPModel(f, x0_local, name = "griewank"; kwargs...)
1212
end

0 commit comments

Comments
 (0)