Skip to content

Commit

Permalink
Fix bug scale factor of Gaussian in OriginalHS
Browse files Browse the repository at this point in the history
  • Loading branch information
thieu1995 committed Jan 16, 2024
1 parent b7d106f commit 49b42f1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mealpy/music_based/HS.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ def evolve(self, epoch):
pos_new[jdx] = self.pop[random_index].solution[jdx]
# Pitch Adjustment
if self.generator.uniform() <= self.pa_r:
delta = self.dyn_fw * self.generator.normal(self.problem.lb, self.problem.ub) # Gaussian(Normal)
mean = (self.problem.lb + self.problem.ub) / 2
std_dev = abs(self.problem.ub - self.problem.lb) / 6 # This assumes a range of +/- 3 standard deviations
delta = self.dyn_fw * self.generator.normal(mean, std_dev) # Gaussian(Normal)
pos_new[jdx] = pos_new[jdx] + delta[jdx]
pos_new = self.correct_solution(pos_new)
agent = self.generate_empty_agent(pos_new)
Expand Down

0 comments on commit 49b42f1

Please sign in to comment.