NiaPy/algorithms/basic/de.py 1 location
|
@@ 105-109 (lines=5) @@
|
| 102 |
|
jrand = int(rnd.random() * self.Np) |
| 103 |
|
|
| 104 |
|
for j in range(self.D): |
| 105 |
|
if rnd.random() < self.CR or j == jrand: |
| 106 |
|
newSolution.Solution[j] = Population[r[0]].Solution[j] + \ |
| 107 |
|
self.F * (Population[r[1]].Solution[j] - Population[r[2]].Solution[j]) |
| 108 |
|
else: |
| 109 |
|
newSolution.Solution[j] = Population[i].Solution[j] |
| 110 |
|
newSolution.repair() |
| 111 |
|
newSolution.evaluate() |
| 112 |
|
|
NiaPy/algorithms/modified/jde.py 1 location
|
@@ 99-103 (lines=5) @@
|
| 96 |
|
jrand = int(rnd.random() * self.Np) |
| 97 |
|
|
| 98 |
|
for j in range(self.D): |
| 99 |
|
if rnd.random() < self.CR or j == jrand: |
| 100 |
|
newSolution.Solution[j] = Population[r[0]].Solution[j] + self.F * ( |
| 101 |
|
Population[r[1]].Solution[j] - Population[r[2]].Solution[j]) |
| 102 |
|
else: |
| 103 |
|
newSolution.Solution[j] = Population[i].Solution[j] |
| 104 |
|
newSolution.repair() |
| 105 |
|
newSolution.evaluate() |
| 106 |
|
|