A Julia package for metaheuristic optimization algorithms. Evolutionary are considered.
Open the Julia REPL and press ]
to open the Pkg prompt. To add this package, use the add command:
pkg> add https://github.com/jmejia8/Metaheuristics.jl.git
- ECA algorithm
- Differential Evolution (DE) algorithm
- Particle swarm optimization (PSO) algorithm
optimize
function is used to optimize a D-dimensional function: optimize(f::Function, bounds::Array, method::AbstractAlgorithm )
f
objective functionbounds
a 2 times D matrix that contains the lower and upper bounds by rows.method
optimization method:ECA
,DE
.
ECA() is a new metaheuristic optimization algorithm based on center of mass. ECA minimizes an objective function read more..
η_max:
stepsize.K:
number of neighbors for generating the center of mass.N:
population size.
using Metaheuristics
# Objective function
sphere(x) = sum(x.^2)
bounds = [-10 -10 -10 -10;
10 10 10 10
]
eca = ECA()
result = optimize(sphere, bounds, eca)
Differential Evolution DE
is a method that optimizes a problem by iteratively trying to improve a candidate solution with regard to a given measure of quality. Read more...
F:
DE-stepsize F_weight from interval [0, 2].N:
Number of population members.CR:
Crossover probability constant from interval [0, 1].strategy:
DE strategy:rand1
DE/rand/1:rand2
DE/rand/2:best1
DE/best/1:best2
DE/best/2:randToBest1
DE/rand-to-best/1
using Metaheuristics
# Objective function
sphere(x) = sum(x.^2)
bounds = [-10 -10 -10 -10;
10 10 10 10
]
de = DE()
result = optimize(sphere, bounds, de)
Particle swarm optimization is a population based stochastic optimization technique developed by Dr. Eberhart and Dr. Kennedy in 1995, inspired by social behavior of bird flocking or fish schooling. Read more...
N:
Number of population members.C1, C2
learning factors (C1 = C2 = 2).ω:
Inertia weight used for balancing the global search.
using Metaheuristics
# Objective function
sphere(x) = sum(x.^2)
bounds = [-10 -10 -10 -10;
10 10 10 10
]
pso = PSO()
result = optimize(sphere, bounds, pso)