metaheuristic_designer.encodings.special.PSO_encoding module#

Encoding for Particle Swarm optimization that appends a velocity vector to the genotype.

class PSOEncoding(dimension, base_encoding=None)[source]#

Bases: ParameterExtendingEncoding

Encoding for Particle Swarm optimization that stores a velocity vector.

The genotype is split into the solution vector and a velocity vector of the same dimension. Both are used by the PSO operator.

Parameters:
dimensionint

Number of decision variables.

base_encodingEncoding, optional

Encoding applied to the solution part. Defaults to DefaultEncoding.

Attributes:
params

Access parameter values by attribute-style lookup.

Parameters:
  • dimension (int)

  • base_encoding (Optional[Encoding])

Methods

decode(population_matrix)

Decodes a population matrix into a list/array of solutions.

decode_params(genotype[, copy])

Extract the auxiliary parameter blocks from a genotype matrix.

encode(solution[, params])

Encodes a list of solutions to our problem to an population matrix.

encode_params(param_dict)

Stack a dictionary of parameter arrays into a single matrix.

extract_params(population_matrix)

Return only the auxiliary-parameter part of the genotype matrix.

extract_solution(population_matrix)

Return only the solution part of the genotype matrix.

gather_params()

Overridable thin wrapper around get_params

get_params()

Return a copy of the current parameter dictionary.

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.

get_state