metaheuristic_designer.benchmarks.img_funcs module#

class ImgApprox(img_dim, reference, mode=None, img_name='', diff_func='MSE', name=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 ImgEntropy(img_dim, nbins=10, mode=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 ImgStd(img_dim, mode=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.