gemseo /
algos
driver_factory module
Abstract factory to create drivers.
-
class gemseo.algos.driver_factory.DriverFactory(driver_lib_class, driver_package)[source]
Bases: object
Base class for definition of optimization and/or DOE factory.
Automates the creation of library interfaces given a name of the algorithm.
Initializes the factory: scans the directories to search for subclasses of
DriverLib.
Searches subclasses of driver_lib_class in “GEMSEO_PATH” and driver_package.
- Parameters:
-
-
create(name)[source]
Create a driver library from an algorithm name or a library name.
- Parameters:
name (str) – The name of a library or algorithm.
- Returns:
The driver library.
- Return type:
DriverLib
-
execute(problem, algo_name, **options)[source]
Execute a problem with an algorithm.
- Parameters:
problem (OptimizationProblem) – The problem to execute.
algo_name (str) – The name of the algorithm.
**options (Any) – The options of the algorithm.
- Returns:
The optimization result.
- Return type:
OptimizationResult
-
is_available(name)[source]
Check the availability of a library name or algorithm name.
- Parameters:
name (str) – The name of the library name or algorithm name.
- Returns:
Whether the library or algorithm is available.
- Return type:
bool
-
property algo_names_to_libraries: dict[str, str]
The mapping from the algorithm names to the libraries.
-
property algorithms: list[str]
The available algorithms names.
-
property libraries: list[str]
List the available library names in the present configuration.
- Returns:
The names of the available libraries.
Examples using DriverFactory