Code Duplication    Length = 5-5 lines in 2 locations

NiaPy/algorithms/basic/de.py 1 location

@@ 105-109 (lines=5) @@
102
103
            for j in range(self.D):
104
                if rnd.random() < self.CR or j == jrand:
105
                    newSolution.Solution[j] = Population[r[0]].Solution[j] + \
106
                        self.F * (Population[r[1]].Solution[j] - Population[r[2]].Solution[j])
107
                else:
108
                    newSolution.Solution[j] = Population[i].Solution[j]
109
            newSolution.repair()
110
            newSolution.evaluate()
111
112
            if newSolution.Fitness < self.bestSolution.Fitness:

NiaPy/algorithms/modified/jde.py 1 location

@@ 99-103 (lines=5) @@
96
            else:
97
                newSolution.F = Population[i].F
98
99
            if rnd.random() < self.Tao:
100
                newSolution.CR = rnd.random()
101
            else:
102
                newSolution.CR = Population[i].CR
103
104
            r = rnd.sample(range(0, self.Np), 3)
105
            while i in r:
106
                r = rnd.sample(range(0, self.Np), 3)