function.mo

function.mo

Analytical multi-objective test functions for optimization benchmarking.

This module provides well-known multi-objective analytical test functions commonly used for evaluating and benchmarking multiobjective optimization algorithms.

Functions

Name Description
activity_pred Compute activity predictions for each row in the input array.
conversion_pred Compute conversion predictions for each row in the input array.
dtlz1 DTLZ1 multi-objective test function (scalable objectives).
dtlz2 DTLZ2 multi-objective test function (scalable objectives).
fonseca_fleming Fonseca-Fleming multi-objective test function (2 objectives).
fun_myer16a Compute both conversion and activity predictions for each row in the input array.
kursawe Kursawe multi-objective test function (2 objectives, minimization).
mo_conv2_max Convex bi-objective maximization test function (2 objectives).
mo_conv2_min Convex bi-objective minimization test function (2 objectives).
schaffer_n1 Schaffer N1 multi-objective test function (2 objectives).
zdt1 ZDT1 multi-objective test function (2 objectives).
zdt2 ZDT2 multi-objective test function (2 objectives).
zdt3 ZDT3 multi-objective test function (2 objectives).
zdt4 ZDT4 multi-objective test function (2 objectives).
zdt6 ZDT6 multi-objective test function (2 objectives).

activity_pred

function.mo.activity_pred(X)

Compute activity predictions for each row in the input array.

Parameters

Name Type Description Default
X np.ndarray 2D array where each row is a configuration. required

Returns

Name Type Description
np.ndarray np.ndarray: 1D array of activity predictions.

Examples

>>> import numpy as np
>>> from spotoptim.function.mo import activity_pred
>>> # Example input data
>>> X = np.array([[1, 2, 3], [4, 5, 6]])
>>> activity_pred(X)
array([  1.5,  10.5])

conversion_pred

function.mo.conversion_pred(X)

Compute conversion predictions for each row in the input array.

Parameters

Name Type Description Default
X np.ndarray 2D array where each row is a configuration. required

Returns

Name Type Description
np.ndarray np.ndarray: 1D array of conversion predictions.

Examples

>>> import numpy as np
>>> from spotoptim.function.mo import conversion_pred
>>> # Example input data
>>> X = np.array([[1, 2, 3], [4, 5, 6]])
>>> conversion_pred(X)
array([  3.5,  19.5])

dtlz1

function.mo.dtlz1(X, n_obj=3)

DTLZ1 multi-objective test function (scalable objectives).

DTLZ1 is a scalable test problem with a linear Pareto front. It has (11^k - 1) local Pareto fronts where k = n - n_obj + 1.

Mathematical formulation

f_i(X) = 0.5 * x1 * … * x_{M-i} * [1 + g(X)] for i = 1, …, M-1 f_M(X) = 0.5 * [1 - x_{M-1}] * [1 + g(X)] g(X) = 100 * [k + sum((x_i - 0.5)^2 - cos(20π(x_i - 0.5)) for i in X_M)]

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. required
n_obj int Number of objectives. Defaults to 3. Must be at least 2 and at most n_features. 3

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, n_obj).

Raises

Name Type Description
ValueError If n_obj is invalid or X has insufficient dimensions.

Note

  • Number of objectives: Scalable (typically 3)
  • Typical number of variables: n_obj + k - 1 (often k = 5, so n = 7 for 3 objectives)
  • Search domain: [0, 1]^n
  • Pareto front: Linear hyperplane
  • Characteristics: Multimodal, many local fronts

Examples

>>> from spotoptim.function.mo import dtlz1
>>> import numpy as np
>>> X = np.array([0.5, 0.5, 0.5, 0.5, 0.5])
>>> result = dtlz1(X, n_obj=3)
>>> result.shape
(1, 3)

References

Deb, K., Thiele, L., Laumanns, M., & Zitzler, E. (2005). “Scalable test problems for evolutionary multiobjective optimization.” In Evolutionary multiobjective optimization (pp. 105-145). Springer.

dtlz2

function.mo.dtlz2(X, n_obj=3)

DTLZ2 multi-objective test function (scalable objectives).

DTLZ2 is a scalable test problem with a concave Pareto front (a unit sphere).

Mathematical formulation

