Evaluation
This file contains a collection of common optimization test functions implemented in Julia to test the performance of the Genetic Algorithm. The functions are based on the paper ON BENCHMARKING FUNCTIONS FOR GENETIC ALGORITHMS.
Evaluation Functions
GeneticAlgorithm.sphere — Functionsphere(x::Vector{<:Number})Compute the sphere function value for a given input vector x.
The sphere function is defined as the sum of the squares of each element in x.
Arguments
x: Input vector.
Returns
- The sphere function value.
GeneticAlgorithm.rosenbrock — Functionrosenbrock(x::Vector{<:Number}; a::Integer, b::Integer)Compute the Rosenbrock function value for a given input vector x.
The Rosenbrock function is a non-convex function used as a performance test problem for optimization algorithms. It is defined as the sum of a series of terms involving the squares of differences between adjacent elements of x.
Arguments
x: Input vector.a: value for the variable ab: value for the variable b
Returns
- The Rosenbrock function value.
GeneticAlgorithm.quartic — Functionquartic(x::AbstractVector{<:Number})Compute the quartic function value for a given input vector x.
The quartic function is defined as the sum of the product of each element in x raised to the power of 4 and its index, plus a random number.
Arguments
x: Input vector.
Returns
- The quartic function value.
GeneticAlgorithm.schwefel — Functionschwefel(x::AbstractVector{<:Number})Compute the Schwefel function value for a given input vector x.
The Schwefel function is a multimodal function used as a performance test problem for optimization algorithms. It is defined as a sum of terms involving the sine function and the square root of the absolute value of each element in x.
Arguments
x: Input vector.
Returns
- The Schwefel function value.
GeneticAlgorithm.rastrigin — Functionrastrigin(x::AbstractVector{<:Number})Compute the Rastrigin function value for a given input vector x.
The Rastrigin function is a multimodal function used as a performance test problem for optimization algorithms. It is defined as a sum of terms involving the square of each element in x, minus 10 times the cosine of 2π times each element in x.
Arguments
x: Input vector.
Returns
- The Rastrigin function value.
GeneticAlgorithm.griewank — Functiongriewank(x::AbstractVector{<:Number})Compute the Griewank function value for a given input vector x.
The Griewank function is a multimodal function used as a performance test problem for optimization algorithms. It is defined as the difference between two terms: the sum of the squares of each element in x divided by 4000, and the product of the cosine of each element in x divided by the square root of its index.
Arguments
x: Input vector.
Returns
- The Griewank function value.
GeneticAlgorithm.binarystring — Functionbinarystring(x::AbstractVector{Bool})Compute the fitness of a binary string unit.
Arguments
x: Input vector.
Returns
- The digit sum of input vector.