gemseo / algos

# driver_factory module¶

## Abstract factory to create drivers¶

Classes:

 DriverFactory(driver_lib_class, driver_package) Base class for definition of optimization and/or DOE factory.
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

Attributes:

 algo_names_to_libraries algorithms Lists the available algorithms names in the present configuration. libraries Lists the available library names in the present configuration.

Methods:

 create(name) Factory method to create a DriverLib subclass from algo identifier or a library identifier. execute(problem, algo_name, **options) Finds the appropriate library and executes the driver on the problem. is_available(name) Checks the availability of a library name or algorithm name.
property algo_names_to_libraries
property algorithms

Lists the available algorithms names in the present configuration.

Returns

the list of algorithms as a string list

create(name)[source]

Factory method to create a DriverLib subclass from algo identifier or a library identifier.

Parameters

name (string) – library or algorithm name

Returns

library according to context (optimization or DOE for instance)

execute(problem, algo_name, **options)[source]

Finds the appropriate library and executes the driver on the problem.

Parameters
• problem – the problem on which to run the execution

• algo_name – the algorithm name

• options – the options dict for the DOE, see associated JSON file

is_available(name)[source]

Checks the availability of a library name or algorithm name.

Parameters

name – the name of the library name or algorithm name

Returns

True if the library is installed

property libraries

Lists the available library names in the present configuration.

Returns

the list of libraries as a string list