2 Copyright (C) 2008-2015 EDF R&D
4 This file is part of SALOME ADAO module.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
24 .. index:: single: ParticleSwarmOptimization
25 .. _section_ref_algorithm_ParticleSwarmOptimization:
27 Calculation algorithm "*ParticleSwarmOptimization*"
28 ---------------------------------------------------
33 This algorithm realizes an estimation of the state of a dynamic system by a
36 This is an optimization method allowing for global minimum search of a general
37 error function :math:`J` of type :math:`L^1`, :math:`L^2` or :math:`L^{\infty}`,
38 with or without weights. The default error function is the augmented weighted
39 least squares function, classicaly used in data assimilation.
41 Optional and required commands
42 ++++++++++++++++++++++++++++++
44 .. index:: single: Background
45 .. index:: single: BackgroundError
46 .. index:: single: Observation
47 .. index:: single: ObservationError
48 .. index:: single: ObservationOperator
49 .. index:: single: MaximumNumberOfSteps
50 .. index:: single: NumberOfInsects
51 .. index:: single: SwarmVelocity
52 .. index:: single: GroupRecallRate
53 .. index:: single: QualityCriterion
54 .. index:: single: BoxBounds
55 .. index:: single: SetSeed
56 .. index:: single: StoreInternalVariables
57 .. index:: single: StoreSupplementaryCalculations
59 The general required commands, available in the editing user interface, are the
63 *Required command*. This indicates the background or initial vector used,
64 previously noted as :math:`\mathbf{x}^b`. Its value is defined as a
65 "*Vector*" or a *VectorSerie*" type object.
68 *Required command*. This indicates the background error covariance matrix,
69 previously noted as :math:`\mathbf{B}`. Its value is defined as a "*Matrix*"
70 type object, a "*ScalarSparseMatrix*" type object, or a
71 "*DiagonalSparseMatrix*" type object.
74 *Required command*. This indicates the observation vector used for data
75 assimilation or optimization, previously noted as :math:`\mathbf{y}^o`. It
76 is defined as a "*Vector*" or a *VectorSerie* type object.
79 *Required command*. This indicates the observation error covariance matrix,
80 previously noted as :math:`\mathbf{R}`. It is defined as a "*Matrix*" type
81 object, a "*ScalarSparseMatrix*" type object, or a "*DiagonalSparseMatrix*"
85 *Required command*. This indicates the observation operator, previously
86 noted :math:`H`, which transforms the input parameters :math:`\mathbf{x}` to
87 results :math:`\mathbf{y}` to be compared to observations
88 :math:`\mathbf{y}^o`. Its value is defined as a "*Function*" type object or
89 a "*Matrix*" type one. In the case of "*Function*" type, different
90 functional forms can be used, as described in the section
91 :ref:`section_ref_operator_requirements`. If there is some control :math:`U`
92 included in the observation, the operator has to be applied to a pair
95 The general optional commands, available in the editing user interface, are
96 indicated in :ref:`section_ref_assimilation_keywords`. In particular, the
97 optional command "*AlgorithmParameters*" allows to choose the specific options,
98 described hereafter, of the algorithm. See
99 :ref:`section_ref_options_AlgorithmParameters` for the good use of this command.
101 The options of the algorithm are the following:
104 This key indicates the maximum number of iterations allowed for iterative
105 optimization. The default is 50, which is an arbitrary limit. It is then
106 recommended to adapt this parameter to the needs on real problems.
108 Example : ``{"MaximumNumberOfSteps":100}``
111 This key indicates the number of insects or particles in the swarm. The
112 default is 100, which is a usual default for this algorithm.
114 Example : ``{"NumberOfInsects":100}``
117 This key indicates the part of the insect velocity which is imposed by the
118 swarm. It is a positive floating point value. The default value is 1.
120 Example : ``{"SwarmVelocity":1.}``
123 This key indicates the recall rate at the best swarm insect. It is a
124 floating point value between 0 and 1. The default value is 0.5.
126 Example : ``{"GroupRecallRate":0.5}``
129 This key indicates the quality criterion, minimized to find the optimal
130 state estimate. The default is the usual data assimilation criterion named
131 "DA", the augmented weighted least squares. The possible criteria has to be
132 in the following list, where the equivalent names are indicated by the sign
133 "=": ["AugmentedWeightedLeastSquares"="AWLS"="DA",
134 "WeightedLeastSquares"="WLS", "LeastSquares"="LS"="L2",
135 "AbsoluteValue"="L1", "MaximumError"="ME"].
137 Example : ``{"QualityCriterion":"DA"}``
140 This key allows to define upper and lower bounds for *increments* on every
141 state variable being optimized (and not on state variables themselves).
142 Bounds have to be given by a list of list of pairs of lower/upper bounds for
143 each increment on variable, with extreme values every time there is no bound
144 (``None`` is not allowed when there is no bound). This key is required and
145 there is no default values.
147 Example : ``{"BoxBounds":[[-0.5,0.5],[0.01,2.],[0.,1.e99],[-1.e99,1.e99]]}``
150 This key allow to give an integer in order to fix the seed of the random
151 generator used to generate the ensemble. A convenient value is for example
152 1000. By default, the seed is left uninitialized, and so use the default
153 initialization from the computer.
155 Example : ``{"SetSeed":1000}``
157 StoreInternalVariables
158 This Boolean key allows to store default internal variables, mainly the
159 current state during iterative optimization process. Be careful, this can be
160 a numerically costly choice in certain calculation cases. The default is
163 Example : ``{"StoreInternalVariables":True}``
165 StoreSupplementaryCalculations
166 This list indicates the names of the supplementary variables that can be
167 available at the end of the algorithm. It involves potentially costly
168 calculations or memory consumptions. The default is a void list, none of
169 these variables being calculated and stored by default. The possible names
170 are in the following list: ["BMA", "OMA", "OMB", "Innovation"].
172 Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
174 Information and variables available at the end of the algorithm
175 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
177 At the output, after executing the algorithm, there are variables and
178 information originating from the calculation. The description of
179 :ref:`section_ref_output_variables` show the way to obtain them by the method
180 named ``get`` of the variable "*ADD*" of the post-processing. The input
181 variables, available to the user at the output in order to facilitate the
182 writing of post-processing procedures, are described in the
183 :ref:`subsection_r_o_v_Inventaire`.
185 The unconditional outputs of the algorithm are the following:
188 *List of vectors*. Each element is an optimal state :math:`\mathbf{x}*` in
189 optimization or an analysis :math:`\mathbf{x}^a` in data assimilation.
191 Example : ``Xa = ADD.get("Analysis")[-1]``
194 *List of values*. Each element is a value of the error function :math:`J`.
196 Example : ``J = ADD.get("CostFunctionJ")[:]``
199 *List of values*. Each element is a value of the error function :math:`J^b`,
200 that is of the background difference part.
202 Example : ``Jb = ADD.get("CostFunctionJb")[:]``
205 *List of values*. Each element is a value of the error function :math:`J^o`,
206 that is of the observation difference part.
208 Example : ``Jo = ADD.get("CostFunctionJo")[:]``
210 The conditional outputs of the algorithm are the following:
213 *List of vectors*. Each element is a vector of difference between the
214 background and the optimal state.
216 Example : ``bma = ADD.get("BMA")[-1]``
219 *List of vectors*. Each element is a usual state vector used during the
220 optimization algorithm procedure.
222 Example : ``Xs = ADD.get("CurrentState")[:]``
225 *List of vectors*. Each element is an innovation vector, which is in static
226 the difference between the optimal and the background, and in dynamic the
229 Example : ``d = ADD.get("Innovation")[-1]``
232 *List of vectors*. Each element is a vector of difference between the
233 observation and the optimal state in the observation space.
235 Example : ``oma = ADD.get("OMA")[-1]``
238 *List of vectors*. Each element is a vector of difference between the
239 observation and the background state in the observation space.
241 Example : ``omb = ADD.get("OMB")[-1]``
243 SimulatedObservationAtBackground
244 *List of vectors*. Each element is a vector of observation simulated from
245 the background :math:`\mathbf{x}^b`.
247 Example : ``hxb = ADD.get("SimulatedObservationAtBackground")[-1]``
249 SimulatedObservationAtCurrentState
250 *List of vectors*. Each element is an observed vector at the current state,
251 that is, in the observation space.
253 Example : ``Ys = ADD.get("SimulatedObservationAtCurrentState")[-1]``
255 SimulatedObservationAtOptimum
256 *List of vectors*. Each element is a vector of observation simulated from
257 the analysis or optimal state :math:`\mathbf{x}^a`.
259 Example : ``hxa = ADD.get("SimulatedObservationAtOptimum")[-1]``
264 References to other sections: