Skip to content

Commit 85fc65c

Browse files
author
andrewtliew
committed
- 5% neutral agents added to population in devo.
1 parent d0e9019 commit 85fc65c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compas/numerical/devo/devo_numpy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ def devo_numpy(fn, bounds, population, generations, limit=0, elites=0.2, F=0.8,
9797

9898
# Population
9999

100-
agents = (rand(k, population) * (ub - lb) + lb)
100+
agents = (rand(k, population) * (ub - lb) + lb)
101+
agents[:, :int(round(population * 0.05))] *= 0
102+
101103
candidates = tile(array(range(population)), (1, population))
102104
candidates = reshape(delete(candidates, where(eye(population).ravel() == 1)), (population, population - 1))
103105

@@ -185,7 +187,7 @@ def devo_numpy(fn, bounds, population, generations, limit=0, elites=0.2, F=0.8,
185187
data[min(fbin), ts, :] = [1, 0, 0]
186188
data[max(fbin), ts, :] = [0, 0, 1]
187189

188-
if ts % 10 == 0:
190+
if ts % printout == 0:
189191
plt.imshow(data, origin='lower', aspect=aspect)
190192
plt.plot([generations * 0.5] * 2, [0, ydiv], ':k')
191193
plt.yticks(yticks, ylabels, rotation='horizontal')

0 commit comments

Comments
 (0)