lib_openturns module¶
OpenTUNRS DOE algorithms wrapper¶
Classes:
OpenTURNS library of DOE algorithms wrapping. |
- class gemseo.algos.doe.lib_openturns.OpenTURNS[source]¶
Bases:
gemseo.algos.doe.doe_lib.DOELibrary
OpenTURNS library of DOE algorithms wrapping.
Constructor Unless mentioned, DOE are normalized between [0,1]
Attributes:
Return the available algorithms.
Methods:
check_distribution_name
(distribution_name)Check that distribution is available.
compute_phip_criteria
(samples)Compute the phi^p criteria (see Morris & Mitchell, Exploratory designs for computational experiments, 1995)
Create a composed distribution from a list of distributions.
create_distribution
([distribution_name])Create a distribution for all design vectors and add it to the list of distributions.
Display list of distributions use or that will be used for DOE design based on LHS or Monte-Carlo methods.
driver_has_option
(option_key)Checks if the option key exists.
ensure_bounds
(orig_func[, normalize])Project the design vector onto the design space before execution.
evaluate_samples
([eval_jac, n_processes, …])Evaluates all functions of optimization problem at the samples.
execute
(problem[, algo_name])Executes the driver.
export_samples
(doe_output_file)Export samples generated by DOE library to a csv file.
filter_adapted_algorithms
(problem)Filters the algorithms capable of solving the problem.
Finalize the iteration observer.
Returns the composed distributions.
Accessor for distributions list.
get_optimum_from_database
([message, status])Retrieves the optimum from the database and builds an optimization result object from it.
get_x0_and_bounds_vects
(normalize_ds)Gets x0, bounds, normalized or not depending on algo options, all as numpy arrays.
init_iter_observer
(max_iter, message)Initialize the iteration observer.
init_options_grammar
(algo_name)Initializes the options grammar.
is_algo_requires_grad
(algo_name)Returns True if the algorithm requires a gradient evaluation.
is_algorithm_suited
(algo_dict, problem)Checks if the algorithm is suited to the problem according to its algo dict.
Callback called at each new iteration, ie every time a design vector that is not already in the database is proposed by the optimizer.
plot_distribution
(distribution[, show])Plot the density PDF & the CDF (cumulative) of a given distribution.
- ALGO_LIST = ['OT_SOBOL', 'OT_HASELGROVE', 'OT_REVERSE_HALTON', 'OT_HALTON', 'OT_FAURE', 'OT_AXIAL', 'OT_FACTORIAL', 'OT_MONTE_CARLO', 'OT_LHS', 'OT_LHSC', 'OT_OPT_LHS', 'OT_RANDOM', 'OT_FULLFACT', 'OT_COMPOSITE', 'OT_SOBOL_INDICES']¶
- ANNEALING = 'annealing'¶
- CENTER_KEYWORD = 'centers'¶
- COMPLEX_STEP_METHOD = 'complex_step'¶
- CRITERIA = {'C2': <class 'openturns.weightedexperiment.SpaceFillingC2'>, 'MinDist': <class 'openturns.weightedexperiment.SpaceFillingMinDist'>, 'PhiP': <class 'openturns.weightedexperiment.SpaceFillingPhiP'>}¶
- CRITERION = 'criterion'¶
- DESCRIPTION = 'description'¶
- DESC_LIST = ['Sobol sequence implemented in openTURNS library', 'Haselgrove sequence implemented in openTURNS library', 'Reverse Halton sequence implemented in openTURNS library', 'Halton sequence implemented in openTURNS library', 'Faure sequence implemented in openTURNS library', 'Axial design implemented in openTURNS library', 'Factorial design implemented in openTURNS library', 'Monte Carlo sequence implemented in openTURNS library', 'Latin Hypercube Sampling implemented in openTURNS library', 'Centered Latin Hypercube Sampling implemented in openTURNS library', 'Optimal Latin Hypercube Sampling implemented in openTURNS library', 'Random sampling implemented in openTURNS library', 'Full factorial design implementedin openTURNS library', 'Composite design implemented in openTURNS library', 'Sobol indices']¶
- DESIGN_ALGO_NAME = 'Design algorithm'¶
- DIFFERENTIATION_METHODS = ['user', 'complex_step', 'finite_differences']¶
- DIMENSION = 'dimension'¶
- DISTRIBUTION_DEFAULT = 'Uniform'¶
- DISTRIBUTION_KEYWORD = 'distribution_name'¶
- DISTRIBUTION_LIST = ['Arcsine', 'Beta', 'Dirichlet', 'Normal', 'TruncatedNormal', 'Triangular', 'Trapezoidal', 'Uniform']¶
- DOE_SETTINGS_OPTIONS = ['levels', 'distribution_name', 'mu', 'sigma', 'start', 'end', 'centers']¶
- END_KEYWORD = 'end'¶
- EQ_TOLERANCE = 'eq_tolerance'¶
- EVAL_JAC = 'eval_jac'¶
- 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'¶
- LEVEL_KEYWORD = 'levels'¶
- LIB = 'lib'¶
- MAX_DS_SIZE_PRINT = 40¶
- MAX_TIME = 'max_time'¶
- MEAN_KEYWORD = 'mu'¶
- MIN_DIMS = 'min_dims'¶
- NORMALIZE_DESIGN_SPACE_OPTION = 'normalize_design_space'¶
- N_PROCESSES = 'n_processes'¶
- N_REPLICATES = 'n_replicates'¶
- N_SAMPLES = 'n_samples'¶
- OPTIONS_DIR = 'options'¶
- OPTIONS_MAP = {}¶
- OT_ARCSINE = 'Arcsine'¶
- OT_AXIAL = 'OT_AXIAL'¶
- OT_AXIAL_DESC = 'Axial design implemented in openTURNS library'¶
- OT_AXIAL_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.Axial.html'¶
- OT_BETA = 'Beta'¶
- OT_COMPOSITE = 'OT_COMPOSITE'¶
- OT_COMPOSITE_DESC = 'Composite design implemented in openTURNS library'¶
- OT_COMPOSITE_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.Composite.html'¶
- OT_DIRICHLET = 'Dirichlet'¶
- OT_DOC = 'http://openturns.github.io/openturns/master/user_manual/'¶
- OT_FACTORIAL = 'OT_FACTORIAL'¶
- OT_FACTORIAL_DESC = 'Factorial design implemented in openTURNS library'¶
- OT_FACTORIAL_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.Factorial.html'¶
- OT_FAURE = 'OT_FAURE'¶
- OT_FAURE_DESC = 'Faure sequence implemented in openTURNS library'¶
- OT_FAURE_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.FaureSequence.html'¶
- OT_FULLFACT = 'OT_FULLFACT'¶
- OT_FULLFACT_DESC = 'Full factorial design implementedin openTURNS library'¶
- OT_FULLFACT_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.Box.html'¶
- OT_HALTON = 'OT_HALTON'¶
- OT_HALTON_DESC = 'Halton sequence implemented in openTURNS library'¶
- OT_HALTON_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.HaltonSequence.html'¶
- OT_HASEL = 'OT_HASELGROVE'¶
- OT_HASEL_DESC = 'Haselgrove sequence implemented in openTURNS library'¶
- OT_HASEL_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.HaselgroveSequence.html'¶
- OT_LHS = 'OT_LHS'¶
- OT_LHSC = 'OT_LHSC'¶
- OT_LHSC_DESC = 'Centered Latin Hypercube Sampling implemented in openTURNS library'¶
- OT_LHSC_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.LHS.html'¶
- OT_LHSO = 'OT_OPT_LHS'¶
- OT_LHSO_DESC = 'Optimal Latin Hypercube Sampling implemented in openTURNS library'¶
- OT_LHSO_WEB = 'https://openturns.github.io/openturns/master/examples/optimal_lhs.html'¶
- OT_LHS_DESC = 'Latin Hypercube Sampling implemented in openTURNS library'¶
- OT_LHS_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.LHS.html'¶
- OT_MC = 'OT_MONTE_CARLO'¶
- OT_MC_DESC = 'Monte Carlo sequence implemented in openTURNS library'¶
- OT_MC_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.RandomGenerator.html'¶
- OT_NORMAL = 'Normal'¶
- OT_RANDOM = 'OT_RANDOM'¶
- OT_RANDOM_DESC = 'Random sampling implemented in openTURNS library'¶
- OT_RANDOM_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.RandomGenerator.html'¶
- OT_REVERSE_HALTON = 'OT_REVERSE_HALTON'¶
- OT_REVERSE_HALTON_DESC = 'Reverse Halton sequence implemented in openTURNS library'¶
- OT_REVERSE_HALTON_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.ReverseHaltonSequence.html'¶
- OT_SOBOL = 'OT_SOBOL'¶
- OT_SOBOL_DESC = 'Sobol sequence implemented in openTURNS library'¶
- OT_SOBOL_INDICES = 'OT_SOBOL_INDICES'¶
- OT_SOBOL_INDICES_DESC = 'Sobol indices'¶
- OT_SOBOL_INDICES_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.SobolIndicesAlgorithm.html'¶
- OT_SOBOL_WEB = 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.SobolSequence.html'¶
- OT_TRAPEZOIDAL = 'Trapezoidal'¶
- OT_TRIANGULAR = 'Triangular'¶
- OT_TRUNCNORMAL = 'TruncatedNormal'¶
- OT_UNIFORM = 'Uniform'¶
- PHIP_CRITERIA = 'phi^p'¶
- POSITIVE_CONSTRAINTS = 'positive_constraints'¶
- PROBLEM_TYPE = 'problem_type'¶
- REQUIRE_GRAD = 'require_grad'¶
- ROUND_INTS_OPTION = 'round_ints'¶
- SAMPLES_TAG = 'samples'¶
- SEED = 'seed'¶
- START_KEYWORD = 'start'¶
- STD_KEYWORD = 'sigma'¶
- TEMPERATURE = 'temperature'¶
- TEMPERATURES = {'Geometric': <class 'openturns.weightedexperiment.GeometricProfile'>, 'Linear': <class 'openturns.weightedexperiment.LinearProfile'>}¶
- USER_DEFINED_GRADIENT = 'user'¶
- USE_DATABASE_OPTION = 'use_database'¶
- WAIT_TIME_BETWEEN_SAMPLES = 'wait_time_between_samples'¶
- WEBSITE = 'website'¶
- WEB_LIST = ['http://openturns.github.io/openturns/master/user_manual/_generated/openturns.SobolSequence.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.HaselgroveSequence.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.ReverseHaltonSequence.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.HaltonSequence.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.FaureSequence.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.Axial.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.Factorial.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.RandomGenerator.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.LHS.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.LHS.html', 'https://openturns.github.io/openturns/master/examples/optimal_lhs.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.RandomGenerator.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.Box.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.Composite.html', 'http://openturns.github.io/openturns/master/user_manual/_generated/openturns.SobolIndicesAlgorithm.html']¶
- property algorithms¶
Return the available algorithms.
- check_distribution_name(distribution_name)[source]¶
Check that distribution is available.
- Parameters
distribution_name (string) – name of the distribution
- static compute_phip_criteria(samples)¶
Compute the phi^p criteria (see Morris & Mitchell, Exploratory designs for computational experiments, 1995)
- Parameters
samples – design variables list
- create_composed_distributions()[source]¶
Create a composed distribution from a list of distributions.
- create_distribution(distribution_name='Uniform', **options)[source]¶
Create a distribution for all design vectors and add it to the list of distributions.
- Parameters
distribution_name (str) – name of the distribution (Default value = “Uniform”)
options (dict) – optional parameters
options – OT distributions options
- display_distributions_list()[source]¶
Display list of distributions use or that will be used for DOE design based on LHS or Monte-Carlo methods.
- driver_has_option(option_key)¶
Checks if the option key exists.
- Parameters
option_key – the name of the option
- Returns
True if the option is in the grammar
- ensure_bounds(orig_func, normalize=True)¶
Project the design vector onto the design space before execution.
- Parameters
orig_func – the original function
normalize – if True, use the normalized design space
- Returns
the wrapped function
- evaluate_samples(eval_jac=False, n_processes=1, wait_time_between_samples=0)¶
Evaluates all functions of optimization problem at the samples.
- Parameters
eval_jac – if True, the jacobian is also evaluated (Default value = False)
- execute(problem, algo_name=None, **options)¶
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
- export_samples(doe_output_file)¶
Export samples generated by DOE library to a csv file.
- Parameters
doe_output_file (string) – export file name
- filter_adapted_algorithms(problem)¶
Filters the algorithms capable of solving the problem.
- Parameters
problem – the opt_problem to be solved
- Returns
the list of adapted algorithms names
- finalize_iter_observer()¶
Finalize the iteration observer.
- get_composed_distributions()[source]¶
Returns the composed distributions.
- Returns
composed distributions
- Return type
openturns.ComposedDistribution
- get_distributions_list()[source]¶
Accessor for distributions list.
- Returns
distribution list
- Return type
list
- get_optimum_from_database(message=None, status=None)¶
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)¶
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_iter_observer(max_iter, message)¶
Initialize the iteration observer.
It will handle the stopping criterion and the logging of the progress bar.
- Parameters
max_iter – maximum number of calls
message – message to display at the beginning
- init_options_grammar(algo_name)¶
Initializes the options grammar.
- Parameters
algo_name – name of the algorithm
- is_algo_requires_grad(algo_name)¶
Returns True if the algorithm requires a gradient evaluation.
- Parameters
algo_name – name of the algorithm
- static is_algorithm_suited(algo_dict, problem)¶
Checks if the algorithm is suited to the problem according to its algo dict.
- Parameters
algo_dict – the algorithm characteristics
problem – the opt_problem to be solved
- new_iteration_callback()¶
Callback called at each new iteration, ie every time a design vector that is not already in the database is proposed by the optimizer.
Iterates the progress bar, implements the stop criteria.