src.environment.problem.MOO.MOO_synthetic.zdt_numpy¶
Module Contents¶
Classes¶
Introduction¶The |
|
Introduction¶The |
|
Introduction¶The |
|
Introduction¶The |
|
Introduction¶The |
|
Introduction¶The |
|
Introduction¶The |
|
Introduction¶A utility class to normalize data features to the [0, 1] range based on provided lower and upper bounds. Supports cases where bounds may be partially or fully unspecified (NaN), handling normalization accordingly. |
Functions¶
Introduction¶Find the indices of non-dominated solutions in a population. A solution is said to be non-dominated if no other solution in the population dominates it. This function performs a pairwise comparison between all solutions. |
|
Introduction¶Normalize input data |
API¶
- src.environment.problem.MOO.MOO_synthetic.zdt_numpy.find_non_dominated_indices(Point)[source]¶
Introduction¶
Find the indices of non-dominated solutions in a population.
A solution is said to be non-dominated if no other solution in the population dominates it. This function performs a pairwise comparison between all solutions.
Args:¶
Point (np.ndarray): A 2D array of shape (n_points, n_objectives), where each row represents the objective values of a solution.
Returns:¶
non_dominated_indices (np.ndarray): Indices of the non-dominated solutions.
- class src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDT(n_var=30, **kwargs)[source]¶
Bases:
src.environment.problem.basic_problem.Basic_ProblemIntroduction¶
The
ZDTclass represents a numpy-based synthetic multi-objective optimization problem from the ZDT problem suite. These problems are widely used as benchmarks in the field of evolutionary multi-objective optimization.Original paper¶
“Comparison of multiobjective evolutionary algorithms: Empirical results.” Evolutionary computation 8.2 (2000): 173-195.
Official Implementation¶
License¶
Apache-2.0
Problem Suite Composition¶
The ZDT problem suite consists of six benchmark problems (ZDT1 to ZDT6) designed to test the performance of multi-objective optimization algorithms. Each problem has two or three objectives and varying levels of complexity in terms of Pareto front shapes and decision space characteristics.
Args:¶
n_var(int, optional): Number of decision variables. Defaults to 30.**kwargs: Additional keyword arguments for customization.
Attributes:¶
n_var(int): Number of decision variables.n_obj(int): Number of objectives. Defaults to 2.vtype(type): Variable type, set tofloat.lb(numpy.ndarray): Lower bounds of the decision variables, initialized to zeros.ub(numpy.ndarray): Upper bounds of the decision variables, initialized to ones.
Methods:¶
__str__() -> str: Returns a string representation of the problem, including the class name, number of objectives, and number of decision variables.
Raises:¶
No specific exceptions are raised by this class, but errors may occur if the input arguments are invalid or if the methods are used improperly.
Initialization
Introduction¶
Initialize a ZDT problem with specified number of decision variables.
Args¶
n_var (int, optional): Number of decision variables. Default is 30.
**kwargs: Additional keyword arguments for further customization.
- class src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDT1(n_var=30, **kwargs)[source]¶
Bases:
src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDTIntroduction¶
The
ZDT1class represents the first problem in the ZDT benchmark suite. It features a convex Pareto front and is commonly used to evaluate the convergence ability of multi-objective optimization algorithms.Methods¶
func(x): Compute the objective values of ZDT1.
get_ref_set(n_ref_points): Generate a reference Pareto front for ZDT1.
Initialization
Introduction¶
Initialize a ZDT problem with specified number of decision variables.
Args¶
n_var (int, optional): Number of decision variables. Default is 30.
**kwargs: Additional keyword arguments for further customization.
- func(x, *args, **kwargs)[source]¶
Introduction¶
Compute the two objective values of the ZDT1 problem for a given set of decision variable vectors.
Args¶
x (np.ndarray): A 1D or 2D NumPy array representing decision variables. If 1D, it will be reshaped to (1, n_var).
*args: Unused positional arguments.
**kwargs: Unused keyword arguments.
Returns¶
np.ndarray: A 2D NumPy array of shape (n_samples, 2), containing the objective values for each solution.
- get_ref_set(n_ref_points=1000)[source]¶
Introduction¶
Generate the reference Pareto front for ZDT1, which has a convex shape and is analytically defined.
Args¶
n_ref_points (int, optional): Number of points to sample along the Pareto front. Defaults to 1000.
Returns¶
np.ndarray: A 2D NumPy array of shape (n_ref_points, 2), representing the true Pareto front.
- class src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDT2(n_var=30, **kwargs)[source]¶
Bases:
src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDTIntroduction¶
The
ZDT2class represents the second problem in the ZDT benchmark suite. It is characterized by a non-convex Pareto front and is designed to test the ability of optimization algorithms to converge and maintain diversity in non-convex regions.Methods¶
func(x): Compute the objective values of ZDT2.
get_ref_set(n_ref_points): Generate a reference Pareto front for ZDT2.
Initialization
Introduction¶
Initialize a ZDT problem with specified number of decision variables.
Args¶
n_var (int, optional): Number of decision variables. Default is 30.
**kwargs: Additional keyword arguments for further customization.
- func(x, *args, **kwargs)[source]¶
Introduction¶
Compute the two objective values of the ZDT2 problem for a given set of decision variable vectors.
Args¶
x (np.ndarray): A 1D or 2D NumPy array representing decision variables. If 1D, it will be reshaped to (1, n_var).
*args: Unused positional arguments.
**kwargs: Unused keyword arguments.
Returns¶
np.ndarray: A 2D NumPy array of shape (n_samples, 2), containing the objective values for each solution.
- get_ref_set(n_ref_points=1000)[source]¶
Introduction¶
Generate the reference Pareto front for ZDT2, which is known to be non-convex and continuous.
Args¶
n_ref_points (int, optional): Number of points to sample along the Pareto front. Defaults to 1000.
Returns¶
np.ndarray: A 2D NumPy array of shape (n_ref_points, 2), representing the true Pareto front.
- class src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDT3(n_var=30, **kwargs)[source]¶
Bases:
src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDTIntroduction¶
The
ZDT3class represents the third problem in the ZDT multi-objective benchmark suite. This problem features a disconnected Pareto front and is used to evaluate the diversity-preserving ability of algorithms.Args¶
n_var(int, optional): Number of decision variables. Default is 30.**kwargs: Additional keyword arguments for customization.
Attributes¶
n_var(int): Number of decision variables.n_obj(int): Number of objectives, fixed at 2.vtype(type): Variable type, set tofloat.lb(np.ndarray): Lower bounds of the decision variables, set to 0.ub(np.ndarray): Upper bounds of the decision variables, set to 1.
Methods¶
func(x, *args, **kwargs): Computes the objective values for inputx.get_ref_set(n_ref_points=1000): Returns reference Pareto-optimal points for ZDT3.
Initialization
Introduction¶
Initialize a ZDT problem with specified number of decision variables.
Args¶
n_var (int, optional): Number of decision variables. Default is 30.
**kwargs: Additional keyword arguments for further customization.
- func(x, *args, **kwargs)[source]¶
Introduction¶
Evaluate the objective values for the ZDT3 problem. ZDT3 features a multi-modal, non-convex, and discontinuous Pareto front. The objective is to map the decision variables to their respective objective values in the two-objective space.
Args¶
x (np.ndarray): A 1D or 2D numpy array representing the decision variables.
*args: Additional positional arguments (unused).
**kwargs: Additional keyword arguments (unused).
Returns¶
np.ndarray: A 2D array of shape (n_samples, 2) containing the computed objective values.
- get_ref_set(n_ref_points=1000)[source]¶
Introduction¶
Generate a set of true Pareto-optimal objective vectors for the ZDT3 problem. ZDT3 has a discontinuous front composed of several convex segments.
Args¶
n_ref_points (int): Number of uniformly sampled candidate points. Default is 1000.
Returns¶
np.ndarray: A 2D array containing non-dominated Pareto-optimal objective vectors.
- class src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDT4(n_var=10)[source]¶
Bases:
src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDTIntroduction¶
The
ZDT4class represents the fourth problem in the ZDT multi-objective benchmark suite. This problem introduces a multimodal landscape with many local Pareto-optimal solutions to evaluate the ability of optimization algorithms to escape local optima.Args¶
n_var(int, optional): Number of decision variables. Default is 10.
Attributes¶
n_var(int): Number of decision variables.n_obj(int): Number of objectives, fixed at 2.vtype(type): Variable type, set tofloat.lb(np.ndarray): Lower bounds of the decision variables. x₀ in [0,1], others in [-5,5].ub(np.ndarray): Upper bounds of the decision variables. x₀ in [0,1], others in [-5,5].
Methods¶
func(x, *args, **kwargs): Computes the objective values for ZDT4.get_ref_set(n_ref_points=1000): Returns reference Pareto-optimal points for ZDT4.
Initialization
Introduction¶
Initialize the ZDT4 problem by setting custom bounds for the decision variables. x₀ is in [0, 1], while x₁~xₙ are in [-5, 5].
Args¶
n_var (int): Number of decision variables. Default is 10.
- func(x, *args, **kwargs)[source]¶
Introduction¶
Evaluate the objective values for the ZDT4 problem. ZDT4 is characterized by a large number of local Pareto-optimal fronts, testing the global search capability of optimization algorithms.
Args¶
x (np.ndarray): A 1D or 2D array representing decision variable(s).
*args: Additional unused positional arguments.
**kwargs: Additional unused keyword arguments.
Returns¶
np.ndarray: A 2D array of shape (n_samples, 2) containing the computed objective vectors.
- get_ref_set(n_ref_points=1000)[source]¶
Introduction¶
Generate a set of true Pareto-optimal objective vectors for the ZDT4 problem.ZDT4 shares the same Pareto front shape as ZDT1, but has a rugged decision space.
Args¶
n_ref_points (int): Number of uniformly sampled points to generate. Default is 1000.
Returns¶
np.ndarray: A 2D array of shape (n_ref_points, 2) containing Pareto-optimal reference points.
- class src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDT5(m=11, n=5, normalize=True, **kwargs)[source]¶
Bases:
src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDTIntroduction¶
The
ZDT5class represents the fifth problem in the ZDT benchmark suite. This problem features binary decision variables and a discrete search space. It evaluates the ability of optimization algorithms to handle discrete and combinatorial problems.Args¶
m(int, optional): Number of subcomponents (objectives related). Default is 11.n(int, optional): Number of bits per subcomponent. Default is 5.normalize(bool, optional): Whether to normalize objectives to [0,1]. Default is True.**kwargs: Additional keyword arguments passed to the base class.
Attributes¶
m(int): Number of subcomponents.n(int): Number of bits per subcomponent.normalize(bool): Whether to normalize objectives.n_var(int): Number of decision variables, computed as 30 + n * (m-1).Other attributes inherited from
ZDT.
Methods¶
__init__(m=11, n=5, normalize=True, **kwargs): Initializes ZDT5 with given parameters.func(x, *args, **kwargs): Evaluates objectives for the input decision variables.get_ref_set(n_ref_points=1000): Generates reference Pareto front points.
Initialization
Introduction¶
Initialize the ZDT5 problem with given parameters for subcomponents and bit-lengths.
Args¶
m (int): Number of subcomponents, default 11.
n (int): Number of bits per subcomponent, default 5.
normalize (bool): Whether to normalize objectives, default True.
**kwargs: Additional keyword arguments passed to the base class.
- func(x, *args, **kwargs)[source]¶
Introduction¶
Evaluate the objectives for the ZDT5 problem. Converts input to float and splits decision variables into subcomponents. Calculates the objectives according to the ZDT5 definition.
Args¶
x (np.ndarray): Decision variable array, 1D or 2D.
*args: Additional positional arguments.
**kwargs: Additional keyword arguments.
Returns¶
np.ndarray: 2D array of shape (n_samples, 2) with objective values.
- class src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDT6(n_var=10, **kwargs)[source]¶
Bases:
src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZDTIntroduction¶
The
ZDT6class represents the sixth problem in the ZDT benchmark suite.This problem features a non-uniformly distributed Pareto front and a complicated shape that challenges multi-objective optimization algorithms.Args¶
n_var(int, optional): Number of decision variables. Default is 10.**kwargs: Additional keyword arguments passed to the base class.
Attributes¶
n_var(int): Number of decision variables.Other attributes inherited from
ZDT.
Methods¶
__init__(n_var=10, **kwargs): Initializes the ZDT6 problem.func(x, *args, **kwargs): Evaluates the objective functions.get_ref_set(n_ref_points=1000): Returns the theoretical Pareto front reference set.
Initialization
Introduction¶
Initialize ZDT6 with a specified number of decision variables.
Args¶
n_var(int): Number of decision variables, default 10.**kwargs: Additional keyword arguments passed to the base class.
- func(x, *args, **kwargs)[source]¶
Introduction¶
Evaluate the two objectives of the ZDT6 problem for given decision variables.
Args¶
x(np.ndarray): Decision variable array, can be 1D or 2D.*args: Additional positional arguments.**kwargs: Additional keyword arguments.
Returns¶
np.ndarray: Array of shape (n_samples, 2) containing objective values.
- class src.environment.problem.MOO.MOO_synthetic.zdt_numpy.ZeroToOneNormalization(lb=None, ub=None)[source]¶
Introduction¶
A utility class to normalize data features to the [0, 1] range based on provided lower and upper bounds. Supports cases where bounds may be partially or fully unspecified (NaN), handling normalization accordingly.
Args¶
lb(np.ndarray or None): Lower bounds for normalization. If None, treated as unspecified.ub(np.ndarray or None): Upper bounds for normalization. If None, treated as unspecified.
Attributes¶
lb(np.ndarray or None): Stored lower bounds.ub(np.ndarray or None): Stored upper bounds.lb_only(np.ndarray of bool): Mask where only lower bound is specified.ub_only(np.ndarray of bool): Mask where only upper bound is specified.both_nan(np.ndarray of bool): Mask where both bounds are NaN.neither_nan(np.ndarray of bool): Mask where neither bound is NaN.
Methods¶
__init__(lb=None, ub=None): Initializes normalization bounds and masks.forward(X): Normalize input arrayXbased on stored bounds.
Initialization
Introduction¶
Initialize normalization with optional lower and upper bounds.
Args¶
lb(np.ndarray or None): Lower bounds.ub(np.ndarray or None): Upper bounds.
- src.environment.problem.MOO.MOO_synthetic.zdt_numpy.normalize(X, lb=None, ub=None, return_bounds=False, estimate_bounds_if_none=True)[source]¶
Introduction¶
Normalize input data
Xto [0, 1] based on provided or estimated bounds.Args¶
X(np.ndarray): Input data array.lb(float, int, np.ndarray or None): Lower bounds. If None andestimate_bounds_if_noneis True, estimated fromX.ub(float, int, np.ndarray or None): Upper bounds. If None andestimate_bounds_if_noneis True, estimated fromX.return_bounds(bool): Whether to return the bounds along with normalized data.estimate_bounds_if_none(bool): Whether to estimate bounds fromXif they are not provided.
Returns¶
np.ndarrayor tuple: Normalized data array; ifreturn_boundsis True, also returns lower and upper bounds.