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

« back to all changes in this revision

Viewing changes to doc/examples/gp_multiplexer.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
.. _mux:
 
2
    
 
3
=======================
 
4
Multiplexer 3-8 Problem
 
5
=======================
 
6
 
 
7
The multiplexer problem is another extensively used GP problem. Basically, it
 
8
trains a program to reproduce the behavior of an electronic `multiplexer
 
9
<http://en.wikipedia.org/wiki/Multiplexer>`_ (mux). Usually, a 3-8
 
10
multiplexer is used (3 address entries, from A0 to A2, and 8 data entries,
 
11
from D0 to D7), but virtually any size of multiplexer can be used.
 
12
 
 
13
This problem was first defined by Koza (see :ref:`refPapersMux`).
 
14
 
 
15
Primitives set used
 
16
===================
 
17
 
 
18
The primitive set is almost the same as the set used in :ref:`Parity
 
19
<parity>`. Three Boolean operators (and, or and not), imported from
 
20
:mod:`operator`, and a specific if-then-else primitive, which return either
 
21
its second or third argument depending on the value of the first one.
 
22
 
 
23
.. literalinclude:: /../examples/gp/multiplexer.py
 
24
   :lines: 56-62
 
25
 
 
26
As usual, we also add two terminals, a Boolean true and a Boolean false.
 
27
 
 
28
Evaluation function
 
29
===================
 
30
 
 
31
To speed up the evaluation, the computation of the input/output pairs is done
 
32
at start up, instead of at each evaluation call. This pre-computation also
 
33
allows to easily tune the multiplexer size, by changing the value of
 
34
*MUX_SELECT_LINES*.
 
35
 
 
36
.. literalinclude:: /../examples/gp/multiplexer.py
 
37
   :lines: 32-54
 
38
 
 
39
 
 
40
After that, the evaluation function is trivial, as we have both inputs and
 
41
output values. The fitness is then the number of well predicted outputs over
 
42
the 2048 cases (for a 3-8 multiplexer).
 
43
 
 
44
.. literalinclude:: /../examples/gp/multiplexer.py
 
45
   :pyobject: evalMultiplexer
 
46
 
 
47
The complete :example:`gp/multiplexer`.
 
48
 
 
49
.. _refPapersMux:
 
50
 
 
51
Reference
 
52
=========
 
53
 
 
54
*John R. Koza, "Genetic Programming I: On the Programming of Computers by
 
55
Means of Natural Selection", MIT Press, 1992, pages 170-187.*