src.environment.problem.MOO.MOO_synthetic.dtlz_numpy

Module Contents

Classes

DTLZ

Introduction

The DTLZ class represents a numpy-based family of multi-objective optimization problems commonly used in benchmarking optimization algorithms. These problems are designed to evaluate the performance of algorithms in handling trade-offs between multiple conflicting objectives. The class provides a flexible implementation of the DTLZ problem suite, allowing users to specify the number of variables, objectives, and other parameters.

DTLZ1

Introduction

DTLZ1 is a scalable benchmark problem in multi-objective optimization, designed to evaluate an algorithm’s ability to converge to and maintain a diverse set of solutions along a linear Pareto front.

DTLZ2

Introduction

DTLZ2 is a scalable benchmark problem in multi-objective optimization. It is designed to test an algorithm’s ability to maintain a uniform distribution of solutions on a spherical Pareto front.

DTLZ3

Introduction

DTLZ3 is a scalable benchmark problem in multi-objective optimization. It is designed to test an algorithm’s ability to maintain convergence and diversity in the presence of many local Pareto-optimal fronts.

DTLZ4

Introduction

DTLZ4 is a benchmark problem in multi-objective optimization that introduces a parameterized distortion to bias the distribution of solutions along the Pareto front, challenging the diversity maintenance of optimization algorithms.

DTLZ5

Introduction

DTLZ5 is a benchmark problem in multi-objective optimization that introduces a non-linear transformation of the decision variables to reduce the dimensionality of the objective space, thereby increasing the difficulty for algorithms to maintain diversity.

DTLZ6

Introduction

DTLZ6 is a benchmark problem in multi-objective optimization with a deceptive Pareto-optimal front, designed to test the convergence and diversity capabilities of algorithms under non-uniform mappings.

DTLZ7

Functions

crtup

Introduction

Generates a set of uniformly distributed reference points (weight vectors) for a given number of objectives. This function is typically used in multi-objective optimization algorithms such as NSGA-III and RVEA, where reference points are required to guide the selection process.

crtgp

Introduction

Generate a set of evenly distributed grid points in a unit hypercube of specified dimension.

This function tries to generate at most N points that are uniformly spread in a dim-dimensional unit cube [0,1]^dim by using a Cartesian grid (meshgrid) approach.

API

src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.crtup(n_obj, n_ref_points=1000)[source]

Introduction

Generates a set of uniformly distributed reference points (weight vectors) for a given number of objectives. This function is typically used in multi-objective optimization algorithms such as NSGA-III and RVEA, where reference points are required to guide the selection process.

Args:

  • n_obj (int): Number of objectives (i.e., the dimensionality of the reference points).

  • n_ref_points (int): Approximate number of desired reference points (default: 1000).

Returns:

  • W (np.ndarray): A 2D array of shape (n_comb, n_obj) representing the generated reference vectors.

  • n_comb (int): Actual number of generated reference vectors.

src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.crtgp(dim, N)[source]

Introduction

Generate a set of evenly distributed grid points in a unit hypercube of specified dimension.

This function tries to generate at most N points that are uniformly spread in a dim-dimensional unit cube [0,1]^dim by using a Cartesian grid (meshgrid) approach.

Args:

  • dim (int): Dimensionality of the grid (number of variables).

  • N (int): Maximum number of grid points to generate.

Returns:

  • grid_points (np.ndarray): A 2D array of shape (total_points, dim) representing the generated grid points.

  • total_points (int): Actual number of points generated (≤ N).

class src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ(n_var, n_obj, k=None, **kwargs)[source]

Bases: src.environment.problem.basic_problem.Basic_Problem

Introduction

The DTLZ class represents a numpy-based family of multi-objective optimization problems commonly used in benchmarking optimization algorithms. These problems are designed to evaluate the performance of algorithms in handling trade-offs between multiple conflicting objectives. The class provides a flexible implementation of the DTLZ problem suite, allowing users to specify the number of variables, objectives, and other parameters.

Original paper

Scalable multi-objective optimization test problems.” Proceedings of the 2002 congress on evolutionary computation. CEC’02 (Cat. No. 02TH8600). Vol. 1. IEEE, 2002.

Official Implementation

pymoo

License

Apache-2.0

Problem Suite Composition

The DTLZ problem suite consists of a set of scalable multi-objective optimization problems. Each problem is parameterized by the number of decision variables (n_var) and the number of objectives (n_obj). The problems are designed to test the scalability and performance of optimization algorithms in high-dimensional objective spaces.

Args:

  • n_var (int): The number of decision variables. If not provided, it is computed using k and n_obj.

  • n_obj (int): The number of objectives.

  • k (int, optional): The number of distance-related variables. If not provided, it is computed using n_var and n_obj.

  • **kwargs: Additional keyword arguments for customization.

