Description of the bug
pp = epoch / self.epoch
## Pedal marking behaviour
pop_new = []
for idx in range(0, self.pop_size):
if pp <= epoch/3: <= this is where the errors occur
pos_new = self.pop[idx].solution + (-pp * self.generator.random(self.problem.n_dims) * self.pop[idx].solution)
elif epoch/3 < pp <= 2*epoch/3: <= this is where the errors occur
qq = pp * self.generator.random(self.problem.n_dims)
pos_new = self.pop[idx].solution + (qq * (self.g_best.solution - self.generator.integers(1, 3) * self.g_worst.solution))
else:
ww = 2 * pp * np.pi * self.generator.random(self.problem.n_dims)
pos_new = self.pop[idx].solution + (ww*self.g_best.solution - np.abs(self.pop[idx].solution)) - (ww*self.g_worst.solution - np.abs(self.pop[idx].solution))
pos_new = self.correct_solution(pos_new)
agent = self.generate_empty_agent(pos_new)
pop_new.append(agent)
if self.mode not in self.AVAILABLE_MODES:
agent.target = self.get_target(pos_new)
self.pop[idx] = self.get_better_agent(agent, self.pop[idx], self.problem.minmax)
It should be something like this
for idx in range(0, self.pop_size):
if pp <= 1/3: # Gait while walking
pos_new = self.pop[idx].solution + (-pp * self.generator.random(self.problem.n_dims) * self.pop[idx].solution)
print("Case 1")
elif 1/3 < pp <= 2/3: # Careful Stepping
qq = pp * self.generator.random(self.problem.n_dims)
pos_new = self.pop[idx].solution + (qq * (self.g_best.solution - self.generator.integers(1, 3) * self.g_worst.solution))
print("Case 2")
else:
ww = 2 * pp * np.pi * self.generator.random(self.problem.n_dims)
pos_new = self.pop[idx].solution + (ww*self.g_best.solution - np.abs(self.pop[idx].solution)) - (ww*self.g_worst.solution - np.abs(self.pop[idx].solution))
print("Case 3")
Steps To Reproduce
- Go to
mealpy/bio_based/BBOA.py
- at lines 68,70
Additional Information
No response
Description of the bug
It should be something like this
Steps To Reproduce
mealpy/bio_based/BBOA.pyAdditional Information
No response