Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mcychan committed Jun 18, 2024
1 parent 3c38cc4 commit ab462be
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/hk/edu/gaSchedule/algorithm/Dlba.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ else if(_pa < .5)
private void updatePositions(List<T> population)
{
double mean = Arrays.stream(_loudness).average().orElse(0.0);
T localBest = _prototype.makeNewFromPrototype(null);
if(_gBest == null)
_gBest = _position[0];
T prevBest = _prototype.makeEmptyFromPrototype(null);
prevBest.updatePositions(_gBest);

for (int i = 0; i < _populationSize; ++i) {
float beta = (float) Configuration.random();
Expand Down Expand Up @@ -106,11 +107,6 @@ private void updatePositions(List<T> population)
}

_gBest = _lf.updatePosition(population.get(i), _position, i, _gBest);

T localTemp = _prototype.makeEmptyFromPrototype(null);
localTemp.updatePositions(_position[i]);
if (localTemp.dominates(localBest))
localBest = localTemp;
}

T globalBest = _prototype.makeEmptyFromPrototype(null);
Expand All @@ -124,7 +120,7 @@ private void updatePositions(List<T> population)
for(int j = 0; j < dim; ++j)
_position[i][j] = (float) (_gBest[j] + 𝜂 * mean);

if (globalBest.dominates(localBest)) {
if (prevBest.dominates(globalBest)) {
_rate[i] *= (float) Math.pow(_currentGeneration / 𝜂, 3);
_loudness[i] *= _alpha;
}
Expand Down

0 comments on commit ab462be

Please sign in to comment.