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

Function wrapped_function

deap/benchmarks/binary.py:27–38  ·  view source on GitHub ↗
(individual, *args, **kargs)

Source from the content-addressed store, hash-verified

25 def wrap(function):
26 @wraps(function)
27 def wrapped_function(individual, *args, **kargs):
28 # User must take care to make nelem an integer.
29 nelem = len(individual) // nbits
30 decoded = [0] * nelem
31 for i in range(nelem):
32 gene = int("".join(map(str,
33 individual[i*nbits:i*nbits+nbits])),
34 2)
35 div = 2**nbits - 1
36 temp = gene/div
37 decoded[i] = min_ + (temp * (max_ - min_))
38 return function(decoded, *args, **kargs)
39 return wrapped_function
40 return wrap
41

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…