MCPcopy Create free account
hub / github.com/DEAP/deap / generate

Function generate

examples/pso/basic.py:31–36  ·  view source on GitHub ↗
(size, pmin, pmax, smin, smax)

Source from the content-addressed store, hash-verified

29 smin=None, smax=None, best=None)
30
31def generate(size, pmin, pmax, smin, smax):
32 part = creator.Particle(random.uniform(pmin, pmax) for _ in range(size))
33 part.speed = [random.uniform(smin, smax) for _ in range(size)]
34 part.smin = smin
35 part.smax = smax
36 return part
37
38def updateParticle(part, best, phi1, phi2):
39 u1 = (random.uniform(0, phi1) for _ in range(len(part)))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…