From: Jean-Philippe ARGAUD Date: Fri, 10 Aug 2012 13:42:21 +0000 (+0200) Subject: Slight corrections of parameters and variables treatment X-Git-Tag: V6_6_0~37 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4c6d99976fc4966797d1951ac9ad4b57c516a19b;p=modules%2Fadao.git Slight corrections of parameters and variables treatment --- diff --git a/src/daComposant/daAlgorithms/3DVAR.py b/src/daComposant/daAlgorithms/3DVAR.py index dbb710b..8997f3a 100644 --- a/src/daComposant/daAlgorithms/3DVAR.py +++ b/src/daComposant/daAlgorithms/3DVAR.py @@ -267,7 +267,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # # Obtention de l'analyse # ---------------------- - Xa = numpy.asmatrix(Minimum).T + Xa = numpy.asmatrix(Minimum).flatten().T logging.debug("%s Analyse Xa = %s"%(self._name, Xa)) # self.StoredVariables["Analysis"].store( Xa.A1 ) diff --git a/src/daComposant/daAlgorithms/NonLinearLeastSquares.py b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py index f77ab01..cee9082 100644 --- a/src/daComposant/daAlgorithms/NonLinearLeastSquares.py +++ b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py @@ -262,7 +262,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # # Obtention de l'analyse # ---------------------- - Xa = numpy.asmatrix(Minimum).T + Xa = numpy.asmatrix(Minimum).flatten().T logging.debug("%s Analyse Xa = %s"%(self._name, Xa)) # self.StoredVariables["Analysis"].store( Xa.A1 ) diff --git a/src/daComposant/daAlgorithms/ParticleSwarmOptimization.py b/src/daComposant/daAlgorithms/ParticleSwarmOptimization.py index 5c43edc..0f81857 100644 --- a/src/daComposant/daAlgorithms/ParticleSwarmOptimization.py +++ b/src/daComposant/daAlgorithms/ParticleSwarmOptimization.py @@ -35,7 +35,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): default = 50, typecast = int, message = "Nombre maximal de pas d'optimisation", - minval = -1 + minval = 1, ) self.defineRequiredParameter( name = "SetSeed", @@ -130,7 +130,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # ------------------------------ def CostFunction(x, QualityMeasure="AugmentedPonderatedLeastSquares"): _X = numpy.asmatrix(x).flatten().T - logging.debug("%s CostFunction X = %s"%(self._name, numpy.asmatrix( _X ).flatten())) + logging.debug("%s CostFunction X = %s"%(self._name, _X.A1)) _HX = Hm( _X ) _HX = numpy.asmatrix(_HX).flatten().T # @@ -164,8 +164,6 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): logging.debug("%s CostFunction J = %s"%(self._name, J)) return J # - # Paramètres de pilotage - # ---------------------- # Point de démarrage de l'optimisation : Xini = Xb # ------------------------------------ if type(Xb) is type(numpy.matrix([])): @@ -223,17 +221,17 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): if quality < qBest : Best = numpy.asmatrix(insect).flatten().A1 qBest = quality - logging.debug("%s Iteration %i : qBest = %.5f, Best = %s"%(self._name, n+1,qBest,numpy.asmatrix(Best.flatten()).A1)) + logging.debug("%s Iteration %i : qBest = %.5f, Best = %s"%(self._name, n+1,qBest,Best)) # if self._parameters["StoreInternalVariables"]: - self.StoredVariables["CurrentState"].store( numpy.asmatrix(Best.flatten()).A1 ) + self.StoredVariables["CurrentState"].store( Best ) self.StoredVariables["CostFunctionJb"].store( 0. ) self.StoredVariables["CostFunctionJo"].store( 0. ) self.StoredVariables["CostFunctionJ" ].store( qBest ) # logging.debug("%s %s Step of min cost = %s"%(self._name, self._parameters["QualityCriterion"], self._parameters["MaximumNumberOfSteps"])) logging.debug("%s %s Minimum cost = %s"%(self._name, self._parameters["QualityCriterion"], qBest)) - logging.debug("%s %s Minimum state = %s"%(self._name, self._parameters["QualityCriterion"], numpy.asmatrix(Best).flatten().T)) + logging.debug("%s %s Minimum state = %s"%(self._name, self._parameters["QualityCriterion"], Best)) logging.debug("%s %s Nb of F = %s"%(self._name, self._parameters["QualityCriterion"], (self._parameters["MaximumNumberOfSteps"]+1)*self._parameters["NumberOfInsects"]+1)) logging.debug("%s %s RetCode = %s"%(self._name, self._parameters["QualityCriterion"], 0)) # diff --git a/src/daComposant/daAlgorithms/QuantileRegression.py b/src/daComposant/daAlgorithms/QuantileRegression.py index 8e93044..616b41a 100644 --- a/src/daComposant/daAlgorithms/QuantileRegression.py +++ b/src/daComposant/daAlgorithms/QuantileRegression.py @@ -49,7 +49,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): default = 15000, typecast = int, message = "Nombre maximal de pas d'optimisation", - minval = -1 + minval = 1, ) self.defineRequiredParameter( name = "CostDecrementTolerance", @@ -120,7 +120,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # def GradientOfCostFunction(x): _X = numpy.asmatrix(x).flatten().T - logging.debug("%s GradientOfCostFunction X = %s"%(self._name, numpy.asmatrix( _X ).flatten())) + logging.debug("%s GradientOfCostFunction X = %s"%(self._name, _X.A1)) Hg = H["Tangent"].asMatrix( _X ) return Hg # @@ -158,7 +158,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # # Obtention de l'analyse # ---------------------- - Xa = numpy.asmatrix(Minimum).T + Xa = numpy.asmatrix(Minimum).flatten().T logging.debug("%s Analyse Xa = %s"%(self._name, Xa)) # self.StoredVariables["Analysis"].store( Xa.A1 )