Skip to content

Optimization function mutates surrogate struct #380

@vikram-s-narayan

Description

@vikram-s-narayan

The optimization functions in surrogates mutate the surrogate struct.

To reproduce:

using Surrogates

#sphere function
function s(x)
    return sum(x .^ 2)
end

n = 30
d = 3
lb = [-10.0 for i in 1:d]
ub = [10.0 for i in 1:d]
x = sample(n, lb, ub, SobolSample())
y = s.(x)

r = RadialBasis(x, s.(x), lb, ub, rad = linearRadial())

size(r.x) #(30,)
size(r.y) #(30,)

surrogate_optimize(s, SRBF(), lb, ub, r, UniformSample())

size(r.x) #(165,)
size(r.y) #(165,)

Should we be indicating that the function mutates with the ! convention (i.e. surrogate_optimize!(s, SRBF(), lb, ub, r, UniformSample()))?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions