uo.algorithm.metaheuristic.moead package

Submodules

uo.algorithm.metaheuristic.moead.moead_optimizer module

The moead_optimizer module contains class MoeadOptimizer, that represents implementation of the MOEA/D algorithm.

The algorithm decomposes a multi-objective optimization problem into a set of scalar subproblems defined by weight vectors and solves them cooperatively by means of neighborhood-based offspring generation and replacement.

class uo.algorithm.metaheuristic.moead.moead_optimizer.MoeadOptimizer(moead_variation_support: MoeadVariationSupport, population_size: int, neighborhood_size: int, max_number_of_replaced_neighbors: int, finish_control: FinishControl, problem: Problem, solution_template: Solution | None, output_control: OutputControl | None, random_seed: int | None, additional_statistics_control: AdditionalStatisticsControl | None, lattice_parameter_H: int | None = None)

Bases: PopulationBasedMetaheuristic

Implementation of the Multi-Objective Evolutionary Algorithm based on Decomposition (MOEA/D).

copy() MoeadOptimizer

Copy the current object.

Returns:

copied MOEA/D optimizer

Return type:

MoeadOptimizer

property current_population: list[Solution]

Property getter for current population.

property ideal_point: ndarray | None

Property getter for ideal point.

init() None

Initialization of the MOEA/D algorithm.

property lattice_parameter_H: int | None

Property getter for simplex-lattice parameter.

main_loop_iteration() None

One iteration within main loop of the MOEA/D algorithm.

property max_number_of_replaced_neighbors: int

Property getter for maximum number of replaced neighbors.

property moead_variation_support: MoeadVariationSupport

Property getter for variation support.

property neighborhood_size: int

Property getter for neighborhood size.

property nondominated_archive: list[Solution]

Property getter for nondominated archive.

property population_size: int

Property getter for population size.

string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str

String representation of the MOEA/D optimizer.

property weight_setup: WeightSetup | None

Property getter for weight setup.

uo.algorithm.metaheuristic.moead.moead_variation_support module

The moead_variation_support module describes the class MoeadVariationSupport.

class uo.algorithm.metaheuristic.moead.moead_variation_support.MoeadVariationSupport

Bases: Generic[R_co, A_co]

abstract copy()

Copy the current object.

Returns:

new instance with the same properties

Return type:

MoeadVariationSupport

abstract generate_offspring(problem: Problem, parent1: Solution[R_co, A_co], parent2: Solution[R_co, A_co], child: Solution[R_co, A_co], optimizer: PopulationBasedMetaheuristic) None

Generate one offspring from two parents.

Parameters:
Returns:

None

uo.algorithm.metaheuristic.moead.moead_variation_support_real module

The moead_variation_support_real module contains class MoeadVariationSupportReal, that represents variation support for the MOEA/D algorithm where solution representation is real-valued.

class uo.algorithm.metaheuristic.moead.moead_variation_support_real.MoeadVariationSupportReal(crossover_probability: float = 1.0, mutation_probability: float | None = None, eta_c: float = 20.0, eta_m: float = 20.0)

Bases: MoeadVariationSupport[ndarray, A_co]

copy()

Copy the current instance.

Returns:

copied instance

Return type:

MoeadVariationSupportReal

property crossover_probability: float

Property getter for crossover probability.

property eta_c: float

Property getter for SBX distribution index.

property eta_m: float

Property getter for polynomial mutation distribution index.

generate_offspring(problem: Problem, parent1: Solution[ndarray, A_co], parent2: Solution[ndarray, A_co], child: Solution[ndarray, A_co], optimizer: PopulationBasedMetaheuristic) None

Generate one real-valued offspring using SBX and polynomial mutation.

property mutation_probability: float | None

Property getter for mutation probability.

string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str

String representation of the support instance.

uo.algorithm.metaheuristic.moead.moead_variation_support_binary module

The moead_variation_support_binary module contains class MoeadVariationSupportBinary, that represents variation support for the MOEA/D algorithm where solution representation is binary.

class uo.algorithm.metaheuristic.moead.moead_variation_support_binary.MoeadVariationSupportBinary(crossover_probability: float = 0.9, mutation_probability: float | None = None)

Bases: MoeadVariationSupport[ndarray, A_co]

copy()

