jmejia8 / Metaheuristics.jl

High-performance metaheuristics for optimization coded purely in Julia.
https://jmejia8.github.io/Metaheuristics.jl/stable/
Other
253 stars 27 forks source link

New method to provide initial solutions #68

Closed jmejia8 closed 1 year ago

jmejia8 commented 1 year ago

Possible implementation: set_inital_solutions

# objective function
f(x) = abs(x[1]) + x[2]  + x[3]^2
# optimizer
algo  = ECA(N = 61)

# one solution
x0 = rand(3)
set_inital_solutions!(algo, x0, f)

# 30 solutions with dim 3
X0 = rand(30, 3)
set_inital_solutions!(algo, X0, f)

# 30 solutions and their fitness
P0 = [ Metaheuristics.create_child(X0[i,:], f(X0[i,:]))  for i in 1:30 ]
set_inital_solutions!(algo, P0)

optimize(f, bounds, ECA)