MCPcopy Create free account
hub / github.com/dimvasdim/Thesis / evaluate

Method evaluate

pso.py:25–34  ·  view source on GitHub ↗
(self, obj_function, steady, cost, model)

Source from the content-addressed store, hash-verified

23 self.gbest_fitness = 0
24
25 def evaluate(self, obj_function, steady, cost, model):
26 fitness = obj_function(self.position, steady, cost, model)
27 # Check the personal best
28 if fitness > self.pbest_fitness:
29 self.pbest_fitness = fitness
30 self.pbest_position = self.position
31 # Check the global best
32 if fitness > self.gbest_fitness:
33 self.gbest_fitness = fitness
34 self.gbest_position = self.position
35
36 def update_velocity(self, w, c1, c2):
37 r1 = random()

Callers 1

particle_swarmFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected