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

« back to all changes in this revision

Viewing changes to doc/examples/short_onemax.rst

  • 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
 
.. _short-ga-onemax:
2
 
 
3
 
===============================
4
 
Short One Max Genetic Algorithm
5
 
===============================
6
 
 
7
 
The short one max genetic algorithm example is very similar to one max
8
 
example. The only difference is that it makes use of the
9
 
:mod:`~deap.algorithms` module that implements some basic evolutionary
10
 
algorithms. The initialization are the same so we will skip this phase. The
11
 
algorithms impemented use specific functions from the toolbox, in this case
12
 
:func:`evaluate`, :func:`mate`, :func:`mutate` and :func:`~deap.Toolbox.select`
13
 
must be registered. 
14
 
::
15
 
 
16
 
    toolbox.register("evaluate", evalOneMax)
17
 
    toolbox.register("mate", tools.cxTwoPoints)
18
 
    toolbox.register("mutate", tools.mutFlipBit, indpb=0.05)
19
 
    toolbox.register("select", tools.selTournament, tournsize=3)
20
 
 
21
 
The toolbox is then passed to the algorithm and the algorithm uses the
22
 
registered function. 
23
 
::
24
 
 
25
 
    pop = toolbox.population()
26
 
    hof = tools.HallOfFame(1)
27
 
 
28
 
    algorithms.eaSimple(toolbox, pop, cxpb=0.5, mutpb=0.2, ngen=40, halloffame=hof)
29
 
 
30
 
The short GA One max example makes use of a
31
 
:class:`~deap.tools.HallOfFame` in order to keep track of the best
32
 
individual to appear in the evolution (it keeps it even in the case it
33
 
extinguishes). All algorithms from the :mod:`~deap.algorithms` module do take
34
 
a *halloffame* argument that gets updated after every evaluation section.=======
35
 
The short GA One max example makes use of a :class:`~eap.halloffame.HallOfFame` in order to keep track of the best individual to appear in the evolution (it keeps them even in the case they extinguish). All algorithms from the :mod:`eap.algorithms` module do take a *halloffame* argument that gets updated after every evaluation section of the basic algorithms.