driver_lib module¶
Driver library¶
A driver library aims to solve an DriverLib
using a particular algorithm from a particular family of numerical methods.
This algorithm will be in charge of evaluating the objective and constraints
functions at different points of the design space, using the
DriverLib.execute()
method.
The most famous kinds of numerical methods to solve an optimization problem
are optimization algorithms and design of experiments (DOE). A DOE driver
browses the design space agnostically, i.e. without taking into
account the function evaluations. On the contrary, an optimization algorithm
uses this information to make the journey through design space
as relevant as possible in order to reach as soon as possible the optimum.
These families are implemented in DOELibrary
and OptimizationLibrary
.
-
class
gemseo.algos.driver_lib.
DriverLib
[source]¶ Bases:
object
Abstract class for DOE & optimization libraries interfaces
Lists available methods in the library for the proposed problem to be solved
To integrate an optimization package, inherit from this class and put your file in gemseo.algos.doe or gemseo.algo.opt packages
Constructor
-
COMPLEX_STEP_METHOD
= 'complex_step'¶
-
DESCRIPTION
= 'description'¶
-
DIFFERENTIATION_METHODS
= ['user', 'complex_step', 'finite_differences']¶
-
EQ_TOLERANCE
= 'eq_tolerance'¶
-
FINITE_DIFF_METHOD
= 'finite_differences'¶
-
HANDLE_EQ_CONS
= 'handle_equality_constraints'¶
-
HANDLE_INEQ_CONS
= 'handle_inequality_constraints'¶
-
INEQ_TOLERANCE
= 'ineq_tolerance'¶
-
INTERNAL_NAME
= 'internal_algo_name'¶
-
LIB
= 'lib'¶
-
MAX_DS_SIZE_PRINT
= 40¶
-
NORMALIZE_DESIGN_SPACE_OPTION
= 'normalize_design_space'¶
-
OPTIONS_DIR
= 'options'¶
-
OPTIONS_MAP
= {}¶
-
POSITIVE_CONSTRAINTS
= 'positive_constraints'¶
-
REQUIRE_GRAD
= 'require_grad'¶
-
USER_DEFINED_GRADIENT
= 'user'¶
-
USE_DATABASE_OPTION
= 'use_database'¶
-
WEBSITE
= 'website'¶
-
property
algorithms
¶ Return the available algorithms.
-
execute
(problem, algo_name=None, **options)[source]¶ Executes the driver
- Parameters
problem – the problem to be solved
algo_name – name of the algorithm if None, use self.algo_name which may have been set by the factory (Default value = None)
options – the options dict for the algorithm
-
filter_adapted_algorithms
(problem)[source]¶ Filters the algorithms capable of solving the problem
- Parameters
problem – the opt_problem to be solved
- Returns
the list of adapted algorithms names
-
get_optimum_from_database
(message=None, status=None)[source]¶ Retrieves the optimum from the database and builds an optimization result object from it
- Parameters
message – Default value = None)
status – Default value = None)
-
get_x0_and_bounds_vects
(normalize_ds)[source]¶ Gets x0, bounds, normalized or not depending on algo options, all as numpy arrays
- Parameters
normalize_ds – if True, normalizes all input vars that are not integers, according to design space normalization policy
- Returns
x, lower bounds, upper bounds
-
init_options_grammar
(algo_name)[source]¶ Initializes the options grammar
- Parameters
algo_name – name of the algorithm
-
init_progress_bar
(max_iter, message)[source]¶ Initializes the progress bar
- Parameters
max_iter – maximum number of calls
message – message to display at the beginning
-
is_algo_requires_grad
(algo_name)[source]¶ Returns True if the algorithm requries a gradient evaluation
- Parameters
algo_name – name of the algorithm
-