evox.algorithms.so.de_variants.jade

Module Contents

Classes

JaDE

Adaptive Differential Evolution (JaDE) algorithm for optimization.

API

class evox.algorithms.so.de_variants.jade.JaDE(pop_size: int, lb: torch.Tensor, ub: torch.Tensor, num_difference_vectors: int = 1, mean: torch.Tensor | None = None, stdev: torch.Tensor | None = None, c: float = 0.1, device: torch.device | None = None)[source]

Bases: evox.core.Algorithm

Adaptive Differential Evolution (JaDE) algorithm for optimization.

Class Methods

  • __init__: Initializes the JaDE algorithm with the given parameters, including population size, bounds, mutation strategy, and other hyperparameters.

  • init_step: Performs the initial evaluation of the population’s fitness and proceeds to the first optimization step.

  • step: Executes a single optimization step of the JaDE algorithm, involving mutation, crossover, selection, and adaptation of strategy parameters.

Note that the evaluate method is not defined in this class. It is expected to be provided by the Problem class or another external component.

Initialization

Initialize the JaDE algorithm with the given parameters.

Parameters:
  • pop_size – The size of the population.

  • lb – The lower bounds of the search space. Must be a 1D tensor.

  • ub – The upper bounds of the search space. Must be a 1D tensor.

  • num_difference_vectors – The number of difference vectors used in mutation. Must be at least 1 and less than half of the population size. Defaults to 1.

  • mean – The mean for initializing the population with a normal distribution. Defaults to None.

  • stdev – The standard deviation for initializing the population with a normal distribution. Defaults to None.

  • device – The device to use for tensor computations (e.g., “cpu” or “cuda”). Defaults to None.

  • c – The learning rate for updating the adaptive parameters F_u and CR_u. Defaults to 0.1.

init_step()[source]

Perform the initial evaluation of the population’s fitness and proceed to the first optimization step.

This method evaluates the fitness of the initial population and then calls the step method to perform the first optimization iteration.

step()[source]

Execute a single optimization step of the JaDE algorithm.

This involves the following sub-steps:

  1. Mutation: Generate mutant vectors by combining difference vectors and adapting the mutation factor F.

  2. Crossover: Perform crossover between the current population and the mutant vectors based on the crossover probability CR.

  3. Selection: Evaluate the fitness of the new population and select the better individuals between the current and new populations.

  4. Adaptation: Update the adaptive parameters F_u and CR_u based on the successful mutations.

_select_rand_pbest_vectors(p: float) torch.Tensor[source]

Select p-best vectors from the population for mutation.

Parameters:

p – Fraction of the population to consider as top-p best. Must be between 0 and 1.

Returns:

A tensor containing selected p-best vectors.