Copy the current instance.

Returns:

copied instance

Return type:

MoeadVariationSupportBinary

property crossover_probability: float

Property getter for crossover probability.

generate_offspring(problem: Problem, parent1: Solution[ndarray, A_co], parent2: Solution[ndarray, A_co], child: Solution[ndarray, A_co], optimizer: PopulationBasedMetaheuristic) None

Generate one binary offspring using one-point crossover and bit-flip mutation.

property mutation_probability: float | None

Property getter for mutation probability.

string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str

String representation of the support instance.

uo.algorithm.metaheuristic.moead.moead_decomposition module

The moead_decomposition module contains scalarization functions used by the MoeadOptimizer algorithm.

Currently, the module provides Tchebyscheff scalarization.

uo.algorithm.metaheuristic.moead.moead_decomposition.tchebyscheff(F: ndarray, w: ndarray, z: ndarray, eps: float = 1e-12) ndarray

Compute Tchebyscheff scalarization values for objective vectors.

Parameters:
  • F (np.ndarray) – objective matrix of shape (N, M)

  • w (np.ndarray) – weight vector of shape (M,)

  • z (np.ndarray) – ideal point of shape (M,)

  • eps (float) – small positive value used to avoid zero weights

Returns:

scalarization values of shape (N,)

Return type:

np.ndarray

uo.algorithm.metaheuristic.moead.moead_decomposition.tchebyscheff_one(f: ndarray, w: ndarray, z: ndarray, eps: float = 1e-12) float

Compute Tchebyscheff scalarization value for one objective vector.

Parameters:
  • f (np.ndarray) – objective vector of shape (M,)

  • w (np.ndarray) – weight vector of shape (M,)

  • z (np.ndarray) – ideal point of shape (M,)

  • eps (float) – small positive value used to avoid zero weights

Returns:

scalarization value

Return type:

float

uo.algorithm.metaheuristic.moead.moead_weights module

The moead_weights module contains functions for generating MOEA/D weight vectors and their neighborhoods.

class uo.algorithm.metaheuristic.moead.moead_weights.WeightSetup(W: ndarray, B: ndarray)

Bases: object

Container that stores MOEA/D weight vectors and neighborhoods.

Variables:
  • W (np.ndarray) – weight-vector matrix

  • B (np.ndarray) – neighborhood matrix

B: ndarray
W: ndarray
uo.algorithm.metaheuristic.moead.moead_weights.build_weight_setup(n_obj: int, population_size: int | None = None, H: int | None = None, T: int = 20) WeightSetup

Build weight vectors and neighborhoods for MOEA/D.

Parameters:
  • n_obj (int) – number of objectives

  • population_size (int) – number of weight vectors for n_obj == 2

  • H (int) – lattice parameter for n_obj >= 3

  • T (int) – neighborhood size

Returns:

weight setup object

Return type:

WeightSetup

uo.algorithm.metaheuristic.moead.moead_weights.neighborhood_by_euclidean(W: ndarray, T: int) ndarray

Build neighborhood matrix from weight vectors using Euclidean distance.

Parameters:
  • W (np.ndarray) – weight matrix of shape (N, M)

  • T (int) – neighborhood size

Returns:

neighborhood index matrix of shape (N, T)

Return type:

np.ndarray

uo.algorithm.metaheuristic.moead.moead_weights.simplex_lattice_weights(M: int, H: int) ndarray

Generate simplex-lattice design weights.

Parameters:
  • M (int) – number of objectives

  • H (int) – lattice parameter

Returns:

matrix of shape (N, M)

Return type:

np.ndarray

uo.algorithm.metaheuristic.moead.moead_weights.weights_2d_uniform(N: int) ndarray

Generate uniformly distributed 2D weight vectors.

Parameters:

N (int) – number of weight vectors

Returns:

matrix of shape (N, 2)

Return type:

np.ndarray

uo.algorithm.metaheuristic.moead.moead_metrics module

The moead_metrics module contains quality indicators for multi-objective optimization results, including IGD and 2D hypervolume.

uo.algorithm.metaheuristic.moead.moead_metrics.filter_nondominated_points(A: ndarray) ndarray

Return nondominated subset of points for minimization problems.

Parameters:

A (np.ndarray) – objective matrix of shape (N, M)

Returns:

