Problems
Benchmark Test Problems for numerical optimization.
Metaheuristics.TestProblems.get_problem — Functionget_problem(problem)Returns a 3-tuple with the objective function, the bounds and 100 Pareto solutions for multi-objective optimization problems or the optimal solutions for (box)constrained optimization problems.
Here, problem can be one of the following symbols:
Single-objective:
:sphere:discus:rastrigin
Multi-objective:
:ZDT1:ZDT2:ZDT3:ZDT4:ZDT6
Many-objective:
:DTLZ1:DTLZ2:DTLZ3:DTLZ4:DTLZ5:DTLZ6
Example
julia> import Metaheuristics: TestProblems, optimize
julia> f, bounds, pareto_solutions = TestProblems.get_problem(:ZDT3);
julia> bounds
2×30 Array{Float64,2}:
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 … 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
julia> pareto_solutions
F space
┌────────────────────────────────────────┐
1 │⢅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠈⢢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠙⠒⠀⠀⠀⠀⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠘⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠱⠄⠀⠀⠀⠀⠀⠀⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢱⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
f_2 │⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠬⡦⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠂⠀⠀⠀⠀⠀⠀⢢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢧⡀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡆⠀⠀│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠀⠀│
-1 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
└────────────────────────────────────────┘
0 0.9
f_1
Box-constrained Optimization
Metaheuristics.TestProblems.sphere — Functionsphere(D)The well-known D-dimensional Sphere function.
Metaheuristics.TestProblems.discus — Functiondiscus(D)The well-known D-dimensional Discus function.
Metaheuristics.TestProblems.rastrigin — Functionrastrigin(D)The well-known D-dimensional Rastrigin function.
Constrained Optimization
Constrained test problems used during alpha testing of the package. These are useful for testing constrained optimization algorithms.
Metaheuristics.TestProblems.constrained1 — Functionconstrained1(D = 5)Constrained test problem 1. This is a simple constrained test problem with two constraints defined as:
\[g_1(x) = (x_1 - x_2)^2 - 6 g_2(x) = x_1 + x_2 - 2\]
and the objective function is:
\[f(x) = (x_1 - 1)^2 + (x_2 - 1)^2\]
Metaheuristics.TestProblems.constrained2 — Functionconstrained2(D = 5)Constrained test problem 2. This is a simple constrained test problem with three constraints defined as:
\[g_1(x) = (x_1 - x_2)^2 - 6 g_2(x) = x_1 + x_2 - 2 g_3(x) = x_1 - x_2 - 2 \]
and the objective function is:
\[f(x) = (x_1 - 1)^2 + (x_2 - 1)^2\]
Metaheuristics.TestProblems.constrained3 — Functionconstrained3()Constrained test problem 3. This is a simple constrained test problem only with equality constraints h_i(x) = 0 defined as:
\[h_1(x) = - y_1 + y_2 + y_3 + y_4 - 1 h_2(x) = 2x_1 - y_1 + 2y_2 - 0.5y_3 + y_5 - 1 h_3(x) = 2x_2 + 2y_1 - y_2 - 0.5y_3 + y_6 - 1\]
and the objective function is:
\[f(x) = x_1 + 2x_2 + y_1 + y_2 + 2y_3\]
Multi-objective Optimization
Metaheuristics.TestProblems.ZDT1 — FunctionZDT1(D, n_solutions)ZDT1 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
Dnumber of variables (dimension)n_solutionsnumber of pareto solutions.
Main properties:
- convex
Metaheuristics.TestProblems.ZDT2 — FunctionZDT2(D, n_solutions)ZDT2 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
Dnumber of variables (dimension)n_solutionsnumber of pareto solutions.
Main properties:
- nonconvex
Metaheuristics.TestProblems.ZDT3 — FunctionZDT3(D, n_solutions)ZDT3 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
Dnumber of variables (dimension)n_solutionsnumber of pareto solutions.
Main properties:
- convex disconected
Metaheuristics.TestProblems.ZDT4 — FunctionZDT4(D, n_solutions)ZDT4 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
Dnumber of variables (dimension)n_solutionsnumber of pareto solutions.
Main properties:
- nonconvex
Metaheuristics.TestProblems.ZDT6 — FunctionZDT6(D, n_solutions)ZDT6 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
Dnumber of variables (dimension)n_solutionsnumber of Pareto solutions.
Main properties:
- nonconvex
- non-uniformly spaced
Metaheuristics.TestProblems.DTLZ1 — FunctionDTLZ1(m = 3, ref_dirs = gen_ref_dirs(m, 12))DTLZ1 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
mnumber of objective functionsref_dirsnumber of Pareto solutions (default: Das and Dennis' method).
Main properties:
- convex
- multifrontal
Metaheuristics.TestProblems.DTLZ2 — FunctionDTLZ2(m = 3, ref_dirs = gen_ref_dirs(m, 12))DTLZ2 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
mnumber of objective functionsref_dirsnumber of Pareto solutions (default: Das and Dennis' method).
Main properties:
- nonconvex
- unifrontal
Metaheuristics.TestProblems.DTLZ3 — FunctionDTLZ3(m = 3, ref_dirs = gen_ref_dirs(m, 12))DTLZ3 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
mnumber of objective functionsref_dirsnumber of Pareto solutions (default: Das and Dennis' method).
Main properties:
- nonconvex
- multifrontal
Metaheuristics.TestProblems.DTLZ4 — FunctionDTLZ4(m = 3, ref_dirs = gen_ref_dirs(m, 12))DTLZ4 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
mnumber of objective functionsref_dirsnumber of Pareto solutions (default: Das and Dennis' method).
Main properties:
- nonconvex
- unifrontal
Metaheuristics.TestProblems.DTLZ5 — FunctionDTLZ5(m = 3)DTLZ5 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
mnumber of objective functions
Metaheuristics.TestProblems.DTLZ6 — FunctionDTLZ6(m = 3)DTLZ6 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
mnumber of objective functions
Constrained Multi-objective Optimization
Metaheuristics.TestProblems.C1_DTLZ1 — FunctionC1_DTLZ1(m = 3, ref_dirs = gen_ref_dirs(m, 12))C1_DTLZ1 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
mnumber of objective functionsref_dirsnumber of Pareto solutions (default: Das and Dennis' method).
Main properties:
- convex
- multifrontal
- constraints type 1
Metaheuristics.TestProblems.C1_DTLZ3 — FunctionC1_DTLZ3(m = 3, ref_dirs = gen_ref_dirs(m, 12))DTLZ3 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
mnumber of objective functionsref_dirsnumber of Pareto solutions (default: Das and Dennis' method).
Main properties:
- nonconvex
- multifrontal
- constraints type 1
Metaheuristics.TestProblems.C2_DTLZ2 — FunctionC2_DTLZ2(m = 3, ref_dirs = gen_ref_dirs(m, 12))DTLZ2 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
mnumber of objective functionsref_dirsnumber of Pareto solutions (default: Das and Dennis' method).
Main properties:
- nonconvex
- unifrontal
- contraints type 2
Metaheuristics.TestProblems.C3_DTLZ4 — FunctionC3_DTLZ4(m = 3, ref_dirs = gen_ref_dirs(m, 12))C3_DTLZ4 returns (f::function, bounds::Matrix{Float64}, pareto_set::Array{xFgh_indiv}) where f is the objective function and pareto_set is an array with optimal Pareto solutions with n_solutions.
Parameters
mnumber of objective functionsref_dirsnumber of Pareto solutions (default: Das and Dennis' method).
Main properties:
- nonconvex
- unifrontal
- constraints type 3
Combinatorial Optimization
Metaheuristics.TestProblems.knapsack — Functionknapsack(profit, weight, capacity; encoding=:permutation)Return the Knapsack problem regarding the provided parameters.