From: Jean-Philippe ARGAUD Date: Mon, 12 Nov 2012 11:48:05 +0000 (+0100) Subject: Improving the treatment of special cases for minimum X-Git-Tag: V6_6_0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2cc2c16e29a010cd3eaba886e4688b46ed93cd4d;p=modules%2Fadao.git Improving the treatment of special cases for minimum --- diff --git a/src/daComposant/daAlgorithms/3DVAR.py b/src/daComposant/daAlgorithms/3DVAR.py index 0cc504e..ebfd8f9 100644 --- a/src/daComposant/daAlgorithms/3DVAR.py +++ b/src/daComposant/daAlgorithms/3DVAR.py @@ -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 diff --git a/src/daComposant/daAlgorithms/NonLinearLeastSquares.py b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py index 27cec60..e39c698 100644 --- a/src/daComposant/daAlgorithms/NonLinearLeastSquares.py +++ b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py @@ -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