validate_bounds#

lumopt2.optimizer.base_optimizer.validate_bounds(bounds: List[tuple], n_params: int, algorithm_name: str = 'Optimizer', require_finite: bool = True) Tuple[ndarray, ndarray]#

Validate parameter bounds and return lower/upper arrays.

Parameters:
boundsList[tuple]

Bounds as list of (min, max) tuples.

n_paramsint

Expected number of parameters.

algorithm_namestr

Name of algorithm for error messages (default: “Optimizer”).

require_finitebool

If True, reject infinite or None bounds (default: True).

Returns:
bounds_lowernp.ndarray

Lower bounds array of shape (n_params,).

bounds_uppernp.ndarray

Upper bounds array of shape (n_params,).

Raises:
ValueError

If bounds are missing, size mismatched, invalid, or non-finite when required.