f_i(X) = [1 + g(X)] * cos(x1 * π/2) * … * cos(x_{M-i} * π/2) * sin(x_{M-i+1} * π/2) f_M(X) = [1 + g(X)] * sin(x1 * π/2) g(X) = sum((x_i - 0.5)^2 for i in X_M)

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. required
n_obj int Number of objectives. Defaults to 3. Must be at least 2 and at most n_features. 3

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, n_obj).

Raises

Name Type Description
ValueError If n_obj is invalid or X has insufficient dimensions.

Note

  • Number of objectives: Scalable (typically 3)
  • Typical number of variables: n_obj + k - 1 (often k = 10, so n = 12 for 3 objectives)
  • Search domain: [0, 1]^n
  • Pareto front: Concave (sphere: sum(f_i^2) = 1)
  • Characteristics: Concave, unimodal

Examples

>>> from spotoptim.function.mo import dtlz2
>>> import numpy as np
>>> X = np.array([0.5, 0.5, 0.5, 0.5, 0.5])
>>> result = dtlz2(X, n_obj=3)
>>> result.shape
(1, 3)

References

Deb, K., Thiele, L., Laumanns, M., & Zitzler, E. (2005). “Scalable test problems for evolutionary multiobjective optimization.” In Evolutionary multiobjective optimization (pp. 105-145). Springer.

fonseca_fleming

function.mo.fonseca_fleming(X)

Fonseca-Fleming multi-objective test function (2 objectives).

The Fonseca-Fleming function is a classical bi-objective problem with a concave Pareto front. The difficulty increases with the number of variables.

Mathematical formulation

f1(X) = 1 - exp(-sum((x_i - 1/sqrt(n))^2 for i=1 to n)) f2(X) = 1 - exp(-sum((x_i + 1/sqrt(n))^2 for i=1 to n))

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. required

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, 2) where: - Column 0: f1 values - Column 1: f2 values

Note

  • Number of objectives: 2
  • Typical number of variables: 2-10
  • Search domain: [-4, 4]^n
  • Pareto front: Concave
  • Characteristics: Concave, symmetric

Examples

>>> from spotoptim.function.mo import fonseca_fleming
>>> import numpy as np
>>> X = np.array([0.0, 0.0])
>>> result = fonseca_fleming(X)
>>> result.shape
(1, 2)
>>> X = np.array([[0.0, 0.0], [1.0, 1.0]])
>>> result = fonseca_fleming(X)
>>> result.shape
(2, 2)

References

Fonseca, C. M., & Fleming, P. J. (1995). “An overview of evolutionary algorithms in multiobjective optimization.” Evolutionary computation, 3(1), 1-16.

fun_myer16a

function.mo.fun_myer16a(X, fun_control=None)

Compute both conversion and activity predictions for each row in the input array.

Notes

Implements a response surface experiment described by Myers, Montgomery, and Anderson-Cook (2016). The function computes two objectives: conversion and activity.

References

  • Myers, R. H., Montgomery, D. C., and Anderson-Cook, C. M. Response surface methodology: process and product optimization using designed experiments. John Wiley & Sons, 2016.
  • Kuhn, M. desirability: Function optimization and ranking via desirability functions. Tech. rep., 9 2016.

Parameters

Name Type Description Default
X np.ndarray 2D array where each row is a configuration. required
fun_control dict Additional control parameters (not used here). None

Returns

Name Type Description
np.ndarray np.ndarray: 2D array where each row contains [conversion_pred, activity_pred].

Examples

>>> import numpy as np
>>> from spotoptim.function.mo import fun_myer16a
>>> # Example input data
>>> X = np.array([[1, 2, 3], [4, 5, 6]])
>>> fun_myer16a(X)
array([[  3.5,   1.5],
       [ 19.5,  10.5]])

kursawe

function.mo.kursawe(X)

Kursawe multi-objective test function (2 objectives, minimization).

The Kursawe function is a classic bi-objective minimization benchmark with a non-convex, disconnected Pareto front, often used to test an optimizer’s ability to maintain diversity and avoid getting trapped in local fronts.

Mathematical formulation

f1(X) = sum(-10 * exp(-0.2 * sqrt(x_i^2 + x_{i+1}^2)) for i=1 to n-1) f2(X) = sum(|x_i|^0.8 + 5 * sin(x_i^3) for i=1 to n)

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. Must have at least 2 dimensions. required

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, 2) where: - Column 0: f1 values - Column 1: f2 values

Raises

