pyfebiopt.optimize.optimizers
Adapters that bridge scipy optimizers to the engine interface.
Attributes
Classes
Abstract interface implemented by optimizer adapters. |
|
Adapter that wraps |
|
Adapter that wraps |
|
Thread-backed map callable compatible with SciPy differential_evolution. |
|
Adapter that wraps |
Module Contents
- pyfebiopt.optimize.optimizers.BoundsLike
- pyfebiopt.optimize.optimizers.Callback
- pyfebiopt.optimize.optimizers.ResidualFunction
- pyfebiopt.optimize.optimizers.ScalarObjective
- class pyfebiopt.optimize.optimizers.OptimizerAdapter
Abstract interface implemented by optimizer adapters.
- optimizer_name: str = ''
- classmethod from_options(options: collections.abc.Mapping[str, Any] | None) OptimizerAdapter
Build adapter instance from settings mapping.
- Returns:
Adapter instance configured with the provided options.
- abstractmethod minimize(fun: ResidualFunction, jac: collections.abc.Callable[[numpy.ndarray], numpy.ndarray] | None, phi0: numpy.ndarray, bounds: BoundsLike, callbacks: collections.abc.Iterable[Callback] | None = None, candidate_fun: ResidualFunction | None = None) tuple[numpy.ndarray, dict[str, object]]
Minimise the objective using the configured optimizer.
- Returns:
Tuple of optimal vector and optimizer metadata dictionary.
- static build(name: str, options: collections.abc.Mapping[str, Any] | None) OptimizerAdapter
Construct an adapter by name.
- Returns:
Concrete OptimizerAdapter ready for use with the engine.
- class pyfebiopt.optimize.optimizers.ScipyLeastSquaresAdapter(**kwargs: Any)
Bases:
OptimizerAdapterAdapter that wraps
scipy.optimize.least_squares().Store keyword arguments forwarded to SciPy.
- optimizer_name = 'least_squares'
- kwargs: dict[str, Any]
- minimize(fun: ResidualFunction, jac: collections.abc.Callable[[numpy.ndarray], numpy.ndarray] | None, phi0: numpy.ndarray, bounds: BoundsLike, callbacks: collections.abc.Iterable[Callback] | None = None, candidate_fun: ResidualFunction | None = None) tuple[numpy.ndarray, dict[str, object]]
Run SciPy least_squares and report optimizer metadata.
- Returns:
Tuple of optimal φ vector and metadata dictionary.
- class pyfebiopt.optimize.optimizers.ScipyMinimizeAdapter(method: str = 'L-BFGS-B', **kwargs: Any)
Bases:
OptimizerAdapterAdapter that wraps
scipy.optimize.minimize().Store method name and keyword arguments.
- optimizer_name = 'minimize'
- classmethod from_options(options: collections.abc.Mapping[str, Any] | None) ScipyMinimizeAdapter
Build minimize adapter and normalize method setting.
- Returns:
Configured SciPy minimize adapter instance.
- method = 'L-BFGS-B'
- kwargs
- minimize(fun: ResidualFunction, jac: collections.abc.Callable[[numpy.ndarray], numpy.ndarray] | None, phi0: numpy.ndarray, bounds: BoundsLike, callbacks: collections.abc.Iterable[Callback] | None = None, candidate_fun: ResidualFunction | None = None) tuple[numpy.ndarray, dict[str, object]]
Run SciPy minimize and report optimizer metadata.
- Returns:
Tuple of optimal φ vector and metadata dictionary.
- class pyfebiopt.optimize.optimizers.ParallelObjectiveMap(max_workers: int)
Thread-backed map callable compatible with SciPy differential_evolution.
Create a bounded worker pool for scalar objective evaluations.
- max_workers
- __call__(func: collections.abc.Callable[[numpy.ndarray], float], iterable: collections.abc.Iterable[numpy.ndarray]) list[float]
Evaluate candidates concurrently while preserving SciPy’s map order.
- Returns:
Scalar objective values in the same order as the input candidates.
- shutdown() None
Release worker threads.
- __enter__() ParallelObjectiveMap
Return the map callable for context-managed use.
- __exit__(*_exc_info: object) None
Shut down worker threads when SciPy returns or raises.
- class pyfebiopt.optimize.optimizers.ScipyDifferentialEvolutionAdapter(**kwargs: Any)
Bases:
OptimizerAdapterAdapter that wraps
scipy.optimize.differential_evolution().Store keyword arguments forwarded to SciPy.
- optimizer_name = 'differential_evolution'
- kwargs
- minimize(fun: ResidualFunction, jac: collections.abc.Callable[[numpy.ndarray], numpy.ndarray] | None, phi0: numpy.ndarray, bounds: BoundsLike, callbacks: collections.abc.Iterable[Callback] | None = None, candidate_fun: ResidualFunction | None = None) tuple[numpy.ndarray, dict[str, object]]
Run SciPy differential_evolution and report optimizer metadata.
- Returns:
Tuple of optimal φ vector and metadata dictionary.