Salome HOME
Documentation review and minor code simplification V9_11_0a2
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Thu, 13 Apr 2023 09:11:31 +0000 (11:11 +0200)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Thu, 13 Apr 2023 09:11:31 +0000 (11:11 +0200)
doc/en/ref_algorithm_ParticleSwarmOptimization.rst
doc/en/snippets/Minimizer_DFO.rst
doc/en/theory.rst
doc/fr/ref_algorithm_ParticleSwarmOptimization.rst
doc/fr/snippets/Minimizer_DFO.rst
doc/fr/theory.rst
src/daComposant/daAlgorithms/Atoms/ceks.py
src/daComposant/daAlgorithms/Atoms/exks.py
src/daComposant/daAlgorithms/KalmanFilter.py
src/daComposant/daCore/NumericObjects.py

index 83074b468efcf5515fb265265516687216f8a9d9..61f58f5fad794374512f4d3016a78d36cbbd09fd 100644 (file)
@@ -34,15 +34,17 @@ Calculation algorithm "*ParticleSwarmOptimization*"
 This algorithm realizes an estimation of the state of a system by minimization
 of a cost function :math:`J` by using an evolutionary strategy of particle
 swarm. It is a method that does not use the derivatives of the cost function.
-It falls in the same category than the
+It is based on the evolution of a population (called a "swarm") of states (each
+state is called a "particle"). It falls in the same category than the
 :ref:`section_ref_algorithm_DerivativeFreeOptimization`, the
 :ref:`section_ref_algorithm_DifferentialEvolution` or the
 :ref:`section_ref_algorithm_TabuSearch`.
 
 This is an optimization method allowing for global minimum search of a general
-error function :math:`J` of type :math:`L^1`, :math:`L^2` or :math:`L^{\infty}`,
-with or without weights. The default error function is the augmented weighted
-least squares function, classically used in data assimilation.
+error function :math:`J` of type :math:`L^1`, :math:`L^2` or
+:math:`L^{\infty}`, with or without weights, as described in the section for
+:ref:`section_theory_optimization`. The default error function is the augmented
+weighted least squares function, classically used in data assimilation.
 
 .. ------------------------------------ ..
 .. include:: snippets/Header2Algo02.rst
index 4c103b7f4143c55f8ad6761185eed39ec05b27df..572473702f770087d4c3264194b0fb3d0afc2e0d 100644 (file)
 Minimizer
   *Predefined name*. This key allows to choose the optimization minimizer. The
   default choice is "BOBYQA", and the possible ones are
-  "BOBYQA" (minimization with or without constraints by quadratic approximation, see [Powell09]_),
-  "COBYLA" (minimization with or without constraints by linear approximation, see [Powell94]_ [Powell98]_).
-  "NEWUOA" (minimization with or without constraints by iterative quadratic approximation, see [Powell04]_),
-  "POWELL" (minimization unconstrained using conjugate directions, see [Powell64]_),
-  "SIMPLEX" (minimization with or without constraints using Nelder-Mead simplex algorithm, see [Nelder65]_),
-  "SUBPLEX" (minimization with or without constraints using Nelder-Mead on a sequence of subspaces, see [Rowan90]_).
+  "BOBYQA" (minimization, with or without constraints, by quadratic approximation, see [Powell09]_),
+  "COBYLA" (minimization, with or without constraints, by linear approximation, see [Powell94]_ [Powell98]_).
+  "NEWUOA" (minimization, with or without constraints, by iterative quadratic approximation, see [Powell04]_),
+  "POWELL" (minimization, unconstrained, using conjugate directions, see [Powell64]_),
+  "SIMPLEX" (minimization, with or without constraints, using Nelder-Mead simplex algorithm, see [Nelder65]_),
+  "SUBPLEX" (minimization, with or without constraints, using Nelder-Mead on a sequence of subspaces, see [Rowan90]_).
+  Only the "POWELL" minimizer does not allow to deal with boundary constraints,
+  all the others take them into account if they are present in the case
+  definition.
+
   Remark: the "POWELL" method perform a dual outer/inner loops optimization,
   leading then to less control on the cost function evaluation number because
   it is the outer loop limit than is controlled. If precise control on the
