~ubuntu-branches/ubuntu/utopic/deap/utopic-proposed

« back to all changes in this revision

Viewing changes to doc/code/tutorials/part_2/2_3_4_demes.py

  • Committer: Package Import Robot
  • Author(s): Daniel Stender, Miriam Ruiz, Daniel Stender, Jakub Wilk
  • Date: 2014-07-06 00:03:41 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20140706000341-s7gij1ki3d8xz6t9
Tags: 1.0.1-1
[ Miriam Ruiz ]
* New Upstream Release. Closes: #675200
* Upgraded Standards-Version from 3.9.2 to 3.9.5
* Switched to dh_python2
* Upgraded debian/compat to 9
* Added build-arch and build-indep targets to debian/rules
* Using awk to remove connection from the documentation to google analytics
* Using jquery.js and underscore.js from libjs-jquery and libjs-underscore
* Added patches/doc.patch

[ Daniel Stender ]
* deb/control:
  + Added myself to Uploaders.
  + Added version to b-p on python-all.
  + Updated Homepage.
  + Wrapped and sorted.
* deb/copyright:
  + Changed copyright file towards DEP-5.
  + Updated Source URI (project source moved to Github).
  + Added email addresses for copyright holders.
  + Dropped license for eap/toolbox.py (not included anymore).
  + Extended copyrights to 2014.
  + Added myself to copyrights for deb/*.
  + Specified license location.
* Added watch file [initial version by Jackson Doak].

[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## 2.3.4 Demes
 
2
import random
 
3
 
 
4
from deap import base
 
5
from deap import creator
 
6
from deap import tools
 
7
 
 
8
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
 
9
creator.create("Individual", list, fitness=creator.FitnessMin)
 
10
 
 
11
IND_SIZE=10
 
12
 
 
13
toolbox = base.Toolbox()
 
14
toolbox.register("indices", random.sample, range(IND_SIZE), IND_SIZE)
 
15
toolbox.register("individual", tools.initIterate, creator.Individual,
 
16
                 toolbox.indices)
 
17
toolbox.register("deme", tools.initRepeat, list, toolbox.individual)
 
18
 
 
19
DEME_SIZES = 10, 50, 100
 
20
population = [toolbox.deme(n=i) for i in DEME_SIZES]