From 9e8b1966fc8d1773b9d9bfd4e11101468c3ad0ba Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Sun, 19 Mar 2017 21:03:06 +0100 Subject: [PATCH] Minor correction to correctly handle array copy --- src/daComposant/daAlgorithms/TabuSearch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/daComposant/daAlgorithms/TabuSearch.py b/src/daComposant/daAlgorithms/TabuSearch.py index 161fd4a..415800d 100644 --- a/src/daComposant/daAlgorithms/TabuSearch.py +++ b/src/daComposant/daAlgorithms/TabuSearch.py @@ -134,15 +134,15 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # Définition de la fonction de deplacement # ---------------------------------------- def Tweak( x, NoiseDistribution, NoiseAddingProbability ): - _X = numpy.asmatrix(numpy.ravel( x )).T + _X = numpy.matrix(numpy.ravel( x )).T if NoiseDistribution == "Uniform": - for i in xrange(_X.size): + for i in range(_X.size): if NoiseAddingProbability >= numpy.random.uniform(): _increment = numpy.random.uniform(low=-nrange[i], high=nrange[i]) # On ne traite pas encore le dépassement des bornes ici _X[i] += _increment elif NoiseDistribution == "Gaussian": - for i in xrange(_X.size): + for i in range(_X.size): if NoiseAddingProbability >= numpy.random.uniform(): _increment = numpy.random.normal(loc=0., scale=sigma[i]) # On ne traite pas encore le dépassement des bornes ici -- 2.39.2