index e2044b9b9286024d277f1c25426deaa4bcff4bfa..d6bf4646212ffff408f2ae07ad216e671fd2db9a 100644 (file)
@@ -56,8 +56,8 @@ underlying procedure always integrates optimization in order to find this
 estimate: particular optimization methods are always embedded in data
 assimilation algorithms. Optimization methods can be seen in ADAO as a way to
 extend data assimilation applications. They will be introduced this way in the
-section `Going further in the state estimation by optimization methods`_, but
-they are far more general and can be used without data assimilation concepts.
+section :ref:`section_theory_optimization`, but they are far more general and
+can be used without data assimilation concepts.
 
 Two main types of applications exist in data assimilation, which are covered by
 the same formalism: **fields reconstruction** (see `Fields reconstruction or
@@ -68,13 +68,11 @@ can if necessary elaborate joint estimation of both (see `Joint state and
 parameter estimation in dynamics`_). In ADAO, some algorithms can be used
 either in state estimation or in parameter estimation. This is done simply by
 changing the required option "*EstimationOf*" in the algorithm parameters.
-Before introducing the `Simple description of the data assimilation
-methodological framework`_ in a next section, these two types of applications
-are briefly described. At the end, some detailed information allow `Going
-further in the data assimilation framework`_ and `Going further in the state
-estimation by optimization methods`_, as well as `Going further in data
-assimilation for dynamics`_  and having `An overview of reduction methods and
-of reduced optimization`_.
+Before introducing the :ref:`section_theory_da_framework` in a next section,
+these two types of applications are briefly described. At the end, some
+detailed information allow :ref:`section_theory_more_assimilation` and
+:ref:`section_theory_optimization`, as well as :ref:`section_theory_dynamique`
+and having :ref:`section_theory_reduction`.
 
 Fields reconstruction or measures interpolation
 -----------------------------------------------
@@ -190,6 +188,8 @@ in the case of more marked nonlinearities during the numerical simulation of
 the states, it is advisable to treat in a more complete but also more complex
 way the problem of joint estimation of states and parameters.
 
+.. _section_theory_da_framework:
+
 Simple description of the data assimilation methodological framework
 --------------------------------------------------------------------
 
@@ -268,15 +268,15 @@ assimlation (see for example [Talagrand97]_) or as the generalized Tikhonov
 regularization functional in optimization (see for example [WikipediaTI]_).
 Since :math:`\mathbf{B}` and :math:`\mathbf{R}` covariance matrices are
 proportional to the variances of errors, their presence in both terms of the
-function :math:`J` can effectively weight the gap terms by the confidence in the
-background or observations errors. The parameters vector :math:`\mathbf{x}`
+function :math:`J` can effectively weight the gap terms by the confidence in
+the background or observations errors. The parameters vector :math:`\mathbf{x}`
 realizing the minimum of this function therefore constitute the analysis
 :math:`\mathbf{x}^a`. It is at this level that we have to use the full panoply
 of function minimization methods otherwise known in optimization (see also
-section `Going further in the state estimation by optimization methods`_).
-Depending on the size of the parameters vector :math:`\mathbf{x}` to identify,
-and of the availability of gradient or Hessian of :math:`J`, it is appropriate
-to adapt the chosen optimization method (gradient, Newton, quasi-Newton...).
+section :ref:`section_theory_optimization`). Depending on the size of the
+parameters vector :math:`\mathbf{x}` to identify, and of the availability of
+gradient or Hessian of :math:`J`, it is appropriate to adapt the chosen
+optimization method (gradient, Newton, quasi-Newton...).
 
 In **assimilation by filtering**, in this simple case usually referred to as
 "*BLUE*" (for "*Best Linear Unbiased Estimator*"), the :math:`\mathbf{x}^a`
@@ -305,7 +305,7 @@ and "*Kalman filter (KF)*" and their derivatives. They have to take into
 account an evolution operator to establish an analysis at the right time steps
 of the gap between observations and simulations, and to have, at every moment,
 the propagation of the background through the evolution model. The next section
-provides information on `Going further in data assimilation for dynamics`_. In
+provides information on :ref:`section_theory_dynamique`. In
 the same way, these methods can be used in case of non linear observation or
 evolution operators. Many other variants have been developed to improve the
 numerical quality of the methods or to take into account computer requirements
@@ -328,11 +328,10 @@ inspired by [Asch16]_ (Figure 1.5).
 
 It is deliberately simple to remain readable, the dashed lines showing some of
 the simplifications or extensions. For example, it does not specifically
-mention the methods with reductions (of which it is given hereafter `An
-overview of reduction methods and of reduced optimization`_), some of which
-were variations of the basic methods shown here, nor does it mention the more
-detailed extensions. It also omits the test methods available in ADAO and
-useful for the study.
+mention the methods with reductions (of which it is given hereafter
+:ref:`section_theory_reduction`), some of which were variations of the basic
+methods shown here, nor does it mention the more detailed extensions. It also
+omits the test methods available in ADAO and useful for the study.
 
 Each method mentioned in this diagram is the subject of a specific descriptive
 section in the chapter on :ref:`section_reference_assimilation`. The acronyms
@@ -355,6 +354,8 @@ links:
 - Tabu: :ref:`section_ref_algorithm_TabuSearch`,
 - UKF: :ref:`section_ref_algorithm_UnscentedKalmanFilter`.
 
+.. _section_theory_reduction:
+
 An overview of reduction methods and of reduced optimization
 ------------------------------------------------------------
 
@@ -456,6 +457,8 @@ One can end this quick overview of reduction methods highlighting that their
 use is ubiquitous in real applications and in numerical tools, and that ADAO
 allows to use proven methods without even knowing it.
 
+.. _section_theory_more_assimilation:
+
 Going further in the data assimilation framework
 ------------------------------------------------
 
@@ -503,6 +506,8 @@ reduction*, *data smoothing*, *data-driven* modeling, model and data learning
 (*Machine Learning* and *Artificial Intelligence*), etc. These terms can be
 used in bibliographic searches.
 
+.. _section_theory_optimization:
+
 Going further in the state estimation by optimization methods
 -------------------------------------------------------------
 
index a2a66b20568ee2d6b200574474f726f7073964b8..3c194d77e83c98ab0371afca9e96355da3ed6a6a 100644 (file)
@@ -35,16 +35,19 @@ Algorithme de calcul "*ParticleSwarmOptimization*"
 Cet algorithme réalise une estimation de l'état d'un système par minimisation
 d'une fonctionnelle d'écart :math:`J` en utilisant une méthode évolutionnaire
 d'essaim particulaire. C'est une méthode qui n'utilise pas les dérivées de la
-fonctionnelle d'écart. Elle entre dans la même catégorie que
-l':ref:`section_ref_algorithm_DerivativeFreeOptimization`,
-l':ref:`section_ref_algorithm_DifferentialEvolution` ou
-l':ref:`section_ref_algorithm_TabuSearch`.
-
-C'est une méthode d'optimisation permettant la recherche du minimum global 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. 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.
+fonctionnelle d'écart. Elle est basée sur l'évolution d'une population (appelée
+"essaim") d'états (chaque individu étant appelé une "particule"). Elle entre
+dans la même catégorie que les
+:ref:`section_ref_algorithm_DerivativeFreeOptimization`,
+:ref:`section_ref_algorithm_DifferentialEvolution` ou
+:ref:`section_ref_algorithm_TabuSearch`.
+
+C'est une méthode d'optimisation permettant la recherche du minimum global
+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, comme décrit dans
+la section pour :ref:`section_theory_optimization`. 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.
 
 .. ------------------------------------ ..
 .. include:: snippets/Header2Algo02.rst
index db11d592f699c351517f7a3ea995940df8127379..7803f77f9266033fd358d09ea77a68afe4d95219 100644 (file)
 Minimizer
   *Nom prédéfini*. Cette clé permet de changer le minimiseur pour l'optimiseur.
   Le choix par défaut est "BOBYQA", et les choix possibles sont
-  "BOBYQA" (minimisation avec ou sans contraintes par approximation quadratique, voir [Powell09]_),
-  "COBYLA" (minimisation avec ou sans contraintes par approximation linéaire, voir [Powell94]_ [Powell98]_).
-  "NEWUOA" (minimisation avec ou sans contraintes par approximation quadratique itérative, voir [Powell04]_),
-  "POWELL" (minimisation sans contraintes de type directions conjuguées, voir [Powell64]_),
-  "SIMPLEX" (minimisation avec ou sans contraintes de type simplexe ou Nelder-Mead, voir [Nelder65]_),
-  "SUBPLEX" (minimisation avec ou sans contraintes de type simplexe sur une suite de sous-espaces, voir [Rowan90]_).
+  "BOBYQA" (minimisation, avec ou sans contraintes, par approximation quadratique, voir [Powell09]_),
+  "COBYLA" (minimisation, avec ou sans contraintes, par approximation linéaire, voir [Powell94]_ [Powell98]_).
+  "NEWUOA" (minimisation, avec ou sans contraintes, par approximation quadratique itérative, voir [Powell04]_),
+  "POWELL" (minimisation, sans contraintes, de type directions conjuguées, voir [Powell64]_),
+  "SIMPLEX" (minimisation, avec ou sans contraintes, de type simplexe ou Nelder-Mead, voir [Nelder65]_),
+  "SUBPLEX" (minimisation, avec ou sans contraintes, de type simplexe sur une suite de sous-espaces, voir [Rowan90]_).
+  Seul le minimiseur "POWELL" ne permet pas de traiter les contraintes de
+  bornes, tous les autres en tiennent compte si elles sont présentes dans la
+  définition du cas.
+
   Remarque : la méthode "POWELL" effectue une optimisation par boucles
   imbriquées interne/externe, conduisant ainsi à un contrôle relaché du nombre
   d'évaluations de la fonctionnelle à optimiser. Si un contrôle précis du
index 71448c220f1d4f25a5629ea4a929fa524bc4312d..326a5170afe0d5a497d95a5c45288db4a841c894 100644 (file)
@@ -61,9 +61,9 @@ trouver cette estimation : des méthodes d'optimisation choisies sont toujours
 intégrées dans les algorithmes d'assimilation de données. Par ailleurs, les
 méthodes d'optimisation peuvent être vues dans ADAO comme un moyen d'étendre
 les applications d'assimilation de données. Elles seront présentées de cette
-façon dans la section pour `Approfondir l'estimation d'état par des méthodes
-d'optimisation`_, mais elles sont beaucoup plus générales et peuvent être
-utilisées sans les concepts d'assimilation de données.
+façon dans la section pour :ref:`section_theory_optimization`, mais elles sont
+beaucoup plus générales et peuvent être utilisées sans les concepts
+d'assimilation de données.
 
 Deux types principaux d'applications existent en assimilation de données, qui
 sont couverts par le même formalisme : la **reconstruction de champs** (voir
@@ -75,14 +75,12 @@ conjointe si nécessaire (voir `Estimation conjointe d'états et de
 paramètres`_). Dans ADAO, certains algorithmes peuvent être utilisés soit en
 estimation d'état, soit en estimation de paramètres. Cela se fait simplement en
 changeant l'option requise "*EstimationOf*" dans les paramètres des
-algorithmes. Avant d'introduire la `Description simple du cadre méthodologique
-de l'assimilation de données`_ dans une prochaine section, on décrit brièvement
-ces deux types d'applications. A la fin de ce chapitre, quelques informations
-permettent d'aller plus loin pour `Approfondir le cadre méthodologique de
-l'assimilation de données`_ et `Approfondir l'estimation d'état par des
-méthodes d'optimisation`_, ainsi que pour `Approfondir l'assimilation de
-données pour la dynamique`_ et avoir `Un aperçu des méthodes de réduction et de
-l'optimisation réduite`_.
+algorithmes. Avant d'introduire la :ref:`section_theory_da_framework` dans une
+prochaine section, on décrit brièvement ces deux types d'applications. A la fin
+de ce chapitre, quelques informations permettent d'aller plus loin pour
+:ref:`section_theory_more_assimilation` et :ref:`section_theory_optimization`,
+ainsi que pour :ref:`section_theory_dynamique` et avoir
+:ref:`section_theory_reduction`.
 
 Reconstruction de champs ou interpolation de données
 ----------------------------------------------------
@@ -208,6 +206,8 @@ lors de la simulation numérique des états, il convient de traiter de manière
 plus complète mais aussi plus complexe le problème d'estimation conjointe
 d'états et de paramètres.
 
+.. _section_theory_da_framework:
+
 Description simple du cadre méthodologique de l'assimilation de données
 -----------------------------------------------------------------------
 
@@ -285,18 +285,19 @@ classiquement à minimiser la fonction :math:`J` suivante :
 :math:`J` est classiquement désignée comme la fonctionnelle "*3D-Var*" en
 assimilation de données (voir par exemple [Talagrand97]_) ou comme la
 fonctionnelle de régularisation de Tikhonov généralisée en optimisation (voir
-par exemple [WikipediaTI]_). Comme les matrices de covariance :math:`\mathbf{B}`
-et :math:`\mathbf{R}` sont proportionnelles aux variances d'erreurs, leur
-présence dans les deux termes de la fonctionnelle :math:`J` permet effectivement
-de pondérer les termes d'écarts par la confiance dans les erreurs d'ébauche ou
-d'observations. Le vecteur :math:`\mathbf{x}` des paramètres réalisant le
-minimum de cette fonction constitue ainsi l'analyse :math:`\mathbf{x}^a`. C'est
-à ce niveau que l'on doit utiliser toute la panoplie des méthodes de
-minimisation de fonctions connues par ailleurs en optimisation (voir aussi la
-section `Approfondir l'estimation d'état par des méthodes d'optimisation`_).
-Selon la taille du vecteur :math:`\mathbf{x}` des paramètres à identifier, et la
+par exemple [WikipediaTI]_). Comme les matrices de covariance
+:math:`\mathbf{B}` et :math:`\mathbf{R}` sont proportionnelles aux variances
+d'erreurs, leur présence dans les deux termes de la fonctionnelle :math:`J`
+permet effectivement de pondérer les termes d'écarts par la confiance dans les
+erreurs d'ébauche ou d'observations. Le vecteur :math:`\mathbf{x}` des
+paramètres réalisant le minimum de cette fonction constitue ainsi l'analyse
+:math:`\mathbf{x}^a`. C'est à ce niveau que l'on doit utiliser toute la
+panoplie des méthodes de minimisation de fonctions connues par ailleurs en
+optimisation (voir aussi la section :ref:`section_theory_optimization`). Selon
+la taille du vecteur :math:`\mathbf{x}` des paramètres à identifier, et la
 disponibilité du gradient ou de la hessienne de :math:`J`, il est judicieux
-d'adapter la méthode d'optimisation choisie (gradient, Newton, quasi-Newton...).
+d'adapter la méthode d'optimisation choisie (gradient, Newton,
+quasi-Newton...).
 
 En **assimilation par filtrage**, dans ce cas simple usuellement dénommé
 "*BLUE*" (pour "*Best Linear Unbiased Estimator*"), l'analyse
@@ -325,12 +326,12 @@ et de "*Filtre de Kalman (KF)*" et leurs dérivés. Elles doivent alors prendre
 en compte un opérateur d'évolution pour établir aux bons pas de temps une
 analyse de l'écart entre les observations et les simulations et pour avoir, à
 chaque instant, la propagation de l'ébauche à travers le modèle d'évolution. On
-se reportera à la section suivante pour `Approfondir l'assimilation de données
-pour la dynamique`_. De la même manière, ces méthodes peuvent aussi être
-utilisées dans le cas d'opérateurs d'observation ou d'évolution non linéaires.
-Un grand nombre de variantes ont été développées pour accroître la qualité
-numérique des méthodes ou pour prendre en compte des contraintes informatiques
-comme la taille ou la durée des calculs.
+se reportera à la section suivante pour :ref:`section_theory_dynamique`. De
+la même manière, ces méthodes peuvent aussi être utilisées dans le cas
+d'opérateurs d'observation ou d'évolution non linéaires. Un grand nombre de
+variantes ont été développées pour accroître la qualité numérique des méthodes
+ou pour prendre en compte des contraintes informatiques comme la taille ou la
+durée des calculs.
 
 Une vue schématique des approches d'Assimilation de Données et d'Optimisation
 -----------------------------------------------------------------------------
@@ -350,10 +351,10 @@ librement inspiré de [Asch16]_ (Figure 1.5).
 Il est volontairement simple pour rester lisible, les lignes tiretées montrant
 certaines des simplifications ou extensions. Ce schéma omet par exemple de
 citer spécifiquement les méthodes avec réductions (dont il est donné ci-après
-`Un aperçu des méthodes de réduction et de l'optimisation réduite`_), dont une
-partie sont des variantes de méthodes de base indiquées ici, ou de citer les
-extensions les plus détaillées. Il omet de même les méthodes de tests
-disponibles dans ADAO et utiles pour la mise en étude.
+:ref:`section_theory_reduction`), dont une partie sont des variantes de
+méthodes de base indiquées ici, ou de citer les extensions les plus détaillées.
+Il omet de même les méthodes de tests disponibles dans ADAO et utiles pour la
+mise en étude.
 
 Chaque méthode citée dans ce schéma fait l'objet d'une partie descriptive
 spécifique dans le chapitre des :ref:`section_reference_assimilation`. Les
