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
97
            r = rnd.sample(range(0, self.Np), 3)
98
            while i in r:
99
                r = rnd.sample(range(0, self.Np), 3)
100
            jrand = int(rnd.random() * self.Np)
101
102
            for j in range(self.D):
103
                if rnd.random() < newSolution.CR or j == jrand:
104
                    newSolution.Solution[j] = Population[r[0]].Solution[j] + newSolution.F * (
105
                        Population[r[1]].Solution[j] - Population[r[2]].Solution[j])
106
                else: