Skip to content

Instantly share code, notes, and snippets.

@tarlanahad
Last active January 17, 2020 09:05
Show Gist options
  • Save tarlanahad/1493ffa73598af40b10ac23918f835d3 to your computer and use it in GitHub Desktop.
Save tarlanahad/1493ffa73598af40b10ac23918f835d3 to your computer and use it in GitHub Desktop.
class PSO:
w = 0.729
c1 = 1.49445
c2 = 1.49445
lr = 0.01
def __init__(self, dims, numOfBoids, numOfEpochs):
self.swarm_list = [self.Particle(dims, -500, 500) for i in range(numOfBoids)]
self.numOfEpochs = numOfEpochs
self.best_swarm_position = np.random.uniform(low=-500, high=500, size=dims)
self.best_swarm_error = 1e80 # Set high value to best swarm error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment