diff --git a/pyswarms/discrete/binary.py b/pyswarms/discrete/binary.py index d32cdac1..857b4ac4 100644 --- a/pyswarms/discrete/binary.py +++ b/pyswarms/discrete/binary.py @@ -207,7 +207,7 @@ def optimize(self, objective_func, iters, fast=False, **kwargs): self.swarm.position = self._compute_position(self.swarm) # Obtain the final best_cost and the final best_position final_best_cost = self.swarm.best_cost.copy() - final_best_pos = self.swarm.best_pos.copy() + final_best_pos = self.swarm.position[self.swarm.pbest_cost.argmin(axis=0)].copy() self.rep.log( "Optimization finished | best cost: {}, best pos: {}".format( final_best_cost, final_best_pos