SpotOptim.SpotOptimConfig

SpotOptim.SpotOptimConfig(
    bounds=None,
    max_iter=20,
    n_initial=10,
    surrogate=None,
    acquisition='y',
    var_type=None,
    var_name=None,
    var_trans=None,
    tolerance_x=None,
    max_time=np.inf,
    repeats_initial=1,
    repeats_surrogate=1,
    ocba_delta=0,
    tensorboard_log=False,
    tensorboard_path=None,
    tensorboard_clean=False,
    fun_mo2so=None,
    seed=None,
    verbose=False,
    warnings_filter='ignore',
    n_infill_points=1,
    max_surrogate_points=None,
    selection_method='distant',
    acquisition_failure_strategy='random',
    penalty=False,
    penalty_val=None,
    acquisition_fun_return_size=3,
    acquisition_optimizer='differential_evolution',
    restart_after_n=100,
    restart_inject_best=True,
    max_restarts=None,
    x0=None,
    de_x0_prob=0.1,
    tricands_fringe=False,
    prob_de_tricands=0.8,
    window_size=None,
    min_tol_metric='chebyshev',
    prob_surrogate=None,
    n_jobs=1,
    eval_batch_size=1,
    acquisition_optimizer_kwargs=None,
    args=(),
    kwargs=None,
)

Configuration parameters for SpotOptim.

Attributes

Name Type Description
bounds Optional[list] Bounds for the input variables.
max_iter int Maximum number of iterations.
n_initial int Number of initial points.
surrogate Optional[object] Surrogate model.
acquisition str Acquisition function.
var_type Optional[list] Type of variables.
var_name Optional[list] Name of variables.
var_trans Optional[list] Transformation of variables.
tolerance_x Optional[float] Tolerance for input variables.
max_time float Maximum time.
repeats_initial int Number of repeats for initial points.
repeats_surrogate int Number of repeats for surrogate points.
ocba_delta int Delta for OCBA.
tensorboard_log bool Whether to log to TensorBoard.
tensorboard_path Optional[str] Path to TensorBoard logs.
tensorboard_clean bool Whether to clean TensorBoard logs.
fun_mo2so Optional[Callable] Function to convert multi-objective to single-objective.
seed Optional[int] Seed for random number generator.
verbose bool Whether to print verbose output.
warnings_filter Literal['default', 'error', 'ignore'] Filter for warnings.
n_infill_points int Number of infill points.
max_surrogate_points Optional[Union[int, List[int]]] Maximum number of surrogate points.
selection_method str Method for selecting infill points.
acquisition_failure_strategy str Strategy for handling acquisition function failures.
penalty bool Whether to use penalty.
penalty_val Optional[float] Penalty value.
acquisition_fun_return_size int Size of the acquisition function return.
acquisition_optimizer Union[str, Callable] Optimizer for the acquisition function.
restart_after_n int Number of iterations after which to restart.
restart_inject_best bool Whether to inject the best point after restart.
max_restarts Optional[int] Patience-based early-stopping. When set, the optimizer terminates after this many consecutive restarts that fail to improve the best objective value. None (default) disables the check and preserves legacy behavior.
x0 Optional[np.ndarray] Initial guess for the input variables.
de_x0_prob float Probability of using differential evolution for initial guess.
tricands_fringe bool Whether to use fringe for tricands.
prob_de_tricands float Probability of using tricands for differential evolution.
window_size Optional[int] Size of the window for tricands.
min_tol_metric str Metric for minimum tolerance.
prob_surrogate Optional[List[float]] Probability of using surrogate.
n_jobs int Number of parallel workers. 1 runs sequentially. Values > 1 activate steady-state parallel optimization. On standard GIL builds a hybrid executor is used: ProcessPoolExecutor for objective evaluations (process isolation; supports lambdas and closures via dill) and ThreadPoolExecutor for surrogate search tasks (shared heap; zero serialization overhead). On free-threaded Python builds (python3.13t, --disable-gil), both pools are ThreadPoolExecutor instances, achieving true CPU-level parallelism without dill for eval tasks. -1 resolves to os.cpu_count() (all available CPU cores). 0 and values < -1 raise ValueError. Defaults to 1.
eval_batch_size int Number of candidate points to accumulate before dispatching a single fun(X_batch) call to the process pool. 1 (default) dispatches each candidate immediately, preserving current behavior. Values > 1 reduce process-spawn and IPC overhead when fun supports vectorized batch input. Must be >= 1. Defaults to 1.
acquisition_optimizer_kwargs Optional[Dict[str, Any]] Keyword arguments for the acquisition function optimizer.
args Tuple Arguments for the objective function.
kwargs Optional[Dict[str, Any]] Keyword arguments for the objective function.

Examples

import numpy as np
from spotoptim.SpotOptim import SpotOptim
from sklearn.gaussian_process import GaussianProcessRegressor
from spotoptim.SpotOptim import SpotOptimConfig
from sklearn.gaussian_process.kernels import Matern, ConstantKernel

kernel = ConstantKernel(1.0, (1e-2, 1e12)) * Matern(length_scale=1.0, length_scale_bounds=(1e-4, 1e2), nu=2.5)
surrogate = GaussianProcessRegressor(kernel=kernel, n_restarts_optimizer=100)

config = SpotOptimConfig(
     bounds=[(0, 1), (0, 1)],
     max_iter=20,
     n_initial=10,
     surrogate=surrogate,
     acquisition="y",
     var_type=["continuous", "continuous"],
     var_name=["x1", "x2"],
     var_trans=["identity", "identity"],
     tolerance_x=1e-6,
     max_time=np.inf,
     repeats_initial=1,
     repeats_surrogate=1,
     ocba_delta=0,
     tensorboard_log=False,
     tensorboard_path=None,
     tensorboard_clean=False,
     fun_mo2so=None,
     seed=None,
     verbose=False,
     warnings_filter="ignore",
     n_infill_points=1,
     max_surrogate_points=None,
     selection_method="distant",
     acquisition_failure_strategy="random",
     penalty=False,
     penalty_val=None,
     acquisition_fun_return_size=3,
     acquisition_optimizer="differential_evolution",
     restart_after_n=100,
     restart_inject_best=True,
     max_restarts=None,
     x0=None,
     de_x0_prob=0.1,
     tricands_fringe=False,
     prob_de_tricands=0.8,
     window_size=None,
     min_tol_metric="chebyshev",
     prob_surrogate=None,
     n_jobs=1,
     acquisition_optimizer_kwargs=None,
     args=(),
     kwargs=None,
)