@@ -376,6 +377,8 @@ associés :
 - Tabu : :ref:`section_ref_algorithm_TabuSearch`,
 - UKF : :ref:`section_ref_algorithm_UnscentedKalmanFilter`.
 
+.. _section_theory_reduction:
+
 Un aperçu des méthodes de réduction et de l'optimisation réduite
 ----------------------------------------------------------------
 
@@ -484,6 +487,8 @@ soulignant que leur usage est omni-présent dans les applications réelles et
 dans les outils numériques, et qu'ADAO permet d'utiliser des méthodes éprouvées
 sans même le savoir.
 
+.. _section_theory_more_assimilation:
+
 Approfondir le cadre méthodologique de l'assimilation de données
 ----------------------------------------------------------------
 
@@ -537,6 +542,8 @@ des modèles par les données (« *data-driven* »), *d'apprentissage* de modèl
 et de données (*Machine Learning* et Intelligence Artificielle), etc. Ces
 termes peuvent être utilisés dans les recherches bibliographiques.
 
+.. _section_theory_optimization:
+
 Approfondir l'estimation d'état par des méthodes d'optimisation
 ---------------------------------------------------------------
 
index 86902f90c49b841d52cc69eadf66e338b1f13ed0..31986009adf15b1ea883b04d9fcb43895ba74ea1 100644 (file)
@@ -172,6 +172,10 @@ def ceks(selfA, Xb, Y, U, HO, EM, CM, R, B, Q):
             Ma = Ma.reshape(Xs.size,Xs.size) # ADAO & check shape
             M  = EM["Direct"].appliedControledFormTo
             Xn = numpy.ravel( M( (Xs, Un) ) ).reshape((__n,1))
