evox.algorithms.so.de_variants.code

Module Contents

Classes

CoDE

The implementation of CoDE algorithm.

Data

API

evox.algorithms.so.de_variants.code.rand_1_bin

[0, 0, 1, 0]

evox.algorithms.so.de_variants.code.rand_2_bin

[0, 0, 2, 0]

evox.algorithms.so.de_variants.code.current2rand_1

[0, 0, 1, 2]

evox.algorithms.so.de_variants.code.rand2best_2_bin

[0, 1, 2, 0]

evox.algorithms.so.de_variants.code.current2pbest_1_bin

[3, 2, 1, 0]

class evox.algorithms.so.de_variants.code.CoDE(pop_size: int, lb: torch.Tensor, ub: torch.Tensor, diff_padding_num: int = 5, param_pool: torch.Tensor = torch.tensor([[1, 0.1], [1, 0.9], [0.8, 0.2]]), replace: bool = False, device: torch.device | None = None)[source]

Bases: evox.core.Algorithm

The implementation of CoDE algorithm.

Reference: Wang Y, Cai Z, Zhang Q. Differential evolution with composite trial vector generation strategies and control parameters[J]. IEEE transactions on evolutionary computation, 2011, 15(1): 55-66.

Initialization

Initialize the CoDE 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.

  • diff_padding_num – The number of differential padding vectors to use. Defaults to 5.

  • param_pool – A tensor of control parameter pairs for the algorithm. Defaults to a predefined tensor.

  • replace – A boolean indicating whether to replace individuals in the population. Defaults to False.

  • device – The device to use for tensor computations. Defaults to None.

step()[source]

Perform one iteration of the CoDE algorithm.

This step is composed of the following steps:

  1. Generate trial vectors using the differential sum.

  2. Apply crossover to generate a new vector.

  3. Apply mutation to generate a new vector.

  4. Update the population and fitness values.