Attributes:

  • n_var (int): The number of decision variables.

  • n_obj (int): The number of objectives.

  • k (int): The number of distance-related variables.

  • vtype (type): The type of variables (default is float).

  • lb (numpy.ndarray): The lower bounds of the decision variables.

  • ub (numpy.ndarray): The upper bounds of the decision variables.

Methods:

  • g1(X_M): Computes the g1 function, which is a component of the DTLZ problem.

  • g2(X_M): Computes the g2 function, which is another component of the DTLZ problem.

  • obj_func(X_, g, alpha=1): Computes the objective function values for the given decision variables and g function.

  • __str__(): Returns a string representation of the problem, including the number of objectives and decision variables.

Raises:

  • Exception: Raised if neither n_var nor k is provided during initialization.

Initialization

Introduction

Initializes a specific instance of the DTLZ problem suite.
If k is not provided, it is computed based on the number of decision variables and objectives.

Args:

  • n_var (int): Number of decision variables. If not provided explicitly, will be computed from k and n_obj.

  • n_obj (int): Number of objectives.

  • k (int, optional): Number of distance-related variables. Optional; computed if not given.

  • **kwargs: Additional keyword arguments for extension or metadata (currently unused).

Raises:

  • Exception: If neither n_var nor k is provided.

g1(X_M)[source]

Introduction

Computes the g1 function of the DTLZ problem, which includes a complex multimodal landscape to test algorithm robustness.

Args:

  • X_M (np.ndarray): A 2D numpy array representing the distance-related variables (shape: [n_samples, k]).

Returns:

  • np.ndarray: Computed g1 values for each input vector.

g2(X_M)[source]

Introduction

Computes the g2 function of the DTLZ problem, representing a simpler sphere-like landscape.

Args:

  • X_M (np.ndarray): A 2D numpy array representing the distance-related variables (shape: [n_samples, k]).

Returns:

  • np.ndarray: Computed g2 values for each input vector.

obj_func(X_, g, alpha=1)[source]

Introduction

Computes the multi-objective values for a population of decision variables using the DTLZ objective function formulation.

Args:

  • X_ (np.ndarray): A 2D array of decision variables (shape: [n_samples, n_var - k]).

  • g (np.ndarray): A 1D array of g values (shape: [n_samples, ]) computed by g1 or g2.

  • alpha (float, optional): An exponent applied to the decision variables (default is 1, i.e., linear).

Returns:

  • np.ndarray: A 2D array of shape [n_samples, n_obj], where each row is a vector of objective values.

__str__()[source]

Introduction

Return a string representation of the problem class.

Returns

  • str: A string describing the problem’s name, number of objectives, and variables.

class src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ1(n_var=7, n_obj=3, **kwargs)[source]

Bases: src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ

Introduction

DTLZ1 is a scalable benchmark problem in multi-objective optimization, designed to evaluate an algorithm’s ability to converge to and maintain a diverse set of solutions along a linear Pareto front.

Args:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • **kwargs: Additional keyword arguments passed to the parent class.

Attributes:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • k (int): Number of distance-related variables.

  • lb (np.ndarray): Lower bound of decision variables (all zeros).

  • ub (np.ndarray): Upper bound of decision variables (all ones).

  • vtype (type): Variable type, default is float.

Methods:

  • obj_func(X_, g): Compute objective values given shape-related variables X_ and function g.

  • func(x): Evaluate the full decision vector x and return its objective values.

  • get_ref_set(n_ref_points): Generate a reference Pareto front (true PF) consisting of uniformly spaced points.

Raises:

  • Exception: Raised during parent initialization if neither n_var nor k is properly specified.

Initialization

Introduction

Initialize the DTLZ1 problem instance.

Args:

  • n_var (int): Number of decision variables.Default is 7.

  • n_obj (int): Number of objectives.Default is 3.

  • **kwargs: Additional arguments passed to the parent class.

obj_func(X_, g)[source]

Introduction

Compute the objective function values for the DTLZ1 problem.

Args:

  • X_ (np.ndarray): The shape-related decision variables (first n_obj-1 columns).

  • g (np.ndarray): The distance function value computed from the remaining variables.

Returns:

  • np.ndarray: Objective values for each solution in the population.

func(x, *args, **kwargs)[source]

Introduction

Evaluate the DTLZ1 objective function given a set of decision variables.

Args:

  • x (np.ndarray): Decision variable array, can be 1D or 2D.

Returns:

  • np.ndarray: Evaluated objective values.

get_ref_set(n_ref_points=1000)[source]

Introduction

Generate a reference set of uniformly distributed points on the true Pareto front.

Args:

  • n_ref_points (int): Number of reference points to generate.

Returns:

  • np.ndarray: Reference objective values on the Pareto front.

