function.mo.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).