Salome HOME
Coherence correction for documentation of algorithms
[modules/adao.git] / doc / en / ref_algorithm_ParticleSwarmOptimization.rst
1 ..
2    Copyright (C) 2008-2016 EDF R&D
3
4    This file is part of SALOME ADAO module.
5
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.
10
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.
15
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
19
20    See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21
22    Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
23
24 .. index:: single: ParticleSwarmOptimization
25 .. _section_ref_algorithm_ParticleSwarmOptimization:
26
27 Calculation algorithm "*ParticleSwarmOptimization*"
28 ---------------------------------------------------
29
30 Description
31 +++++++++++
32
33 This algorithm realizes an estimation of the state of a dynamic system by
34 minimization of a cost function :math:`J` by using a particle swarm. It is a
35 method that doesn't use the derivatives of the cost function. It fall in the
36 same category then the :ref:`section_ref_algorithm_DerivativeFreeOptimization`.
37
38 This is an optimization method allowing for global minimum search of a general
39 error function :math:`J` of type :math:`L^1`, :math:`L^2` or :math:`L^{\infty}`,
40 with or without weights. The default error function is the augmented weighted
41 least squares function, classicaly used in data assimilation.
42
43 Optional and required commands
44 ++++++++++++++++++++++++++++++
45
46 .. index:: single: AlgorithmParameters
47 .. index:: single: Background
48 .. index:: single: BackgroundError
49 .. index:: single: Observation
50 .. index:: single: ObservationError
51 .. index:: single: ObservationOperator
52 .. index:: single: MaximumNumberOfSteps
53 .. index:: single: NumberOfInsects
54 .. index:: single: SwarmVelocity
55 .. index:: single: GroupRecallRate
56 .. index:: single: QualityCriterion
57 .. index:: single: BoxBounds
58 .. index:: single: SetSeed
59 .. index:: single: StoreSupplementaryCalculations
60
61 The general required commands, available in the editing user interface, are the
62 following:
63
64   Background
65     *Required command*. This indicates the background or initial vector used,
66     previously noted as :math:`\mathbf{x}^b`. Its value is defined as a
67     "*Vector*" or a *VectorSerie*" type object.
68
69   BackgroundError
70     *Required command*. This indicates the background error covariance matrix,
71     previously noted as :math:`\mathbf{B}`. Its value is defined as a "*Matrix*"
72     type object, a "*ScalarSparseMatrix*" type object, or a
73     "*DiagonalSparseMatrix*" type object.
74
75   Observation
76     *Required command*. This indicates the observation vector used for data
77     assimilation or optimization, previously noted as :math:`\mathbf{y}^o`. It
78     is defined as a "*Vector*" or a *VectorSerie* type object.
79
80   ObservationError
81     *Required command*. This indicates the observation error covariance matrix,
82     previously noted as :math:`\mathbf{R}`. It is defined as a "*Matrix*" type
83     object, a "*ScalarSparseMatrix*" type object, or a "*DiagonalSparseMatrix*"
84     type object.
85
86   ObservationOperator
87     *Required command*. This indicates the observation operator, previously
88     noted :math:`H`, which transforms the input parameters :math:`\mathbf{x}` to
89     results :math:`\mathbf{y}` to be compared to observations
90     :math:`\mathbf{y}^o`. Its value is defined as a "*Function*" type object or
91     a "*Matrix*" type one. In the case of "*Function*" type, different
92     functional forms can be used, as described in the section
93     :ref:`section_ref_operator_requirements`. If there is some control :math:`U`
94     included in the observation, the operator has to be applied to a pair
95     :math:`(X,U)`.
96
97 The general optional commands, available in the editing user interface, are
98 indicated in :ref:`section_ref_assimilation_keywords`. Moreover, the parameters
99 of the command "*AlgorithmParameters*" allows to choose the specific options,
100 described hereafter, of the algorithm. See
101 :ref:`section_ref_options_Algorithm_Parameters` for the good use of this
102 command.
103
104 The options of the algorithm are the following:
105
106   MaximumNumberOfSteps
107     This key indicates the maximum number of iterations allowed for iterative
108     optimization. The default is 50, which is an arbitrary limit. It is then
109     recommended to adapt this parameter to the needs on real problems.
110
111     Example : ``{"MaximumNumberOfSteps":100}``
112
113   NumberOfInsects
114     This key indicates the number of insects or particles in the swarm. The
115     default is 100, which is a usual default for this algorithm.
116
117     Example : ``{"NumberOfInsects":100}``
118
119   SwarmVelocity
120     This key indicates the part of the insect velocity which is imposed by the 
121     swarm. It is a positive floating point value. The default value is 1.
122
123     Example : ``{"SwarmVelocity":1.}``
124
125   GroupRecallRate
126     This key indicates the recall rate at the best swarm insect. It is a
127     floating point value between 0 and 1. The default value is 0.5.
128
129     Example : ``{"GroupRecallRate":0.5}``
130
131   QualityCriterion
132     This key indicates the quality criterion, minimized to find the optimal
133     state estimate. The default is the usual data assimilation criterion named
134     "DA", the augmented weighted least squares. The possible criteria has to be
135     in the following list, where the equivalent names are indicated by the sign
136     "=": ["AugmentedWeightedLeastSquares"="AWLS"="DA",
137     "WeightedLeastSquares"="WLS", "LeastSquares"="LS"="L2",
138     "AbsoluteValue"="L1", "MaximumError"="ME"].
139
140     Example : ``{"QualityCriterion":"DA"}``
141
142   BoxBounds
143     This key allows to define upper and lower bounds for *increments* on every
144     state variable being optimized (and not on state variables themselves).
145     Bounds have to be given by a list of list of pairs of lower/upper bounds for
146     each increment on variable, with extreme values every time there is no bound
147     (``None`` is not allowed when there is no bound). This key is required and
148     there is no default values.
149
150     Example : ``{"BoxBounds":[[-0.5,0.5], [0.01,2.], [0.,1.e99], [-1.e99,1.e99]]}``
151
152   SetSeed
153     This key allow to give an integer in order to fix the seed of the random
154     generator used to generate the ensemble. A convenient value is for example
155     1000. By default, the seed is left uninitialized, and so use the default
156     initialization from the computer.
157
158     Example : ``{"SetSeed":1000}``
159
160   StoreSupplementaryCalculations
161     This list indicates the names of the supplementary variables that can be
162     available at the end of the algorithm. It involves potentially costly
163     calculations or memory consumptions. The default is a void list, none of
164     these variables being calculated and stored by default. The possible names
165     are in the following list: ["BMA", "CostFunctionJ", "CostFunctionJb",
166     "CostFunctionJo", "CurrentState", "OMA", "OMB", "Innovation",
167     "SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState",
168     "SimulatedObservationAtOptimum"].
169
170     Example : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
171
172 Information and variables available at the end of the algorithm
173 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
174
175 At the output, after executing the algorithm, there are variables and
176 information originating from the calculation. The description of
177 :ref:`section_ref_output_variables` show the way to obtain them by the method
178 named ``get`` of the variable "*ADD*" of the post-processing. The input
179 variables, available to the user at the output in order to facilitate the
180 writing of post-processing procedures, are described in the
181 :ref:`subsection_r_o_v_Inventaire`.
182
183 The unconditional outputs of the algorithm are the following:
184
185   Analysis
186     *List of vectors*. Each element is an optimal state :math:`\mathbf{x}*` in
187     optimization or an analysis :math:`\mathbf{x}^a` in data assimilation.
188
189     Example : ``Xa = ADD.get("Analysis")[-1]``
190
191   CostFunctionJ
192     *List of values*. Each element is a value of the error function :math:`J`.
193
194     Example : ``J = ADD.get("CostFunctionJ")[:]``
195
196   CostFunctionJb
197     *List of values*. Each element is a value of the error function :math:`J^b`,
198     that is of the background difference part.
199
200     Example : ``Jb = ADD.get("CostFunctionJb")[:]``
201
202   CostFunctionJo
203     *List of values*. Each element is a value of the error function :math:`J^o`,
204     that is of the observation difference part.
205
206     Example : ``Jo = ADD.get("CostFunctionJo")[:]``
207
208 The conditional outputs of the algorithm are the following:
209
210   BMA
211     *List of vectors*. Each element is a vector of difference between the
212     background and the optimal state.
213
214     Example : ``bma = ADD.get("BMA")[-1]``
215
216   CurrentState
217     *List of vectors*. Each element is a usual state vector used during the
218     optimization algorithm procedure.
219
220     Example : ``Xs = ADD.get("CurrentState")[:]``
221
222   Innovation
223     *List of vectors*. Each element is an innovation vector, which is in static
224     the difference between the optimal and the background, and in dynamic the
225     evolution increment.
226
227     Example : ``d = ADD.get("Innovation")[-1]``
228
229   OMA
230     *List of vectors*. Each element is a vector of difference between the
231     observation and the optimal state in the observation space.
232
233     Example : ``oma = ADD.get("OMA")[-1]``
234
235   OMB
236     *List of vectors*. Each element is a vector of difference between the
237     observation and the background state in the observation space.
238
239     Example : ``omb = ADD.get("OMB")[-1]``
240
241   SimulatedObservationAtBackground
242     *List of vectors*. Each element is a vector of observation simulated from
243     the background :math:`\mathbf{x}^b`.
244
245     Example : ``hxb = ADD.get("SimulatedObservationAtBackground")[-1]``
246
247   SimulatedObservationAtCurrentState
248     *List of vectors*. Each element is an observed vector at the current state,
249     that is, in the observation space.
250
251     Example : ``Ys = ADD.get("SimulatedObservationAtCurrentState")[-1]``
252
253   SimulatedObservationAtOptimum
254     *List of vectors*. Each element is a vector of observation simulated from
255     the analysis or optimal state :math:`\mathbf{x}^a`.
256
257     Example : ``hxa = ADD.get("SimulatedObservationAtOptimum")[-1]``
258
259 See also
260 ++++++++
261
262 References to other sections:
263   - :ref:`section_ref_algorithm_DerivativeFreeOptimization`
264
265 Bibliographical references:
266   - [WikipediaPSO]_