Name Type Description
ValueError If X has fewer than 2 dimensions.

Note

  • Number of objectives: 2
  • Typical number of variables: 3
  • Search domain: [-5, 5]^n
  • Pareto front: Disconnected
  • Characteristics: Non-convex, disconnected, multimodal

Examples

>>> from spotoptim.function.mo import kursawe
>>> import numpy as np
>>> X = np.array([0.0, 0.0, 0.0])
>>> result = kursawe(X)
>>> result.shape
(1, 2)
>>> X = np.array([[0.0, 0.0, 0.0], [1.0, 1.0, 1.0]])
>>> result = kursawe(X)
>>> result.shape
(2, 2)

References

Kursawe, F. (1991). “A variant of evolution strategies for vector optimization.” In International Conference on Parallel Problem Solving from Nature (pp. 193-197). Springer.

mo_conv2_max

function.mo.mo_conv2_max(X)

Convex bi-objective maximization test function (2 objectives).

A smooth, convex two-objective maximization problem on [0, 1]^2 using flipped versions of the minimization objectives: f1(x, y) = 2 - (x^2 + y^2) f2(x, y) = 2 - ((1 - x)^2 + (1 - y)^2)

Properties

  • Domain: [0, 1]^2
  • Objectives: maximize both f1 and f2
  • Ideal points: (0, 0) for f1 (gives f1=2); (1, 1) for f2 (gives f2=2)
  • Pareto set: line x = y in [0, 1]
  • Pareto front: convex quadratic trade-off f1 = 2 - 2t^2, f2 = 2 - 2(1 - t)^2, t ∈ [0, 1]

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. Must have exactly 2 dimensions. required

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, 2) where: - Column 0: f1 values (to be maximized) - Column 1: f2 values (to be maximized)

Raises

Name Type Description
ValueError If X does not have exactly 2 dimensions.

Note

  • Number of objectives: 2
  • Number of variables: 2
  • Search domain: [0, 1]^2
  • Ideal points: (1, 1) for f1, (0, 0) for f2
  • Pareto front: Convex, quadratic
  • Problem type: Maximization
  • Characteristics: Convex, smooth, bounded

Examples

Single point evaluation:

>>> from spotoptim.function.mo import mo_conv2_max
>>> import numpy as np
>>> X = np.array([0.0, 0.0])
>>> result = mo_conv2_max(X)
>>> result.shape
(1, 2)
>>> result[0]  # f1 maximum
array([0., 2.])
>>> X = np.array([1.0, 1.0])
>>> result = mo_conv2_max(X)
>>> result[0]  # f2 maximum
array([2., 0.])

Multiple points evaluation:

>>> X = np.array([[0.0, 0.0], [0.5, 0.5], [1.0, 1.0]])
>>> result = mo_conv2_min(X)
>>> result.shape
(3, 2)
>>> result[1]  # Pareto front
array([0.5, 0.5])

mo_conv2_min

function.mo.mo_conv2_min(X)

Convex bi-objective minimization test function (2 objectives).

A smooth, convex two-objective problem on [0, 1]^2: f1(x, y) = x^2 + y^2 f2(x, y) = (x - 1)^2 + (y - 1)^2

Properties

  • Domain: [0, 1]^2
  • Objectives: minimize both f1 and f2
  • Ideal points: (0, 0) for f1; (1, 1) for f2
  • Pareto set: line x = y in [0, 1]
  • Pareto front: convex quadratic trade-off f1 = 2t^2, f2 = 2(1 - t)^2, t ∈ [0, 1]

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. Must have exactly 2 dimensions. required

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, 2) where: - Column 0: f1 values (to be minimized) - Column 1: f2 values (to be minimized)

Raises

Name Type Description
ValueError If X does not have exactly 2 dimensions.

Note

  • Number of objectives: 2
  • Number of variables: 2
  • Search domain: [0, 1]^2
  • Ideal points: (0, 0) for f1, (1, 1) for f2
  • Pareto front: Convex, quadratic
  • Problem type: Minimization
  • Characteristics: Convex, smooth, bounded

Examples

Single point evaluation:

>>> from spotoptim.function.mo import mo_conv2_min
>>> import numpy as np
>>> X = np.array([0.0, 0.0])
>>> result = mo_conv2_min(X)
>>> result.shape
(1, 2)
>>> result[0]  # f1 minimum
array([0., 2.])
>>> X = np.array([1.0, 1.0])
>>> result = mo_conv2_min(X)
>>> result[0]  # f2 minimum
array([2., 0.])

Multiple points evaluation:

>>> X = np.array([[0.0, 0.0], [0.5, 0.5], [1.0, 1.0]])
>>> result = mo_conv2_min(X)
>>> result.shape
(3, 2)
>>> result[1]  # Pareto front
array([0.5, 0.5])

schaffer_n1

function.mo.schaffer_n1(X)

Schaffer N1 multi-objective test function (2 objectives).

Schaffer N1 is a simple bi-objective problem with a convex Pareto front. It is one of the earliest multi-objective test functions.

Mathematical formulation

f1(X) = x^2 f2(X) = (x - 2)^2

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. This function uses only the first variable. required

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, 2) where: - Column 0: f1 values - Column 1: f2 values

Note

  • Number of objectives: 2
  • Number of variables: 1 (only first variable is used)
  • Search domain: [-10, 10] or [-A, A]
  • Pareto front: x ∈ [0, 2]
  • Characteristics: Convex, simple, unimodal

Examples

>>> from spotoptim.function.mo import schaffer_n1
>>> import numpy as np
>>> X = np.array([0.0])
>>> result = schaffer_n1(X)
>>> result.shape
(1, 2)
>>> result[0]
array([0., 4.])
>>> X = np.array([[0.0], [1.0], [2.0]])
>>> result = schaffer_n1(X)
>>> result.shape
(3, 2)

References

Schaffer, J. D. (1985). “Multiple objective optimization with vector evaluated genetic algorithms.” In Proceedings of the 1st international Conference on Genetic Algorithms (pp. 93-100).

zdt1

function.mo.zdt1(X)

ZDT1 multi-objective test function (2 objectives).

ZDT1 is a classical bi-objective test problem with a convex Pareto front. It is one of the most widely used benchmark functions for multi-objective optimization.

Mathematical formulation

f1(X) = x1 f2(X) = g(X) * [1 - sqrt(x1 / g(X))] g(X) = 1 + 9 * sum(x_i for i=2 to n) / (n - 1)

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. Must have at least 2 dimensions. required

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, 2) where: - Column 0: f1 values - Column 1: f2 values

Raises

Name Type Description
ValueError If X has fewer than 2 dimensions.

Note

  • Number of objectives: 2
  • Typical number of variables: 30
  • Search domain: [0, 1]^n
  • Pareto front: Convex, f1 ∈ [0, 1], f2 = 1 - sqrt(f1)
  • Characteristics: Convex, unimodal

Examples

Single point evaluation:

>>> from spotoptim.function.mo import zdt1
>>> import numpy as np
>>> X = np.array([0.0, 0.0, 0.0])
>>> result = zdt1(X)
>>> result.shape
(1, 2)
>>> result[0, 0]  # f1
0.0
>>> result[0, 1]  # f2
1.0

Multiple points evaluation:

>>> X = np.array([[0.0, 0.0], [0.5, 0.5], [1.0, 1.0]])
>>> result = zdt1(X)
>>> result.shape
(3, 2)

References

Zitzler, E., Deb, K., & Thiele, L. (2000). “Comparison of multiobjective evolutionary algorithms: Empirical results.” Evolutionary computation, 8(2), 173-195.

zdt2

function.mo.zdt2(X)

ZDT2 multi-objective test function (2 objectives).

ZDT2 is similar to ZDT1 but has a non-convex Pareto front.

Mathematical formulation

f1(X) = x1 f2(X) = g(X) * [1 - (x1 / g(X))^2] g(X) = 1 + 9 * sum(x_i for i=2 to n) / (n - 1)

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. Must have at least 2 dimensions. required

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, 2) where: - Column 0: f1 values - Column 1: f2 values

Raises

Name Type Description
ValueError If X has fewer than 2 dimensions.

Note

  • Number of objectives: 2
  • Typical number of variables: 30
  • Search domain: [0, 1]^n
  • Pareto front: Non-convex, f1 ∈ [0, 1], f2 = 1 - f1^2
  • Characteristics: Non-convex, unimodal

Examples

>>> from spotoptim.function.mo import zdt2
>>> import numpy as np
>>> X = np.array([0.0, 0.0, 0.0])
>>> result = zdt2(X)
>>> result.shape
(1, 2)