+            if CM is not None and "Tangent" in CM and Un is not None: # Attention : si Cm est aussi dans M, doublon !
+                Cm = CM["Tangent"].asMatrix(Xn_predicted)
+                Cm = Cm.reshape(__n,Un.size) # ADAO & check shape
+                Xn = Xn + Cm @ Un
         elif selfA._parameters["EstimationOf"] == "Parameters": # Observation of forecast
             # --- > Par principe, M = Id, Q = 0
             Mt = Ma = 1.
index 656bc019b0d6faa248729ab67f3baf38d7335277..f7c5c767676be910c263379970cd4e733564fc88 100644 (file)
@@ -161,6 +161,10 @@ def exks(selfA, Xb, Y, U, HO, EM, CM, R, B, Q):
             Ma = Ma.reshape(Xs.size,Xs.size) # ADAO & check shape
             M  = EM["Direct"].appliedControledFormTo
             Xn = numpy.ravel( M( (Xs, Un) ) ).reshape((__n,1))
+            if CM is not None and "Tangent" in CM and Un is not None: # Attention : si Cm est aussi dans M, doublon !
+                Cm = CM["Tangent"].asMatrix(Xn_predicted)
+                Cm = Cm.reshape(__n,Un.size) # ADAO & check shape
+                Xn = Xn + Cm @ Un
         elif selfA._parameters["EstimationOf"] == "Parameters": # Observation of forecast
             # --- > Par principe, M = Id, Q = 0
             Mt = Ma = 1.
