Line Shaped Functions¶
Identity Square Line Function¶
Identity-square line benchmark.
Notes
\[ f(x) = x^2 \]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*x | UniversalArray | Input data with one dimension. | () |
Raises:
| Type | Description |
|---|---|
OutOfDimensionError | If input is not one-dimensional. |
Source code in src/umf/functions/optimization/line_shaped.py
Python
class IdentitySquareLineFunction(OptFunction):
r"""Identity-square line benchmark.
Notes:
$$
f(x) = x^2
$$
Args:
*x: Input data with one dimension.
Raises:
OutOfDimensionError: If input is not one-dimensional.
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the identity-square line function."""
_validate_one_dimensional(*x, function_name="IdentitySquareLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the identity-square line function."""
x_1 = self._x[0]
return x_1**2
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Shifted Identity Square Line Function¶
Shifted identity-square line benchmark.
Notes
\[ f(x) = (x - 1)^2 \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class ShiftedIdentitySquareLineFunction(OptFunction):
r"""Shifted identity-square line benchmark.
Notes:
$$
f(x) = (x - 1)^2
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the shifted identity-square line function."""
_validate_one_dimensional(*x, function_name="ShiftedIdentitySquareLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the shifted identity-square line function."""
x_1 = self._x[0]
return (x_1 - 1.0) ** 2
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(1.0,))
![]() |
Absolute Line Function¶
Absolute-value line benchmark.
Notes
\[ f(x) = |x| \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class AbsoluteLineFunction(OptFunction):
r"""Absolute-value line benchmark.
Notes:
$$
f(x) = |x|
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the absolute line function."""
_validate_one_dimensional(*x, function_name="AbsoluteLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the absolute line function."""
x_1 = self._x[0]
return np.abs(x_1)
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Quartic Line Function¶
Quartic line benchmark.
Notes
\[ f(x) = x^4 \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class QuarticLineFunction(OptFunction):
r"""Quartic line benchmark.
Notes:
$$
f(x) = x^4
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the quartic line function."""
_validate_one_dimensional(*x, function_name="QuarticLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the quartic line function."""
x_1 = self._x[0]
return x_1**4
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Sextic Line Function¶
Sextic line benchmark.
Notes
\[ f(x) = x^6 \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class SexticLineFunction(OptFunction):
r"""Sextic line benchmark.
Notes:
$$
f(x) = x^6
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the sextic line function."""
_validate_one_dimensional(*x, function_name="SexticLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the sextic line function."""
x_1 = self._x[0]
return x_1**6
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Double Well Line Function¶
Double-well line benchmark.
Notes
\[ f(x) = (x^2 - 1)^2 \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class DoubleWellLineFunction(OptFunction):
r"""Double-well line benchmark.
Notes:
$$
f(x) = (x^2 - 1)^2
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the double-well line function."""
_validate_one_dimensional(*x, function_name="DoubleWellLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the double-well line function."""
x_1 = self._x[0]
return (x_1**2 - 1.0) ** 2
@property
def __minima__(self) -> MinimaAPI:
"""Return representative global minima."""
return MinimaAPI(f_x=0.0, x=(-1.0, 1.0))
![]() |
Cosine Bowl Line Function¶
Cosine bowl line benchmark.
Notes
\[ f(x) = 1 - \cos(x) \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class CosineBowlLineFunction(OptFunction):
r"""Cosine bowl line benchmark.
Notes:
$$
f(x) = 1 - \cos(x)
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the cosine bowl line function."""
_validate_one_dimensional(*x, function_name="CosineBowlLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the cosine bowl line function."""
x_1 = self._x[0]
return 1.0 - np.cos(x_1)
@property
def __minima__(self) -> MinimaAPI:
"""Return one global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Sine Squared Line Function¶
Sine-squared line benchmark.
Notes
\[ f(x) = \sin^2(x) \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class SineSquaredLineFunction(OptFunction):
r"""Sine-squared line benchmark.
Notes:
$$
f(x) = \sin^2(x)
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the sine-squared line function."""
_validate_one_dimensional(*x, function_name="SineSquaredLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the sine-squared line function."""
x_1 = self._x[0]
return np.sin(x_1) ** 2
@property
def __minima__(self) -> MinimaAPI:
"""Return one global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Damped Oscillation Line Function¶
Damped oscillation line benchmark.
Notes
\[ f(x) = \sin^2(3x) + 0.01x^2 \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class DampedOscillationLineFunction(OptFunction):
r"""Damped oscillation line benchmark.
Notes:
$$
f(x) = \sin^2(3x) + 0.01x^2
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the damped oscillation line function."""
_validate_one_dimensional(*x, function_name="DampedOscillationLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the damped oscillation line function."""
x_1 = self._x[0]
return np.sin(3.0 * x_1) ** 2 + 0.01 * x_1**2
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Exponential Square Line Function¶
Exponential square line benchmark.
Notes
\[ f(x) = e^{x^2} - 1 \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class ExponentialSquareLineFunction(OptFunction):
r"""Exponential square line benchmark.
Notes:
$$
f(x) = e^{x^2} - 1
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the exponential square line function."""
_validate_one_dimensional(*x, function_name="ExponentialSquareLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the exponential square line function."""
x_1 = self._x[0]
return np.exp(x_1**2) - 1.0
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Log Cosh Line Function¶
Log-cosh line benchmark.
Notes
\[ f(x) = \log(\cosh(x)) \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class LogCoshLineFunction(OptFunction):
r"""Log-cosh line benchmark.
Notes:
$$
f(x) = \log(\cosh(x))
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the log-cosh line function."""
_validate_one_dimensional(*x, function_name="LogCoshLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the log-cosh line function."""
x_1 = self._x[0]
return np.log(np.cosh(x_1))
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Softplus Symmetric Line Function¶
Symmetric softplus line benchmark.
Notes
\[ f(x) = \log(1 + e^x) + \log(1 + e^{-x}) - 2\log(2) \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class SoftplusSymmetricLineFunction(OptFunction):
r"""Symmetric softplus line benchmark.
Notes:
$$
f(x) = \log(1 + e^x) + \log(1 + e^{-x}) - 2\log(2)
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the symmetric softplus line function."""
_validate_one_dimensional(*x, function_name="SoftplusSymmetricLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the symmetric softplus line function."""
x_1 = self._x[0]
return np.logaddexp(0.0, x_1) + np.logaddexp(0.0, -x_1) - 2.0 * np.log(2.0)
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Rational Bowl Line Function¶
Rational bowl line benchmark.
Notes
\[ f(x) = \frac{x^2}{1 + x^2} \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class RationalBowlLineFunction(OptFunction):
r"""Rational bowl line benchmark.
Notes:
$$
f(x) = \frac{x^2}{1 + x^2}
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the rational bowl line function."""
_validate_one_dimensional(*x, function_name="RationalBowlLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the rational bowl line function."""
x_1 = self._x[0]
return x_1**2 / (1.0 + x_1**2)
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Arctangent Square Line Function¶
Arctangent-square line benchmark.
Notes
\[ f(x) = \arctan^2(x) \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class ArctanSquareLineFunction(OptFunction):
r"""Arctangent-square line benchmark.
Notes:
$$
f(x) = \arctan^2(x)
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the arctangent-square line function."""
_validate_one_dimensional(*x, function_name="ArctanSquareLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the arctangent-square line function."""
x_1 = self._x[0]
return np.arctan(x_1) ** 2
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Cauchy Loss Line Function¶
Cauchy-loss line benchmark.
Notes
\[ f(x) = \log(1 + x^2) \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class CauchyLossLineFunction(OptFunction):
r"""Cauchy-loss line benchmark.
Notes:
$$
f(x) = \log(1 + x^2)
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the Cauchy-loss line function."""
_validate_one_dimensional(*x, function_name="CauchyLossLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the Cauchy-loss line function."""
x_1 = self._x[0]
return np.log1p(x_1**2)
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Elastic Net Line Function¶
Elastic-net style line benchmark.
Notes
\[ f(x) = |x| + 0.5x^2 \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class ElasticNetLineFunction(OptFunction):
r"""Elastic-net style line benchmark.
Notes:
$$
f(x) = |x| + 0.5x^2
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the elastic-net line function."""
_validate_one_dimensional(*x, function_name="ElasticNetLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the elastic-net line function."""
x_1 = self._x[0]
return np.abs(x_1) + 0.5 * x_1**2
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Shifted Elastic Line Function¶
Shifted elastic line benchmark.
Notes
\[ f(x) = |x - 2| + 0.25(x - 2)^2 \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class ShiftedElasticLineFunction(OptFunction):
r"""Shifted elastic line benchmark.
Notes:
$$
f(x) = |x - 2| + 0.25(x - 2)^2
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the shifted elastic line function."""
_validate_one_dimensional(*x, function_name="ShiftedElasticLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the shifted elastic line function."""
x_1 = self._x[0]
return np.abs(x_1 - 2.0) + 0.25 * (x_1 - 2.0) ** 2
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(2.0,))
![]() |
Gaussian Valley Line Function¶
Gaussian valley line benchmark.
Notes
\[ f(x) = 1 - \exp\left(-(x - 1)^2\right) \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class GaussianValleyLineFunction(OptFunction):
r"""Gaussian valley line benchmark.
Notes:
$$
f(x) = 1 - \exp\left(-(x - 1)^2\right)
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the gaussian valley line function."""
_validate_one_dimensional(*x, function_name="GaussianValleyLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the gaussian valley line function."""
x_1 = self._x[0]
return 1.0 - np.exp(-((x_1 - 1.0) ** 2))
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(1.0,))
![]() |
Sinc Square Line Function¶
Sinc-square line benchmark.
Notes
\[ f(x) = 1 - \operatorname{sinc}(x/\pi) \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class SincSquareLineFunction(OptFunction):
r"""Sinc-square line benchmark.
Notes:
$$
f(x) = 1 - \operatorname{sinc}(x/\pi)
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the sinc-square line function."""
_validate_one_dimensional(*x, function_name="SincSquareLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the sinc-square line function."""
x_1 = self._x[0]
return 1.0 - np.sinc(x_1 / np.pi)
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.0,))
![]() |
Tilted Parabola Ripple Line Function¶
Tilted parabola-ripple line benchmark.
Notes
\[ f(x) = (x - 0.5)^2 + 0.05\left(1 - \cos\left(6(x - 0.5)\right)\right) \]
Source code in src/umf/functions/optimization/line_shaped.py
Python
class TiltedParabolaRippleLineFunction(OptFunction):
r"""Tilted parabola-ripple line benchmark.
Notes:
$$
f(x) = (x - 0.5)^2 + 0.05\left(1 - \cos\left(6(x - 0.5)\right)\right)
$$
"""
def __init__(self, *x: UniversalArray) -> None:
"""Initialize the tilted parabola-ripple line function."""
_validate_one_dimensional(*x, function_name="TiltedParabolaRippleLine")
super().__init__(*x)
@property
def __eval__(self) -> UniversalArray:
"""Evaluate the tilted parabola-ripple line function."""
x_1 = self._x[0]
shifted = x_1 - 0.5
return shifted**2 + 0.05 * (1.0 - np.cos(6.0 * shifted))
@property
def __minima__(self) -> MinimaAPI:
"""Return the global minimum."""
return MinimaAPI(f_x=0.0, x=(0.5,))
![]() |



















