Skip to content

Commit aa72c74

Browse files
authored
Add files via upload
1 parent e34bcd8 commit aa72c74

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

algorithm/Dlba.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ def updatePositions(self, population):
5656
gBest, maxValues, minValue = self._gBest, self._maxValues, self._minValue
5757
position, rate, loudness = self._position, self._rate, self._loudness
5858

59-
localBest = prototype.makeNewFromPrototype()
6059
if gBest is None:
6160
gBest = position[0]
61+
prevBest = prototype.makeEmptyFromPrototype()
62+
prevBest.updatePositions(gBest)
6263

6364
populationSize = self._populationSize
6465
for i in range(populationSize):
@@ -81,10 +82,6 @@ def updatePositions(self, population):
8182

8283
gBest = self._lf.updatePosition(population[i], position, i, gBest)
8384

84-
localTemp = prototype.makeEmptyFromPrototype()
85-
localTemp.updatePositions(position[i])
86-
if localTemp.dominates(localBest):
87-
localBest = localTemp
8885

8986
globalBest = prototype.makeEmptyFromPrototype()
9087
globalBest.updatePositions(gBest)
@@ -96,9 +93,9 @@ def updatePositions(self, population):
9693
for j in range(self._chromlen):
9794
position[i, j] = gBest[j] + 𝜂 * mean
9895

99-
if globalBest.dominates(localBest):
100-
rate[i] *= (_currentGeneration / 𝜂) ** 3
101-
loudness[i] *= alpha
96+
if prevBest.dominates(globalBest):
97+
rate[i] *= (currentGeneration / 𝜂) ** 3
98+
loudness[i] *= self._alpha
10299

103100
position[i] = self._lf.optimum(position[i], population[i])
104101

0 commit comments

Comments
 (0)