class src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ2(n_var=10, n_obj=3, **kwargs)[source]

Bases: src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ

Introduction

DTLZ2 is a scalable benchmark problem in multi-objective optimization. It is designed to test an algorithm’s ability to maintain a uniform distribution of solutions on a spherical Pareto front.

Args:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • **kwargs: Additional keyword arguments passed to the parent class.

Attributes:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • k (int): Number of distance-related variables.

  • lb (np.ndarray): Lower bound of decision variables (all zeros).

  • ub (np.ndarray): Upper bound of decision variables (all ones).

  • vtype (type): Variable type, default is float.

Methods:

  • func(x): Evaluate the objective values for input decision vector(s).

  • get_ref_set(n_ref_points): Generate reference points uniformly distributed on the true spherical Pareto front.

Raises:

  • Exception: Raised during parent initialization if parameters are invalid.

Initialization

Introduction

Initialize the DTLZ2 problem instance.

Args:

  • n_var (int): Number of decision variables. Default is 10.

  • n_obj (int): Number of objectives. Default is 3.

  • **kwargs: Additional arguments passed to the parent class.

func(x, *args, **kwargs)[source]

Introduction

Evaluate the DTLZ2 objective function given a set of decision variables.

Args:

  • x (np.ndarray): Decision variable array. Can be 1D or 2D.

Returns:

  • np.ndarray: Evaluated objective values.

get_ref_set(n_ref_points=1000)[source]

Introduction

Generate a reference set of uniformly distributed points on the true spherical Pareto front.

Args:

  • n_ref_points (int): Number of reference points to generate.

Returns:

  • np.ndarray: Reference objective values on the Pareto front.

class src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ3(n_var=10, n_obj=3, **kwargs)[source]

Bases: src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ

Introduction

DTLZ3 is a scalable benchmark problem in multi-objective optimization. It is designed to test an algorithm’s ability to maintain convergence and diversity in the presence of many local Pareto-optimal fronts.

Args:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • **kwargs: Additional keyword arguments passed to the parent class.

Attributes:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • k (int): Number of distance-related variables.

  • lb (np.ndarray): Lower bound of decision variables (all zeros).

  • ub (np.ndarray): Upper bound of decision variables (all ones).

  • vtype (type): Variable type, default is float.

Methods:

  • func(x): Evaluate the objective values for input decision vector(s).

  • get_ref_set(n_ref_points): Generate reference points uniformly distributed on the true spherical Pareto front.

Raises:

  • Exception: Raised during parent initialization if parameters are invalid.

Initialization

Introduction

Initialize the DTLZ3 problem instance.

Args:

  • n_var (int): Number of decision variables. Default is 10.

  • n_obj (int): Number of objectives. Default is 3.

  • **kwargs: Additional arguments passed to the parent class.

func(x, *args, **kwargs)[source]

Introduction

Evaluate the DTLZ3 objective function given a set of decision variables.

Args:

  • x (np.ndarray): Decision variable array. Can be 1D or 2D.

Returns:

  • np.ndarray: Evaluated objective values.

get_ref_set(n_ref_points=1000)[source]

Introduction

Generate a reference set of uniformly distributed points on the true spherical Pareto front.

Args:

  • n_ref_points (int): Number of reference points to generate.

Returns:

  • np.ndarray: Reference objective values on the Pareto front.

class src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ4(n_var=10, n_obj=3, alpha=100, d=100, **kwargs)[source]

Bases: src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ

Introduction

DTLZ4 is a benchmark problem in multi-objective optimization that introduces a parameterized distortion to bias the distribution of solutions along the Pareto front, challenging the diversity maintenance of optimization algorithms.

Args:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • alpha (float): Exponent used to bias the distribution of decision variables. Default is 100.

  • d (int): Number of distance-related variables. Default is 100.

  • **kwargs: Additional keyword arguments passed to the parent class.

Attributes:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • alpha (float): Distribution distortion parameter.

  • d (int): Number of distance-related variables.

  • lb (np.ndarray): Lower bound of decision variables (all zeros).

  • ub (np.ndarray): Upper bound of decision variables (all ones).

  • vtype (type): Variable type, default is float.

Methods:

  • func(x): Evaluate the objective values for input decision vector(s).

  • get_ref_set(n_ref_points): Generate reference points uniformly distributed on the true spherical Pareto front.

Raises:

  • Exception: Raised during parent initialization if parameters are invalid.

Initialization

Introduction

Initialize the DTLZ4 problem instance with the specified number of variables, objectives, and distortion parameters.

Args:

  • n_var (int): Number of decision variables. Default is 10.

  • n_obj (int): Number of objectives. Default is 3.

  • alpha (float): Exponent to control the distribution of solutions. Default is 100.

  • d (int): Number of distance-related variables. Default is 100.

  • **kwargs: Additional arguments passed to the parent class.

