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.sphereFunction
sphere(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.
source
GeneticAlgorithm.rosenbrockFunction
rosenbrock(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 a
  • b: value for the variable b

Returns

  • The Rosenbrock function value.
source
GeneticAlgorithm.quarticFunction
quartic(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.
source
GeneticAlgorithm.schwefelFunction
schwefel(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.
source
GeneticAlgorithm.rastriginFunction
rastrigin(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.
source
GeneticAlgorithm.griewankFunction
griewank(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.
source
GeneticAlgorithm.binarystringFunction
binarystring(x::AbstractVector{Bool})

Compute the fitness of a binary string unit.

Arguments

  • x: Input vector.

Returns

  • The digit sum of input vector.
source