]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Improving the treatment of special cases for minimum
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Mon, 12 Nov 2012 11:48:05 +0000 (12:48 +0100)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Mon, 12 Nov 2012 11:48:05 +0000 (12:48 +0100)
src/daComposant/daAlgorithms/3DVAR.py
src/daComposant/daAlgorithms/NonLinearLeastSquares.py

index 0cc504efd76188a9a09a2d219a1086a3d283f2eb..ebfd8f9bf6738dfa74dce9788b448dc4b87f5b37 100644 (file)
@@ -176,6 +176,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         #
         # Minimisation de la fonctionnelle
         # --------------------------------
+        n0 = self.StoredVariables["CostFunctionJ"].stepnumber()
+        #
         if self._parameters["Minimizer"] == "LBFGSB":
             Minimum, J_optimal, Informations = scipy.optimize.fmin_l_bfgs_b(
                 func        = CostFunction,
@@ -238,7 +240,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         else:
             raise ValueError("Error in Minimizer name: %s"%self._parameters["Minimizer"])
         #
-        StepMin = numpy.argmin( self.StoredVariables["CostFunctionJ"].valueserie() )
+        StepMin = numpy.argmin( self.StoredVariables["CostFunctionJ"].valueserie()[n0:] )
         MinJ    = self.StoredVariables["CostFunctionJ"].valueserie(step = StepMin)
         #
         # Correction pour pallier a un bug de TNC sur le retour du Minimum
index 27cec60f7f2885d47c112ab7db3848493fe376f3..e39c698fc4d9b771437b225ba165630118d5ecce 100644 (file)
@@ -206,6 +206,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         #
         # Minimisation de la fonctionnelle
         # --------------------------------
+        n0 = self.StoredVariables["CostFunctionJ"].stepnumber()
+        #
         if self._parameters["Minimizer"] == "LBFGSB":
             Minimum, J_optimal, Informations = scipy.optimize.fmin_l_bfgs_b(
                 func        = CostFunction,
@@ -280,7 +282,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         else:
             raise ValueError("Error in Minimizer name: %s"%self._parameters["Minimizer"])
         #
-        StepMin = numpy.argmin( self.StoredVariables["CostFunctionJ"].valueserie() )
+        StepMin = numpy.argmin( self.StoredVariables["CostFunctionJ"].valueserie()[n0:] )
         MinJ    = self.StoredVariables["CostFunctionJ"].valueserie(step = StepMin)
         #
         # Correction pour pallier a un bug de TNC sur le retour du Minimum