From 8c4f969eecee68bebd13f291d7611a0939a100c8 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Fri, 20 Jan 2023 20:11:57 +0100 Subject: [PATCH] Documentation and code update for EOSG --- ...thm_EnsembleOfSimulationGenerationTask.rst | 132 +++++++++++++++++ doc/en/ref_algorithm_FunctionTest.rst | 1 + ...thm_MeasurementsOptimalPositioningTask.rst | 29 ++-- doc/en/ref_algorithm_ParallelFunctionTest.rst | 1 + doc/en/ref_algorithm_SamplingTest.rst | 20 +-- doc/en/reference.rst | 1 + ...thm_EnsembleOfSimulationGenerationTask.rst | 134 ++++++++++++++++++ doc/fr/ref_algorithm_FunctionTest.rst | 1 + ...thm_MeasurementsOptimalPositioningTask.rst | 29 ++-- doc/fr/ref_algorithm_ParallelFunctionTest.rst | 1 + doc/fr/ref_algorithm_SamplingTest.rst | 27 ++-- doc/fr/reference.rst | 1 + .../EnsembleOfSimulationGenerationTask.py | 97 +++++++++++++ 13 files changed, 433 insertions(+), 41 deletions(-) create mode 100644 doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst create mode 100644 doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst create mode 100644 src/daComposant/daAlgorithms/EnsembleOfSimulationGenerationTask.py diff --git a/doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst b/doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst new file mode 100644 index 0000000..1624c1f --- /dev/null +++ b/doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst @@ -0,0 +1,132 @@ +.. + Copyright (C) 2008-2023 EDF R&D + + This file is part of SALOME ADAO module. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + + Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D + +.. index:: single: EnsembleOfSimulationGenerationTask +.. index:: single: Génération d'ensemble de simulations +.. index:: single: Ensemble of simulations +.. index:: single: Ensemble of snapshots +.. index:: single: Simulations (Ensemble) +.. index:: single: Snapshots (Ensemble) +.. _section_ref_algorithm_EnsembleOfSimulationGenerationTask: + +Task algorithm "*EnsembleOfSimulationGenerationTask*" +----------------------------------------------------- + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo00.rst + +.. warning:: + + This algorithm is only available in textual user interface (TUI) and not in + graphical user interface (GUI). + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo01.rst + +This algorithm allows to generate a set of results, of simulation or +observation type, using the :math:`H` operator for a design of experiment of +the :math:`\mathbf{x}` parametric state space. The result of this algorithm is +a homogeneous collection of simulated vectors (available using the storable +variable "*EnsembleOfSimulations*") corresponding directly to the chosen +homogeneous collection of state vectors (available using the storable variable +"*EnsembleOfStates*"). + +The sampling of the states :math:`\mathbf{x}` can be given explicitly or under +form of hyper-cubes, explicit or sampled according to classic distributions. +Beware of the size of the hyper-cube (and then to the number of computations) +that can be reached, it can grow quickly to be quite large. + +To be visible by the user while reducing the risk of storage difficulties, the +results of sampling or simulations has to be **explicitly** asked for. One use +for that, on the desired variable, the final saving through +"*UserPostAnalysis*" or the treatment during the calculation by "*observer*". + +The results obtained with this algorithm can be used to feed an +:ref:`section_ref_algorithm_MeasurementsOptimalPositioningTask`. In a +complementary way, and if the goal is to evaluate the calculation-measurement +error, an :ref:`section_ref_algorithm_SamplingTest` uses the same sampling +commands to establish a set of error functional values :math:`J` from +observations :math:`\mathbf{y}^o`. + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo02.rst + +.. include:: snippets/CheckingPoint.rst + +.. include:: snippets/ObservationOperator.rst + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo03Task.rst + +.. include:: snippets/SampleAsExplicitHyperCube.rst + +.. include:: snippets/SampleAsIndependantRandomVariables.rst + +.. include:: snippets/SampleAsMinMaxStepHyperCube.rst + +.. include:: snippets/SampleAsnUplet.rst + +.. include:: snippets/SetDebug.rst + +.. include:: snippets/SetSeed.rst + +StoreSupplementaryCalculations + .. index:: single: StoreSupplementaryCalculations + + *List of names*. This list indicates the names of the supplementary + variables, that can be available during or at the end of the algorithm, if + they are initially required by the user. Their avalability involves, + potentially, costly calculations or memory consumptions. The default is then + a void list, none of these variables being calculated and stored by default + (excepted the unconditionnal variables). The possible names are in the + following list (the detailed description of each named variable is given in + the following part of this specific algorithmic documentation, in the + sub-section "*Information and variables available at the end of the + algorithm*"): [ + "EnsembleOfSimulations", + "EnsembleOfStates", + ]. + + Example : + ``{"StoreSupplementaryCalculations":["CurrentState", "Residu"]}`` + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo04.rst + +.. include:: snippets/EnsembleOfSimulations.rst + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo05.rst + +.. include:: snippets/EnsembleOfSimulations.rst + +.. include:: snippets/EnsembleOfStates.rst + +.. ------------------------------------ .. +.. _section_ref_algorithm_EnsembleOfSimulationGenerationTask_examples: +.. include:: snippets/Header2Algo06.rst + +- :ref:`section_ref_algorithm_FunctionTest` +- :ref:`section_ref_algorithm_ParallelFunctionTest` +- :ref:`section_ref_algorithm_MeasurementsOptimalPositioningTask` + diff --git a/doc/en/ref_algorithm_FunctionTest.rst b/doc/en/ref_algorithm_FunctionTest.rst index 9fe8bea..dee2969 100644 --- a/doc/en/ref_algorithm_FunctionTest.rst +++ b/doc/en/ref_algorithm_FunctionTest.rst @@ -122,3 +122,4 @@ StoreSupplementaryCalculations - :ref:`section_ref_algorithm_InputValuesTest` - :ref:`section_ref_algorithm_LinearityTest` - :ref:`section_ref_algorithm_ParallelFunctionTest` +- :ref:`section_ref_algorithm_EnsembleOfSimulationGenerationTask` diff --git a/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst b/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst index fce8a72..a944d83 100644 --- a/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst +++ b/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst @@ -50,22 +50,24 @@ This algorithm provides optimal positioning of measurement points by an EIM iterative greedy way, from a pre-existing set of state vectors (usually called "snapshots" in reduced basis methodology) or obtained by a direct simulation during the algorithm. Each of these state vectors are usually (but not -necessarily) the result :math:`\mathbf{y}` of a simulation :math:`H` for a -given set of parameters :math:`\mathbf{x}`. +necessarily) the result :math:`\mathbf{y}` of a simulation or an observation +using the operator :math:`H` for a given set of parameters :math:`\mathbf{x}`. There are two ways to use this algorithm: #. In its simplest use, if the set of state vectors is pre-existing, it is only - necessary to provide it by the algorithm option "*EnsembleOfSnapshots*". + necessary to provide it by the algorithm option "*EnsembleOfSnapshots*". It + is for example the case when set of states has been generated by an + :ref:`section_ref_algorithm_EnsembleOfSimulationGenerationTask`. #. If the set of state vectors is to be obtained by simulations during the - course of the algorithm, then one must provide the :math:`H` simulation - operator and the parametric :math:`\mathbf{x}` state space design of - experiments. + course of the algorithm, then one must provide the :math:`H` simulation or + observation operator and the parametric :math:`\mathbf{x}` state space + design of experiments. -The sample of states :math:`\mathbf{x}` can be provided explicitly or in the -form of hyper-cubes, explicit or sampled according to standard laws. Beware of -the size of the hyper-cube (and thus the number of computations) that can be -reached, it can quickly become important. +The sampling of the states :math:`\mathbf{x}` can be given explicitly or under +form of hyper-cubes, explicit or sampled according to classic distributions. +Beware of the size of the hyper-cube (and then to the number of computations) +that can be reached, it can grow quickly to be quite large. It is possible to exclude a priori potential positions for optimal measurement points, using the analysis variant "*lcEIM*" for a constrained positioning @@ -146,6 +148,13 @@ StoreSupplementaryCalculations .. ------------------------------------ .. .. _section_ref_algorithm_MeasurementsOptimalPositioningTask_examples: +.. include:: snippets/Header2Algo06.rst + +- :ref:`section_ref_algorithm_FunctionTest` +- :ref:`section_ref_algorithm_ParallelFunctionTest` +- :ref:`section_ref_algorithm_EnsembleOfSimulationGenerationTask` + +.. ------------------------------------ .. .. include:: snippets/Header2Algo07.rst - [Barrault04]_ diff --git a/doc/en/ref_algorithm_ParallelFunctionTest.rst b/doc/en/ref_algorithm_ParallelFunctionTest.rst index 53b81f1..d14f81f 100644 --- a/doc/en/ref_algorithm_ParallelFunctionTest.rst +++ b/doc/en/ref_algorithm_ParallelFunctionTest.rst @@ -112,3 +112,4 @@ StoreSupplementaryCalculations - :ref:`section_ref_algorithm_FunctionTest` - :ref:`section_ref_algorithm_InputValuesTest` - :ref:`section_ref_algorithm_LinearityTest` +- :ref:`section_ref_algorithm_EnsembleOfSimulationGenerationTask` diff --git a/doc/en/ref_algorithm_SamplingTest.rst b/doc/en/ref_algorithm_SamplingTest.rst index f067bb4..f924c87 100644 --- a/doc/en/ref_algorithm_SamplingTest.rst +++ b/doc/en/ref_algorithm_SamplingTest.rst @@ -31,22 +31,24 @@ Checking algorithm "*SamplingTest*" .. include:: snippets/Header2Algo01.rst This algorithm allows to calculate the values, linked to a :math:`\mathbf{x}` -state, of a general error function :math:`J` of type :math:`L^1`, :math:`L^2` or -:math:`L^{\infty}`, with or without weights, and of the observation operator, -for an priori given states sample. The default error function is the augmented -weighted least squares function, classically used in data assimilation. +state, of a general error function :math:`J` of type :math:`L^1`, :math:`L^2` +or :math:`L^{\infty}`, with or without weights, and of the observation +operator, for an priori given :math:`\mathbf{x}` states sample. The default +error function is the augmented weighted least squares function, classically +used in data assimilation, using observation :math:`\mathbf{y}^o`. It is useful to test the sensitivity, of the error function :math:`J`, in particular, to the state :math:`\mathbf{x}` variations. When a state is not observable, a *"NaN"* value is returned. The sampling of the states :math:`\mathbf{x}` can be given explicitly or under -the form of hyper-cubes, explicit or sampled using classic distributions. Be -careful to the size of the hyper-cube (and then to the number of calculations) -that can be reached, it can be big very quickly. +form of hyper-cubes, explicit or sampled according to classic distributions. +Beware of the size of the hyper-cube (and then to the number of computations) +that can be reached, it can grow quickly to be quite large. -To be visible by the user, the results of sampling has to be explicitly asked -for. One use for that, on the desired variable, the final saving through +To be visible by the user while reducing the risk of storage difficulties, the +results of sampling or simulations has to be **explicitly** asked for. One use +for that, on the desired variable, the final saving through "*UserPostAnalysis*" or the treatment during the calculation by "*observer*". To perform distributed or more complex sampling, see OPENTURNS module available diff --git a/doc/en/reference.rst b/doc/en/reference.rst index 9aef3a1..7b294d4 100644 --- a/doc/en/reference.rst +++ b/doc/en/reference.rst @@ -163,5 +163,6 @@ algorithmic details. .. toctree:: :maxdepth: 1 + ref_algorithm_EnsembleOfSimulationGenerationTask ref_algorithm_MeasurementsOptimalPositioningTask ref_task_keywords diff --git a/doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst b/doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst new file mode 100644 index 0000000..5dc663d --- /dev/null +++ b/doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst @@ -0,0 +1,134 @@ +.. + Copyright (C) 2008-2023 EDF R&D + + This file is part of SALOME ADAO module. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + + Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D + +.. index:: single: EnsembleOfSimulationGenerationTask +.. index:: single: Génération d'ensemble de simulations +.. index:: single: Ensemble de simulations +.. index:: single: Ensemble de snapshots +.. index:: single: Simulations (Ensemble) +.. index:: single: Snapshots (Ensemble) +.. _section_ref_algorithm_EnsembleOfSimulationGenerationTask: + +Algorithme de tâche "*EnsembleOfSimulationGenerationTask*" +---------------------------------------------------------- + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo00.rst + +.. warning:: + + Cet algorithme n'est utilisable qu'en interface textuelle (TUI) et pas en + interface graphique (GUI). + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo01.rst + +Cet algorithme permet de générer un ensemble de résultats, de type simulation +ou observation, à l'aide de l'opérateur :math:`H` pour un plan d'expérience de +l'espace des états :math:`\mathbf{x}` paramétriques. Le résultat de cet +algorithme est une collection homogène des vecteurs simulés (disponible à +l'aide de la variable stockable "*EnsembleOfSimulations*") correspondants directement à +la collection homogène choisie de vecteurs d'états (disponible à l'aide de la +variable stockable "*EnsembleOfStates*"). + +L'échantillonnage des états :math:`\mathbf{x}` peut être fourni explicitement +ou sous la forme d'hyper-cubes, explicites ou échantillonnés selon des +distributions courantes. Attention à la taille de l'hyper-cube (et donc au +nombre de calculs) qu'il est possible d'atteindre, elle peut rapidement devenir +importante. + +Pour apparaître pour l'utilisateur tout en réduisant les difficultés de +stockage, les résultats de l'échantillonnage ou des simulations doivent être +demandés **explicitement**. On utilise pour cela, sur la variable désirée, la +sauvegarde finale à l'aide du mot-clé "*UserPostAnalysis*" ou le traitement en +cours de calcul à l'aide des "*observer*" adaptés. + +Les résultats obtenus avec cet algorithme peuvent être utilisés pour alimenter +un :ref:`section_ref_algorithm_MeasurementsOptimalPositioningTask`. De manière +complémentaire, et si le but est d'évaluer l'erreur calcul-mesure, un +:ref:`section_ref_algorithm_SamplingTest` utilise les mêmes commandes +d'échantillonnage pour établir un ensemble de valeurs de fonctionnelle d'erreur +:math:`J` à partir d'observations :math:`\mathbf{y}^o`. + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo02.rst + +.. include:: snippets/CheckingPoint.rst + +.. include:: snippets/ObservationOperator.rst + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo03Task.rst + +.. include:: snippets/SampleAsExplicitHyperCube.rst + +.. include:: snippets/SampleAsIndependantRandomVariables.rst + +.. include:: snippets/SampleAsMinMaxStepHyperCube.rst + +.. include:: snippets/SampleAsnUplet.rst + +.. include:: snippets/SetDebug.rst + +.. include:: snippets/SetSeed.rst + +StoreSupplementaryCalculations + .. index:: single: StoreSupplementaryCalculations + + *Liste de noms*. Cette liste indique les noms des variables supplémentaires, + qui peuvent être disponibles au cours du déroulement ou à la fin de + l'algorithme, si elles sont initialement demandées par l'utilisateur. Leur + disponibilité implique, potentiellement, des calculs ou du stockage coûteux. + La valeur par défaut est donc une liste vide, aucune de ces variables n'étant + calculée et stockée par défaut (sauf les variables inconditionnelles). Les + noms possibles pour les variables supplémentaires sont dans la liste suivante + (la description détaillée de chaque variable nommée est donnée dans la suite + de cette documentation par algorithme spécifique, dans la sous-partie + "*Informations et variables disponibles à la fin de l'algorithme*") : [ + "EnsembleOfSimulations", + "EnsembleOfStates", + ]. + + Exemple : + ``{"StoreSupplementaryCalculations":["CurrentState", "Residu"]}`` + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo04.rst + +.. include:: snippets/EnsembleOfSimulations.rst + +.. ------------------------------------ .. +.. include:: snippets/Header2Algo05.rst + +.. include:: snippets/EnsembleOfSimulations.rst + +.. include:: snippets/EnsembleOfStates.rst + +.. ------------------------------------ .. +.. _section_ref_algorithm_EnsembleOfSimulationGenerationTask_examples: +.. include:: snippets/Header2Algo06.rst + +- :ref:`section_ref_algorithm_FunctionTest` +- :ref:`section_ref_algorithm_ParallelFunctionTest` +- :ref:`section_ref_algorithm_MeasurementsOptimalPositioningTask` + diff --git a/doc/fr/ref_algorithm_FunctionTest.rst b/doc/fr/ref_algorithm_FunctionTest.rst index 7c58c0a..24ed26d 100644 --- a/doc/fr/ref_algorithm_FunctionTest.rst +++ b/doc/fr/ref_algorithm_FunctionTest.rst @@ -123,3 +123,4 @@ StoreSupplementaryCalculations - :ref:`section_ref_algorithm_InputValuesTest` - :ref:`section_ref_algorithm_LinearityTest` - :ref:`section_ref_algorithm_ParallelFunctionTest` +- :ref:`section_ref_algorithm_EnsembleOfSimulationGenerationTask` diff --git a/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst b/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst index e960a11..4938329 100644 --- a/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst +++ b/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst @@ -51,23 +51,25 @@ déterminées de manière itérative, à partir d'un ensemble de vecteurs d'éta pré-existants (usuellement appelés "*snapshots*" en méthodologie de bases réduites) ou obtenus par une simulation directe au cours de l'algorithme. Chacun de ces vecteurs d'état est habituellement (mais pas obligatoirement) le -résultat :math:`\mathbf{y}` d'une simulation :math:`H` pour un jeu de -paramètres donné :math:`\mathbf{x}`. +résultat :math:`\mathbf{y}` d'une simulation ou d'une observation à l'aide de +l'opérateur :math:`H` pour un jeu de paramètres donné :math:`\mathbf{x}`. Il y a deux manières d'utiliser cet algorithme: #. Dans son usage le plus simple, si l'ensemble des vecteurs d'état est pré-existant, il suffit de le fournir par l'option "*EnsembleOfSnapshots*" - d'algorithme. + d'algorithme. C'est par exemple le cas l'ensemble des états a été généré par + un :ref:`section_ref_algorithm_EnsembleOfSimulationGenerationTask`. #. Si l'ensemble des vecteurs d'état doit être obtenu par des simulations au - cours de l'algorithme, alors on doit fournir l'opérateur de simulation - :math:`H` et le plan d'expérience de l'espace des états :math:`\mathbf{x}` - paramétriques. + cours de l'algorithme, alors on doit fournir l'opérateur de simulation ou + d'observation :math:`H` et le plan d'expérience de l'espace des états + :math:`\mathbf{x}` paramétriques. -L'échantillon des états :math:`\mathbf{x}` peut être fourni explicitement ou -sous la forme d'hyper-cubes, explicites ou échantillonnés selon des lois -courantes. Attention à la taille de l'hyper-cube (et donc au nombre de calculs) -qu'il est possible d'atteindre, elle peut rapidement devenir importante. +L'échantillonnage des états :math:`\mathbf{x}` peut être fourni explicitement +ou sous la forme d'hyper-cubes, explicites ou échantillonnés selon des +distributions courantes. Attention à la taille de l'hyper-cube (et donc au +nombre de calculs) qu'il est possible d'atteindre, elle peut rapidement devenir +importante. Il est possible d'exclure a priori des positions potentielles pour les points de mesures optimaux, en utilisant le variant "*lcEIM*" d'analyse pour une @@ -148,6 +150,13 @@ StoreSupplementaryCalculations .. ------------------------------------ .. .. _section_ref_algorithm_MeasurementsOptimalPositioningTask_examples: +.. include:: snippets/Header2Algo06.rst + +- :ref:`section_ref_algorithm_FunctionTest` +- :ref:`section_ref_algorithm_ParallelFunctionTest` +- :ref:`section_ref_algorithm_EnsembleOfSimulationGenerationTask` + +.. ------------------------------------ .. .. include:: snippets/Header2Algo07.rst - [Barrault04]_ diff --git a/doc/fr/ref_algorithm_ParallelFunctionTest.rst b/doc/fr/ref_algorithm_ParallelFunctionTest.rst index 85e3d89..2f75a94 100644 --- a/doc/fr/ref_algorithm_ParallelFunctionTest.rst +++ b/doc/fr/ref_algorithm_ParallelFunctionTest.rst @@ -113,3 +113,4 @@ StoreSupplementaryCalculations - :ref:`section_ref_algorithm_FunctionTest` - :ref:`section_ref_algorithm_InputValuesTest` - :ref:`section_ref_algorithm_LinearityTest` +- :ref:`section_ref_algorithm_EnsembleOfSimulationGenerationTask` diff --git a/doc/fr/ref_algorithm_SamplingTest.rst b/doc/fr/ref_algorithm_SamplingTest.rst index 563d2df..42a2953 100644 --- a/doc/fr/ref_algorithm_SamplingTest.rst +++ b/doc/fr/ref_algorithm_SamplingTest.rst @@ -30,24 +30,27 @@ Algorithme de vérification "*SamplingTest*" .. ------------------------------------ .. .. include:: snippets/Header2Algo01.rst -Cet algorithme permet d'établir les valeurs, liées à un état :math:`\mathbf{x}`, -d'une fonctionnelle d'erreur :math:`J` quelconque de type :math:`L^1`, -:math:`L^2` ou :math:`L^{\infty}`, avec ou sans pondérations, et de l'opérateur -d'observation, pour un échantillon d'états donné a priori. La fonctionnelle -d'erreur par défaut est celle de moindres carrés pondérés augmentés, -classiquement utilisée en assimilation de données. +Cet algorithme permet d'établir les valeurs, liées à un état +:math:`\mathbf{x}`, d'une fonctionnelle d'erreur :math:`J` quelconque de type +:math:`L^1`, :math:`L^2` ou :math:`L^{\infty}`, avec ou sans pondérations, et +de l'opérateur d'observation, pour un échantillon d'états :math:`\mathbf{x}` +donné a priori. La fonctionnelle d'erreur par défaut est celle de moindres +carrés pondérés augmentés, classiquement utilisée en assimilation de données, +utilisant des observations :math:`\mathbf{y}^o`. Il est utile pour tester la sensibilité, de la fonctionnelle :math:`J`, en particulier, aux variations de l'état :math:`\mathbf{x}`. Lorsque un état n'est pas observable, une valeur *"NaN"* est retournée. -L'échantillon des états :math:`\mathbf{x}` peut être fourni explicitement ou -sous la forme d'hyper-cubes, explicites ou échantillonnés selon des lois -courantes. Attention à la taille de l'hyper-cube (et donc au nombre de calculs) -qu'il est possible d'atteindre, elle peut rapidement devenir importante. +L'échantillonnage des états :math:`\mathbf{x}` peut être fourni explicitement +ou sous la forme d'hyper-cubes, explicites ou échantillonnés selon des +distributions courantes. Attention à la taille de l'hyper-cube (et donc au +nombre de calculs) qu'il est possible d'atteindre, elle peut rapidement devenir +importante. -Pour apparaître pour l'utilisateur, les résultats de l'échantillonnage doivent -être demandés explicitement. On utilise pour cela, sur la variable désirée, la +Pour apparaître pour l'utilisateur tout en réduisant les difficultés de +stockage, les résultats de l'échantillonnage ou des simulations doivent être +demandés **explicitement**. On utilise pour cela, sur la variable désirée, la sauvegarde finale à l'aide du mot-clé "*UserPostAnalysis*" ou le traitement en cours de calcul à l'aide des "*observer*" adaptés. diff --git a/doc/fr/reference.rst b/doc/fr/reference.rst index b6e8210..bad2e78 100644 --- a/doc/fr/reference.rst +++ b/doc/fr/reference.rst @@ -167,5 +167,6 @@ sous-jacents. .. toctree:: :maxdepth: 1 + ref_algorithm_EnsembleOfSimulationGenerationTask ref_algorithm_MeasurementsOptimalPositioningTask ref_task_keywords diff --git a/src/daComposant/daAlgorithms/EnsembleOfSimulationGenerationTask.py b/src/daComposant/daAlgorithms/EnsembleOfSimulationGenerationTask.py new file mode 100644 index 0000000..da04670 --- /dev/null +++ b/src/daComposant/daAlgorithms/EnsembleOfSimulationGenerationTask.py @@ -0,0 +1,97 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2008-2023 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D + +import numpy +from daCore import BasicObjects +from daAlgorithms.Atoms import eosg + +# ============================================================================== +class ElementaryAlgorithm(BasicObjects.Algorithm): + def __init__(self): + BasicObjects.Algorithm.__init__(self, "ENSEMBLEOFSIMULATIONGENERATION") + self.defineRequiredParameter( + name = "SampleAsnUplet", + default = [], + typecast = tuple, + message = "Points de calcul définis par une liste de n-uplet", + ) + self.defineRequiredParameter( + name = "SampleAsExplicitHyperCube", + default = [], + typecast = tuple, + message = "Points de calcul définis par un hyper-cube dont on donne la liste des échantillonnages de chaque variable comme une liste", + ) + self.defineRequiredParameter( + name = "SampleAsMinMaxStepHyperCube", + default = [], + typecast = tuple, + message = "Points de calcul définis par un hyper-cube dont on donne la liste des échantillonnages de chaque variable par un triplet [min,max,step]", + ) + self.defineRequiredParameter( + name = "SampleAsIndependantRandomVariables", + default = [], + typecast = tuple, + message = "Points de calcul définis par un hyper-cube dont les points sur chaque axe proviennent de l'échantillonnage indépendant de la variable selon la spécification ['distribution',[parametres],nombre]", + ) + self.defineRequiredParameter( + name = "SetDebug", + default = False, + typecast = bool, + message = "Activation du mode debug lors de l'exécution", + ) + self.defineRequiredParameter( + name = "StoreSupplementaryCalculations", + default = ["EnsembleOfSimulations",], + typecast = tuple, + message = "Liste de calculs supplémentaires à stocker et/ou effectuer", + listval = [ + "EnsembleOfSimulations", + "EnsembleOfStates", + ] + ) + self.defineRequiredParameter( + name = "SetSeed", + typecast = numpy.random.seed, + message = "Graine fixée pour le générateur aléatoire", + ) + self.requireInputArguments( + mandatory= ("Xb", "HO"), + optional = (), + ) + self.setAttributes(tags=( + "Reduction", + "Checking", + )) + + def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None): + self._pre_run(Parameters, Xb, Y, U, HO, EM, CM, R, B, Q) + # + #-------------------------- + eosg.eosg(self, Xb, HO) + #-------------------------- + # + self._post_run(HO) + return 0 + +# ============================================================================== +if __name__ == "__main__": + print('\n AUTODIAGNOSTIC\n') -- 2.39.2