1D Functions#
One-dimensional test functions are useful for simple benchmarks, visualization of optimizer behavior, and educational purposes.
Available 1D Functions#
Function |
Global Minimum |
Characteristics |
|---|---|---|
|
x* = 0.548 |
Multiple local minima |
|
x* = 0.757 |
Smooth with one global minimum |
Gramacy & Lee Function#
A common 1D test function with multiple local minima.
from surfaces.test_functions.algebraic import GramacyAndLeeFunction
func = GramacyAndLeeFunction()
# Evaluate
result = func({"x0": 0.5})
# Search space
space = func.search_space()
print(f"Bounds: [{space['x0'].min()}, {space['x0'].max()}]")
Properties:
Domain: [0.5, 2.5]
Global minimum: x* = 0.548, f(x*) = -0.869
Forrester Function#
A smooth 1D function often used for surrogate model testing.
from surfaces.test_functions.algebraic import ForresterFunction
func = ForresterFunction()
result = func({"x0": 0.757})
Properties:
Domain: [0, 1]
Global minimum: x* = 0.757
Use Cases#
1D functions are particularly useful for:
Visualizing optimizer behavior: Plot the function and optimization trajectory
Testing convergence: Simple enough to verify optimizer correctness
Educational examples: Easy to understand and explain
import numpy as np
import matplotlib.pyplot as plt
from surfaces.test_functions.algebraic import GramacyAndLeeFunction
func = GramacyAndLeeFunction()
space = func.search_space()
# Plot the function
x = space["x0"]
y = [func({"x0": xi}) for xi in x]
plt.plot(x, y)
plt.xlabel("x")
plt.ylabel("f(x)")
plt.title("Gramacy & Lee Function")
plt.show()
Next Steps#
2D Functions - Two-dimensional functions with visualizable surfaces
N-D Functions - Scalable N-dimensional functions
Algebraic Functions - Complete API reference