After several years of development, I share with you Metaheuristics.jl
This package implements state-of-the-art metaheuristic algorithms for single and multi-objective optimization. The aim of this package is to provide easy to use (and fast) metaheuristics for numerical global optimization.
Metaheuristics.jl includes:
- Popular algorithms such as Differential Evolution, PSO, NSGA-II, NSGA-III, and moreβ¦
- Performance Indicators such as IGD, hypervolume, among others.
- Test Problems for single and multi-objective optimization.
- Some visualization features in terminal via UnicodePlots.jl
Example 1
Objective function:
julia> f(x) = 10length(x) + sum( x.^2 - 10cos.(2Ο*x) )
f (generic function with 1 method)
Bounds for xβ [-5,5]β΅
:
julia> bounds = [-5ones(5) 5ones(5)]
5Γ2 Matrix{Float64}:
-5.0 5.0
-5.0 5.0
-5.0 5.0
-5.0 5.0
-5.0 5.0
Optimize:
julia> result = optimize(f, bounds)
+=========== RESULT ==========+
iteration: 1429
minimum: 0
minimizer: [1.8792427588475406e-10, 1.6562253377998926e-9, -2.2532566630145983e-9, 1.649414863704028e-9, 4.005275371381464e-9]
f calls: 49981
total time: 0.2483 s
+============================+
Example 2
julia> f, bounds, front = Metaheuristics.TestProblems.ZDT3();
julia> optimize(f, bounds, NSGA2())
+=========== RESULT ==========+
iteration: 500
...
non-dominated solution(s):
F space
ββββββββββββββββββββββββββββββββββββββββββ
2 ββ β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ‘β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ’£β’β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β ²β €β β β β β‘β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
f_2 ββ β β β β β β β β β’β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β β β β β β β β ’β‘β β β β β β β‘β β β β β β β β β β β β β β β β β β β β β β
ββ β β β β β β β β β β β β β β β β β β’±β‘β β β β β β β β β β β β β β β β β β β β β
ββ β β β β β β β β β β β β β β β β β β β »β β β β β β β β’β β β β β β β β β β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β β β β β‘β β β β β β β β β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β’°β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β’β β β
-1 ββ β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββββββββββββββββββββββββββββββββββββββββββ
0 0.9
f_1
f calls: 50000
feasibles: 100 / 100 in final population
total time: 1.4626 s
+============================+
Comments and suggestions are welcome.