func(x, *args, **kwargs)[source]

Introduction

Evaluate the DTLZ4 objective function given a set of decision variables.

Args:

  • x (np.ndarray): Decision variable array. Can be 1D or 2D.

Returns:

  • np.ndarray: Evaluated objective values.

get_ref_set(n_ref_points=1000)[source]

Introduction

Generate a reference set of uniformly distributed points on the true spherical Pareto front.

Args:

  • n_ref_points (int): Number of reference points to generate.

Returns:

  • np.ndarray: Reference objective values on the Pareto front.

class src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ5(n_var=10, n_obj=3, **kwargs)[source]

Bases: src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ

Introduction

DTLZ5 is a benchmark problem in multi-objective optimization that introduces a non-linear transformation of the decision variables to reduce the dimensionality of the objective space, thereby increasing the difficulty for algorithms to maintain diversity.

Args:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • **kwargs: Additional keyword arguments passed to the parent class.

Attributes:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • lb (np.ndarray): Lower bound of decision variables (all zeros).

  • ub (np.ndarray): Upper bound of decision variables (all ones).

  • vtype (type): Variable type, default is float.

Methods:

  • func(x): Evaluate the objective values for input decision vector(s).

  • get_ref_set(n_ref_points): Generate reference points on the true Pareto front with a degenerate shape.

Raises:

  • Exception: Raised during parent initialization if parameters are invalid.

Initialization

Introduction

Initialize the DTLZ5 problem instance with specified variables and objectives.

Args:

  • n_var (int): Number of decision variables. Default is 10.

  • n_obj (int): Number of objectives. Default is 3.

  • **kwargs: Additional arguments passed to the parent class.

func(x, *args, **kwargs)[source]

Introduction

Evaluate the DTLZ5 objective function using transformed decision variables to reduce the effective dimensionality.

Args:

  • x (np.ndarray): Decision variable array. Can be 1D or 2D.

Returns:

  • np.ndarray: Evaluated objective values.

get_ref_set(n_ref_points=1000)[source]

Introduction

Generate a reference set of solutions on the true Pareto front for DTLZ5, which lies on a lower-dimensional manifold.

Args:

  • n_ref_points (int): Number of reference points to generate.

Returns:

  • np.ndarray: Reference objective values on the Pareto front.

class src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ6(n_var=10, n_obj=3, **kwargs)[source]

Bases: src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ

Introduction

DTLZ6 is a benchmark problem in multi-objective optimization with a deceptive Pareto-optimal front, designed to test the convergence and diversity capabilities of algorithms under non-uniform mappings.

Args:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • **kwargs: Additional keyword arguments passed to the parent class.

Attributes:

  • n_var (int): Number of decision variables.

  • n_obj (int): Number of objectives.

  • lb (np.ndarray): Lower bound of decision variables (all zeros).

  • ub (np.ndarray): Upper bound of decision variables (all ones).

  • vtype (type): Variable type, default is float.

Methods:

  • func(x): Evaluate the objective values for input decision vector(s).

  • get_ref_set(n_ref_points): Generate reference points on the true Pareto front.

Raises:

  • Exception: Raised during parent initialization if parameters are invalid.

Initialization

Introduction

Initialize the DTLZ6 problem instance.

Args:

  • n_var (int): Number of decision variables. Default is 10.

  • n_obj (int): Number of objectives. Default is 3.

  • **kwargs: Additional arguments passed to the parent class.

func(x, *args, **kwargs)[source]

Introduction

Evaluate the DTLZ6 objective function with a non-linear transformation and biased distribution.

Args:

  • x (np.ndarray): Decision variable array. Can be 1D or 2D.

Returns:

  • np.ndarray: Evaluated objective values.

get_ref_set(n_ref_points=1000)[source]

Introduction

Generate a reference set of solutions lying on the true Pareto front for DTLZ6.

Args:

  • n_ref_points (int): Number of reference points to generate.

Returns:

  • np.ndarray: Reference objective values on the Pareto front.

class src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ7(n_var=10, n_obj=3, **kwargs)[source]

Bases: src.environment.problem.MOO.MOO_synthetic.dtlz_numpy.DTLZ

func(x, *args, **kwargs)[source]

Introduction

Initialize the DTLZ7 problem instance.

Args:

  • n_var (int): Number of decision variables. Default is 10.

  • n_obj (int): Number of objectives. Default is 3.

  • **kwargs: Additional arguments passed to the parent class.

get_ref_set(n_ref_points=1000)[source]

Introduction

Evaluate the DTLZ7 objective function featuring a disconnected Pareto front.

Args:

  • x (np.ndarray): Decision variable array. Can be 1D or 2D.

Returns:

  • np.ndarray: Evaluated objective values.