References

Zitzler, E., Deb, K., & Thiele, L. (2000). “Comparison of multiobjective evolutionary algorithms: Empirical results.” Evolutionary computation, 8(2), 173-195.

zdt3

function.mo.zdt3(X)

ZDT3 multi-objective test function (2 objectives).

ZDT3 has a disconnected (discontinuous) Pareto front, making it more challenging.

Mathematical formulation

f1(X) = x1 f2(X) = g(X) * [1 - sqrt(x1 / g(X)) - (x1 / g(X)) * sin(10 * π * x1)] g(X) = 1 + 9 * sum(x_i for i=2 to n) / (n - 1)

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. Must have at least 2 dimensions. required

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, 2) where: - Column 0: f1 values - Column 1: f2 values

Raises

Name Type Description
ValueError If X has fewer than 2 dimensions.

Note

  • Number of objectives: 2
  • Typical number of variables: 30
  • Search domain: [0, 1]^n
  • Pareto front: Disconnected (5 separate regions)
  • Characteristics: Discontinuous, multimodal

Examples

>>> from spotoptim.function.mo import zdt3
>>> import numpy as np
>>> X = np.array([0.0, 0.0, 0.0])
>>> result = zdt3(X)
>>> result.shape
(1, 2)

References

Zitzler, E., Deb, K., & Thiele, L. (2000). “Comparison of multiobjective evolutionary algorithms: Empirical results.” Evolutionary computation, 8(2), 173-195.

zdt4

function.mo.zdt4(X)

ZDT4 multi-objective test function (2 objectives).

ZDT4 has 21^9 local Pareto fronts, testing the algorithm’s ability to deal with multimodality.

Mathematical formulation

f1(X) = x1 f2(X) = g(X) * [1 - sqrt(x1 / g(X))] g(X) = 1 + 10 * (n - 1) + sum(x_i^2 - 10 * cos(4 * π * x_i) for i=2 to n)

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. Must have at least 2 dimensions. required

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, 2) where: - Column 0: f1 values - Column 1: f2 values

Raises

Name Type Description
ValueError If X has fewer than 2 dimensions.

Note

  • Number of objectives: 2
  • Typical number of variables: 10
  • Search domain: x1 ∈ [0, 1], x_i ∈ [-5, 5] for i = 2, …, n
  • Pareto front: Convex, same as ZDT1
  • Characteristics: Multimodal (many local fronts)

Examples

>>> from spotoptim.function.mo import zdt4
>>> import numpy as np
>>> X = np.array([0.5, 0.0, 0.0])
>>> result = zdt4(X)
>>> result.shape
(1, 2)

References

Zitzler, E., Deb, K., & Thiele, L. (2000). “Comparison of multiobjective evolutionary algorithms: Empirical results.” Evolutionary computation, 8(2), 173-195.

zdt6

function.mo.zdt6(X)

ZDT6 multi-objective test function (2 objectives).

ZDT6 has a non-uniform search space with a non-convex Pareto front and low density of solutions near the Pareto front.

Mathematical formulation

f1(X) = 1 - exp(-4 * x1) * sin^6(6 * π * x1) f2(X) = g(X) * [1 - (f1 / g(X))^2] g(X) = 1 + 9 * [sum(x_i for i=2 to n) / (n - 1)]^0.25

Parameters

Name Type Description Default
X array - like Input points with shape (n_samples, n_features) or (n_features,). Can be a 1D array for a single point or 2D array for multiple points. Must have at least 2 dimensions. required

Returns

Name Type Description
np.ndarray np.ndarray: Objective values with shape (n_samples, 2) where: - Column 0: f1 values - Column 1: f2 values

Raises

Name Type Description
ValueError If X has fewer than 2 dimensions.

Note

  • Number of objectives: 2
  • Typical number of variables: 10
  • Search domain: [0, 1]^n
  • Pareto front: Non-convex, non-uniform density
  • Characteristics: Non-uniform, biased search space

Examples

>>> from spotoptim.function.mo import zdt6
>>> import numpy as np
>>> X = np.array([0.5, 0.5, 0.5])
>>> result = zdt6(X)
>>> result.shape
(1, 2)

References

Zitzler, E., Deb, K., & Thiele, L. (2000). “Comparison of multiobjective evolutionary algorithms: Empirical results.” Evolutionary computation, 8(2), 173-195.