metaheuristic_designer.benchmarks.benchmark_funcs module#

class MaxOnes(dimension, mode='max', constraint_handler=None)[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(population_matrix)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(population_matrix)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class DiophantineEq(dimension, coeff, target, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class SleepTest(dimension, sleep_time=2, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class Sphere(dimension, mode='min', constraint_handler=None)[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class HighCondElliptic(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class BentCigar(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class Discus(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class Rosenbrock(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class Ackley(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class Weierstrass(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class Griewank(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class Rastrigin(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class ModSchwefel(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class Katsuura(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class HappyCat(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class HGBat(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class ExpandedGriewankPlusRosenbrock(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class ExpandedShafferF6(dimension, mode='min')[source]#

Bases: ObjectiveFunc

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class SumPowell(dimension, mode='min', lim_min=-1, lim_max=1)[source]#

Bases: ObjectiveFunc

Sum of Powell function

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

class N4XinSheYang(dimension, mode='min', lim_min=-10, lim_max=10)[source]#

Bases: ObjectiveFunc

N4 Xin-She Yang function

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(solution)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

objective(solution)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.