Plug & Play Integration#

Surfaces works out of the box with popular optimization frameworks. No adapters, no boilerplate, no hassle.


Supported Frameworks#

scipy

Built-in to_scipy() method for seamless integration.

scipy
Optuna

Direct use with Optuna’s suggest_* API.

Optuna
SMAC

Compatible with SMAC’s configuration space.

SMAC
Ray Tune

Works with Ray Tune’s search space definition.

Ray Tune
Gradient-Free-Optimizers

Native integration with GFO’s search space format.

Gradient-Free-Optimizers
Hyperactive

Directly compatible with Hyperactive’s API.

Hyperactive

Quick Examples#

scipy#

Every Surfaces function has a built-in to_scipy() method:

from surfaces.test_functions.algebraic import RosenbrockFunction
from scipy.optimize import minimize

func = RosenbrockFunction(n_dim=5)

# Convert to scipy format
objective, bounds, x0 = func.to_scipy()

# Run optimization
result = minimize(objective, x0, bounds=bounds, method='L-BFGS-B')
print(f"Minimum: {result.fun:.6f}")

Optuna#

Use Surfaces functions directly in Optuna objectives:

import optuna
from surfaces.test_functions.algebraic import AckleyFunction

func = AckleyFunction(n_dim=3)
space = func.search_space()

def objective(trial):
    params = {
        name: trial.suggest_float(name, values.min(), values.max())
        for name, values in space.items()
    }
    return func(params)

study = optuna.create_study()
study.optimize(objective, n_trials=100)

Gradient-Free-Optimizers#

Surfaces search spaces work directly with GFO:

from gradient_free_optimizers import RandomSearchOptimizer
from surfaces.test_functions.algebraic import RastriginFunction

func = RastriginFunction(n_dim=5)

opt = RandomSearchOptimizer(func.search_space())
opt.search(func, n_iter=100)

print(f"Best score: {opt.best_score}")

The Unified Interface#

What makes Surfaces truly plug & play is the unified interface. Every test function provides:

  1. Callable evaluation: func(params) works with dictionaries

  2. Search space: func.search_space() returns parameter bounds

  3. scipy conversion: func.to_scipy() for scipy optimizers

  4. Loss and score: Both minimization and maximization supported

This consistency means you write the integration code once and it works with all 100+ functions in the library.


Next Steps#