Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mcychan authored Oct 2, 2022
1 parent 6a38cf5 commit 338ad3e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions GaSchedule.Algorithm/Hgasso.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ private void UpdateVelocities(List<T> population)
protected override List<T> Replacement(List<T> population)
{
var populationSize = population.Count;

var decline = 1 - _climax;

for (int i = 0; i < populationSize; ++i)
{
var fitness = population[i].Fitness;
Expand All @@ -115,9 +116,11 @@ protected override List<T> Replacement(List<T> population)
population[i].ExtractPositions(_current_position[i]);
_sgBest = _current_position[i].ToArray();
_motility[i] = !_motility[i];
}
}

if(_repeatRatio > _climax && _sgBestScore > _climax) {
if (_repeatRatio > _sBestScore[i])
_sBestScore[i] -= _repeatRatio * decline;
if (_repeatRatio > _climax && _sgBestScore > _climax) {
if (i > (populationSize * _sgBestScore)) {
population[i].UpdatePositions(_current_position[i]);
_motility[i] = true;
Expand Down

0 comments on commit 338ad3e

Please sign in to comment.