gemseo.algos.base_driver_library module#

Base class for libraries of drivers.

A driver is an algorithm evaluating the functions of an EvaluationProblem at different points of the design space, using the execute() method. In the case of an OptimizationProblem, this method also returns an OptimizationResult.

There are two main families of drivers: the optimizers with the base class BaseOptimizationLibrary and the design of experiments (DOE) with the base class BaseDOELibrary.

class BaseDriverLibrary(algo_name)[source]#

Bases: BaseAlgorithmLibrary

Base class for libraries of drivers.

Parameters:

algo_name (str) -- The algorithm name.

Raises:

KeyError -- When the algorithm is not in the library.

class ApproximationMode(value)#

Bases: StrEnum

The approximation derivation modes.

CENTERED_DIFFERENCES = 'centered_differences'#

The centered differences method used to approximate the Jacobians by perturbing each variable with a small real number.

COMPLEX_STEP = 'complex_step'#

The complex step method used to approximate the Jacobians by perturbing each variable with a small complex number.

FINITE_DIFFERENCES = 'finite_differences'#

The finite differences method used to approximate the Jacobians by perturbing each variable with a small real number.

class DifferentiationMethod(value)#

Bases: StrEnum

The differentiation methods.

CENTERED_DIFFERENCES = 'centered_differences'#
COMPLEX_STEP = 'complex_step'#
FINITE_DIFFERENCES = 'finite_differences'#
NO_DERIVATIVE = 'no_derivative'#
USER_GRAD = 'user'#
execute(problem, eval_obs_jac=False, skip_int_check=False, max_design_space_dimension_to_log=40, settings_model=None, **settings)[source]#

Solve a problem with an algorithm from this library.

Parameters:
  • problem (EvaluationProblem) -- The problem to be solved.

  • eval_obs_jac (bool) --

    Whether to evaluate the Jacobian of the observables.

    By default it is set to False.

  • skip_int_check (bool) --

    Whether to skip the integer variable handling check of the selected algorithm.

    By default it is set to False.

  • max_design_space_dimension_to_log (int) --

    The maximum dimension of a design space to be logged. If this number is higher than the dimension of the design space then the design space will not be logged.

    By default it is set to 40.

  • settings_model (BaseDriverSettings | None) -- The algorithm settings as a Pydantic model. If None, use **settings.

  • **settings (Any) -- The algorithm settings. These arguments are ignored when settings_model is not None.

Returns:

The solution found by the algorithm.

Return type:

OptimizationResult

ALGORITHM_INFOS: ClassVar[dict[str, DriverDescription]] = {}#

The description of the algorithms contained in the library.

enable_progress_bar: bool = True#

Whether to enable the progress bar in the evaluation log.

class DriverDescription(algorithm_name, internal_algorithm_name, library_name='', description='', website='', Settings=<class 'gemseo.algos.base_driver_settings.BaseDriverSettings'>, handle_integer_variables=False)[source]#

Bases: AlgorithmDescription

The description of a driver.

Parameters:
  • algorithm_name (str)

  • internal_algorithm_name (str)

  • library_name (str) --

    By default it is set to "".

  • description (str) --

    By default it is set to "".

  • website (str) --

    By default it is set to "".

  • Settings (type[BaseDriverSettings]) --

    By default it is set to <class 'gemseo.algos.base_driver_settings.BaseDriverSettings'>.

  • handle_integer_variables (bool) --

    By default it is set to False.

Settings#

The Pydantic model for the driver library settings.

alias of BaseDriverSettings

handle_integer_variables: bool = False#

Whether the driver handles integer variables.