nondominated subset

Return type:

np.ndarray

uo.algorithm.metaheuristic.moead.moead_metrics.hypervolume_2d(A: ndarray, ref_point: tuple[float, float]) float

Compute 2D hypervolume for minimization problems.

Parameters:
  • A (np.ndarray) – objective matrix of shape (N, 2)

  • ref_point (tuple[float, float]) – reference point

Returns:

hypervolume value

Return type:

float

uo.algorithm.metaheuristic.moead.moead_metrics.igd(A: ndarray, Z: ndarray) float

Compute Inverted Generational Distance.

Parameters:
  • A (np.ndarray) – approximation set in objective space of shape (N, M)

  • Z (np.ndarray) – reference set in objective space of shape (K, M)

Returns:

IGD value

Return type:

float

Module contents

The moead package contains implementation of the Multi-Objective Evolutionary Algorithm based on Decomposition (MOEA/D), together with supporting functionality for decomposition, weight-vector generation, variation support, and quality indicators.

class uo.algorithm.metaheuristic.moead.MoeadOptimizer(moead_variation_support: MoeadVariationSupport, population_size: int, neighborhood_size: int, max_number_of_replaced_neighbors: int, finish_control: FinishControl, problem: Problem, solution_template: Solution | None, output_control: OutputControl | None, random_seed: int | None, additional_statistics_control: AdditionalStatisticsControl | None, lattice_parameter_H: int | None = None)

Bases: PopulationBasedMetaheuristic

Implementation of the Multi-Objective Evolutionary Algorithm based on Decomposition (MOEA/D).

copy() MoeadOptimizer

Copy the current object.

Returns:

copied MOEA/D optimizer

Return type:

MoeadOptimizer

property current_population: list[Solution]

Property getter for current population.

property ideal_point: ndarray | None

Property getter for ideal point.

init() None

Initialization of the MOEA/D algorithm.

property lattice_parameter_H: int | None

Property getter for simplex-lattice parameter.

main_loop_iteration() None

One iteration within main loop of the MOEA/D algorithm.

property max_number_of_replaced_neighbors: int

Property getter for maximum number of replaced neighbors.

property moead_variation_support: MoeadVariationSupport

Property getter for variation support.

property neighborhood_size: int

Property getter for neighborhood size.

property nondominated_archive: list[Solution]

Property getter for nondominated archive.

property population_size: int

Property getter for population size.

string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str

String representation of the MOEA/D optimizer.

property weight_setup: WeightSetup | None

Property getter for weight setup.

class uo.algorithm.metaheuristic.moead.MoeadVariationSupport

Bases: Generic[R_co, A_co]

abstract copy()

Copy the current object.

Returns:

new instance with the same properties

Return type:

MoeadVariationSupport

abstract generate_offspring(problem: Problem, parent1: Solution[R_co, A_co], parent2: Solution[R_co, A_co], child: Solution[R_co, A_co], optimizer: PopulationBasedMetaheuristic) None

Generate one offspring from two parents.

Parameters:
Returns:

None

class uo.algorithm.metaheuristic.moead.MoeadVariationSupportBinary(crossover_probability: float = 0.9, mutation_probability: float | None = None)

Bases: MoeadVariationSupport[ndarray, A_co]

copy()

Copy the current instance.

Returns:

copied instance

Return type:

MoeadVariationSupportBinary

property crossover_probability: float

Property getter for crossover probability.

generate_offspring(problem: Problem, parent1: Solution[ndarray, A_co], parent2: Solution[ndarray, A_co], child: Solution[ndarray, A_co], optimizer: PopulationBasedMetaheuristic) None

Generate one binary offspring using one-point crossover and bit-flip mutation.

property mutation_probability: float | None

Property getter for mutation probability.

string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str

String representation of the support instance.

class uo.algorithm.metaheuristic.moead.MoeadVariationSupportReal(crossover_probability: float = 1.0, mutation_probability: float | None = None, eta_c: float = 20.0, eta_m: float = 20.0)

Bases: MoeadVariationSupport[ndarray, A_co]

copy()

Copy the current instance.

Returns:

copied instance

Return type:

MoeadVariationSupportReal

property crossover_probability: float

Property getter for crossover probability.

property eta_c: float

Property getter for SBX distribution index.

property eta_m: float

Property getter for polynomial mutation distribution index.

generate_offspring(problem: Problem, parent1: Solution[ndarray, A_co], parent2: Solution[ndarray, A_co], child: Solution[ndarray, A_co], optimizer: PopulationBasedMetaheuristic) None

Generate one real-valued offspring using SBX and polynomial mutation.

property mutation_probability: float | None

Property getter for mutation probability.

string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str

String representation of the support instance.

class uo.algorithm.metaheuristic.moead.WeightSetup(W: ndarray, B: ndarray)

Bases: object

Container that stores MOEA/D weight vectors and neighborhoods.

Variables:
  • W (np.ndarray) – weight-vector matrix

  • B (np.ndarray) – neighborhood matrix

B: ndarray
W: ndarray
uo.algorithm.metaheuristic.moead.build_weight_setup(n_obj: int, population_size: int | None = None, H: int | None = None, T: int = 20) WeightSetup

Build weight vectors and neighborhoods for MOEA/D.

Parameters:
  • n_obj (int) – number of objectives

  • population_size (int) – number of weight vectors for n_obj == 2

  • H (int) – lattice parameter for n_obj >= 3

  • T (int) – neighborhood size

Returns:

weight setup object

Return type:

WeightSetup

uo.algorithm.metaheuristic.moead.filter_nondominated_points(A: ndarray) ndarray

Return nondominated subset of points for minimization problems.

Parameters:

A (np.ndarray) – objective matrix of shape (N, M)

Returns:

nondominated subset

Return type:

np.ndarray

uo.algorithm.metaheuristic.moead.hypervolume_2d(A: ndarray, ref_point: tuple[float, float]) float

Compute 2D hypervolume for minimization problems.

Parameters:
  • A (np.ndarray) – objective matrix of shape (N, 2)

  • ref_point (tuple[float, float]) – reference point

Returns:

hypervolume value

Return type:

float

uo.algorithm.metaheuristic.moead.igd(A: ndarray, Z: ndarray) float

Compute Inverted Generational Distance.

Parameters:
  • A (np.ndarray) – approximation set in objective space of shape (N, M)

  • Z (np.ndarray) – reference set in objective space of shape (K, M)

Returns:

IGD value

Return type:

float

uo.algorithm.metaheuristic.moead.neighborhood_by_euclidean(W: ndarray, T: int) ndarray

Build neighborhood matrix from weight vectors using Euclidean distance.

Parameters:
  • W (np.ndarray) – weight matrix of shape (N, M)

  • T (int) – neighborhood size

Returns:

neighborhood index matrix of shape (N, T)

Return type:

np.ndarray

uo.algorithm.metaheuristic.moead.simplex_lattice_weights(M: int, H: int) ndarray

Generate simplex-lattice design weights.

Parameters:
  • M (int) – number of objectives

  • H (int) – lattice parameter

Returns:

matrix of shape (N, M)

Return type:

np.ndarray

uo.algorithm.metaheuristic.moead.tchebyscheff(F: ndarray, w: ndarray, z: ndarray, eps: float = 1e-12) ndarray

Compute Tchebyscheff scalarization values for objective vectors.

Parameters:
  • F (np.ndarray) – objective matrix of shape (N, M)

  • w (np.ndarray) – weight vector of shape (M,)

  • z (np.ndarray) – ideal point of shape (M,)

  • eps (float) – small positive value used to avoid zero weights

Returns:

scalarization values of shape (N,)

Return type:

np.ndarray

uo.algorithm.metaheuristic.moead.tchebyscheff_one(f: ndarray, w: ndarray, z: ndarray, eps: float = 1e-12) float

Compute Tchebyscheff scalarization value for one objective vector.

Parameters:
  • f (np.ndarray) – objective vector of shape (M,)

  • w (np.ndarray) – weight vector of shape (M,)

  • z (np.ndarray) – ideal point of shape (M,)

  • eps (float) – small positive value used to avoid zero weights

Returns:

scalarization value

Return type:

float

uo.algorithm.metaheuristic.moead.weights_2d_uniform(N: int) ndarray

Generate uniformly distributed 2D weight vectors.

Parameters:

N (int) – number of weight vectors

Returns:

matrix of shape (N, 2)

Return type:

np.ndarray