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