#-*-coding:iso-8859-1-*-
#
-# Copyright (C) 2008-2015 EDF R&D
+# Copyright (C) 2008-2017 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
+# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
import logging
from daCore import BasicObjects
default = [],
typecast = tuple,
message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
- listval = ["BMA", "OMA", "OMB", "Innovation", "SimulatedObservationAtBackground", "SimulatedObservationAtOptimum"]
+ listval = ["BMA", "OMA", "OMB", "CurrentState", "CostFunctionJ", "CostFunctionJb", "CostFunctionJo", "Innovation", "SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState", "SimulatedObservationAtOptimum"]
+ )
+ self.defineRequiredParameter( # Pas de type
+ name = "Bounds",
+ message = "Liste des valeurs de bornes",
)
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()
- #
- # Paramètres de pilotage
- # ----------------------
- self.setParameters(Parameters)
+ self._pre_run(Parameters)
#
- if self._parameters.has_key("Bounds") and (type(self._parameters["Bounds"]) is type([]) or type(self._parameters["Bounds"]) is type(())) and (len(self._parameters["Bounds"]) > 0):
- Bounds = self._parameters["Bounds"]
- logging.debug("%s Prise en compte des bornes effectuee"%(self._name,))
- else:
- Bounds = None
- #
- # Opérateur d'observation
- # -----------------------
Hm = HO["Direct"].appliedTo
#
# Utilisation éventuelle d'un vecteur H(Xb) précalculé
# ----------------------------------------------------
if HO["AppliedToX"] is not None and HO["AppliedToX"].has_key("HXb"):
- HXb = HO["AppliedToX"]["HXb"]
+ HXb = Hm( Xb, HO["AppliedToX"]["HXb"])
else:
HXb = Hm( Xb )
HXb = numpy.asmatrix(numpy.ravel( HXb )).T
# ------------------------------
def CostFunction(x):
_X = numpy.asmatrix(numpy.ravel( x )).T
+ if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["CurrentState"].store( _X )
_HX = Hm( _X )
_HX = numpy.asmatrix(numpy.ravel( _HX )).T
+ if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( _HX )
Jb = 0.
Jo = 0.
J = Jb + Jo
- if self._parameters["StoreInternalVariables"]:
- self.StoredVariables["CurrentState"].store( _X )
self.StoredVariables["CostFunctionJb"].store( Jb )
self.StoredVariables["CostFunctionJo"].store( Jo )
self.StoredVariables["CostFunctionJ" ].store( J )
func = CostFunction,
x0 = Xini,
fprime = GradientOfCostFunction,
- bounds = Bounds,
+ bounds = self._parameters["Bounds"],
quantile = self._parameters["Quantile"],
maxfun = self._parameters["MaximumNumberOfSteps"],
toler = self._parameters["CostDecrementTolerance"],