doe_library module¶
Base DOE library.
- class gemseo.algos.doe.doe_library.DOEAlgorithmDescription(algorithm_name, internal_algorithm_name, library_name='', description='', website='', handle_integer_variables=True, require_gradient=False, minimum_dimension=1)[source]
Bases:
DriverDescription
The description of a DOE algorithm.
- 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 “”.
handle_integer_variables (bool) –
By default it is set to True.
require_gradient (bool) –
By default it is set to False.
minimum_dimension (int) –
By default it is set to 1.
- algorithm_name: str
The name of the algorithm in GEMSEO.
- handle_integer_variables: bool = True
Whether the optimization algorithm handles integer variables.
- internal_algorithm_name: str
The name of the algorithm in the wrapped library.
- minimum_dimension: int = 1
The minimum dimension of the parameter space.
- class gemseo.algos.doe.doe_library.DOELibrary[source]
Bases:
DriverLibrary
Abstract class to use for DOE library link See DriverLibrary.
Constructor Abstract class.
- compute_doe(variables_space, size=None, unit_sampling=False, **options)[source]
Compute a design of experiments (DOE) in a variables space.
- Parameters:
variables_space (DesignSpace) – The variables space to be sampled.
size (int | None) – The size of the DOE. If
None
, the size is deduced from theoptions
.unit_sampling (bool) –
Whether to sample in the unit hypercube.
By default it is set to False.
**options (DOELibraryOptionType) – The options of the DOE algorithm.
- Returns:
The design of experiments whose rows are the samples and columns the variables.
- Return type:
ndarray
- evaluate_samples(eval_jac=False, n_processes=1, wait_time_between_samples=0.0)[source]
Evaluate all the functions of the optimization problem at the samples.
- Parameters:
eval_jac (bool) –
Whether to evaluate the Jacobian.
By default it is set to False.
n_processes (int) –
The maximum simultaneous number of processes used to parallelize the execution.
By default it is set to 1.
wait_time_between_samples (float) –
The time to wait between each sample evaluation, in seconds.
By default it is set to 0.0.
- Return type:
None
Warning
This class relies on multiprocessing features when
n_processes > 1
, it is therefore necessary to protect its execution with anif __name__ == '__main__':
statement when working on Windows.
- export_samples(doe_output_file)[source]
Export the samples generated by DOE library to a CSV file.
- Parameters:
doe_output_file (Path | str) – The path to the output file.
- Return type:
None
- DESIGN_ALGO_NAME = 'Design algorithm'
- DIMENSION = 'dimension'
- EVAL_JAC = 'eval_jac'
- LEVEL_KEYWORD = 'levels'
- N_PROCESSES = 'n_processes'
- N_SAMPLES = 'n_samples'
- PHIP_CRITERIA = 'phi^p'
- SAMPLES_TAG = 'samples'
- SEED = 'seed'
- WAIT_TIME_BETWEEN_SAMPLES = 'wait_time_between_samples'
- descriptions: dict[str, AlgorithmDescription]
The description of the algorithms contained in the library.
- eval_jac: bool
Whether to evaluate the Jacobian.
- internal_algo_name: str | None
The internal name of the algorithm used currently.
It typically corresponds to the name of the algorithm in the wrapped library if any.
- opt_grammar: JSONGrammar | None
The grammar defining the options of the current algorithm.
- problem: Any | None
The problem to be solved.
- samples: ndarray
The input samples with the design space variable types stored as dtype metadata.
- seed: int
The seed to be used for reproducibility reasons.
This seed is initialized at 0 and each call to
execute()
increments it before using it.
- unit_samples: ndarray
The input samples transformed in \([0,1]\).