index e9b6f02f4cfecfece551d26e4663ba89ce842aee..a1633d77c70add993c198e91d28f449e992e851c 100644 (file)
@@ -99,7 +99,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         #
         #--------------------------
         if   self._parameters["Variant"] == "KalmanFilter":
-            NumericObjects.multiXOsteps(self, Xb, Y, U, HO, EM, CM, R, B, Q, ecwstdkf.ecwstdkf, True, True)
+            NumericObjects.multiXOsteps(self, Xb, Y, U, HO, EM, CM, R, B, Q, ecwstdkf.ecwstdkf, True)
         #
         #--------------------------
         elif self._parameters["Variant"] == "OneCorrection":
index 4b674e4c9634fb8ac5d58d5f95c6d8c9ef5e4f15..f38e780e777c45153598763fcffeb91e8926028c 100644 (file)
@@ -1026,8 +1026,7 @@ def BuildComplexSampleList(
 
 # ==============================================================================
 def multiXOsteps(selfA, Xb, Y, U, HO, EM, CM, R, B, Q, oneCycle,
-        __CovForecast = False, __LinEvolution = False,
-        ):
+        __CovForecast = False):
     """
     Prévision multi-pas avec une correction par pas (multi-méthodes)
     """
@@ -1080,18 +1079,15 @@ def multiXOsteps(selfA, Xb, Y, U, HO, EM, CM, R, B, Q, oneCycle,
         # Predict (Time Update)
         # ---------------------
         if selfA._parameters["EstimationOf"] == "State":
-            if __CovForecast or __LinEvolution:
+            if __CovForecast:
                 Mt = EM["Tangent"].asMatrix(Xn)
                 Mt = Mt.reshape(Xn.size,Xn.size) # ADAO & check shape
             if __CovForecast:
                 Ma = EM["Adjoint"].asMatrix(Xn)
                 Ma = Ma.reshape(Xn.size,Xn.size) # ADAO & check shape
                 Pn_predicted = Q + Mt @ (Pn @ Ma)
-            if __LinEvolution:
-                Xn_predicted = Mt @ Xn
-            else:
-                M  = EM["Direct"].appliedControledFormTo
-                Xn_predicted = M( (Xn, Un) )
+            M  = EM["Direct"].appliedControledFormTo
+            Xn_predicted = M( (Xn, Un) ).reshape((-1,1))
             if CM is not None and "Tangent" in CM and Un is not None: # Attention : si Cm est aussi dans M, doublon !
                 Cm = CM["Tangent"].asMatrix(Xn_predicted)
                 Cm = Cm.reshape(Xn.size,Un.size) # ADAO & check shape