Skip to content

Commit

Permalink
Merge.
Browse files Browse the repository at this point in the history
--HG--
branch : 0.8-dev
  • Loading branch information
cmd-ntrf authored and felix.antoine.fortin committed Nov 9, 2011
2 parents fa77914 + 171ef24 commit f923b77
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 15 deletions.
11 changes: 11 additions & 0 deletions .hgtags
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ a997cc0f43c9f7aff254a149554ee2abc462d5ad 0.6
0000000000000000000000000000000000000000 0.7-a1
7bc01a01818ac682610056b00bacc5652a9403c5 0.7-a1
b3628d3a91a866bf2daa02c0d4bd829ea13819d6 0.7
208cf38a5b173cd93390afd743ec7fbc9d2be902 0.7
0000000000000000000000000000000000000000 0.7
0000000000000000000000000000000000000000 0.7
8425fa969a49f9c3ea2939af84a877eef0311dbb 0.7
f2319496bb4754796c612617642a59f3856aa8dc 0.7.1
8425fa969a49f9c3ea2939af84a877eef0311dbb 0.7
0000000000000000000000000000000000000000 0.7
f2319496bb4754796c612617642a59f3856aa8dc 0.7.1
0000000000000000000000000000000000000000 0.7.1
0000000000000000000000000000000000000000 0.7.1
2cd1b7afc8b721096e93da860297f0c66404681d 0.7.1
11 changes: 3 additions & 8 deletions INSTALL.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
UNIX based platforms
====================
UNIX based platforms and Windows
================================

In order to install DEAP from sources, change directory to the root of deap and type in :

$ python setup.py install

This will try to install deap into your package directory, you might need permissions to write to this directory.

Windows
=======

Not tried yet ... tell us if it works.
This will try to install deap into your package directory, you might need permissions to write to this directory.

Options
=======
Expand Down
24 changes: 24 additions & 0 deletions doc/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
{% extends "!layout.html" %}

{%- block extrahead %}
{{ super() }}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-15144370-3']);
_gaq.push(['_trackPageview']);
</script>
{% endblock %}

{% block rootrellink %}
<li><a href="http://code.google.com/p/deap/">Project Homepage</a>{{ reldelim1 }}</li>
<li><a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }} </li>
{% endblock %}


{% block footer %}
{{ super() }}
<script type="text/javascript">
(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ?
'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
})();
</script>
{% endblock %}
49 changes: 46 additions & 3 deletions doc/tutorials/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ with a speed vector and a maximizing two objectives fitness attribute.

A Funky One
+++++++++++
Supposing your problem have very specific needs. It is also possible to build custom individuals very easily. The next individual created is a list of alternating integers and floating point numbers, using the :func:`~deap.tools.initCycle` function.
Supposing your problem have very specific needs. It is also possible to build
custom individuals very easily. The next individual created is a list of
alternating integers and floating point numbers, using the
:func:`~deap.tools.initCycle` function.
::

from deap import base
Expand All @@ -237,7 +240,7 @@ Supposing your problem have very specific needs. It is also possible to build c
Calling :func:`toolbox.individual` will readily return a complete individual
of the form ``[int float int float ... int float]`` with a maximizing two
objectives fitness attribute.

Population
----------
Population are much like individuals, instead of being initialized with
Expand Down Expand Up @@ -309,4 +312,44 @@ using the *n* argument of the :func:`~deap.tools.initRepeat` function.
DEME_SIZES = 10, 50, 100
population = [toolbox.deme(n=i) for i in DEME_SIZES]
population = [toolbox.deme(n=i) for i in DEME_SIZES]

Seeding a Population
++++++++++++++++++++
Sometimes, a first guess population can be used to initialize an evolutionary
algorithm. The key idea to initialize a population with not random individuals
is to have an individual initializer that takes a content as argument.
::

from deap import base
from deap import creator

import json

creator.create("FitnessMax", base.Fitness, weights=(1.0, 1.0))
creator.create("Individual", list, fitness=creator.FitnessMax)

def initIndividual(icls, content):
return icls(content)

def initPopulation(pcls, ind_init, filename):
contents = json.load(open(filename, "r"))
return pcls(ind_init(c) for c in contents)

toolbox = base.Toolbox()

toolbox.register("individual_guess", initIndividual, creator.Individual)
toolbox.register("population_guess", initPopulation, list, toolbox.individual_guess, "my_guess.json")
population = toolbox.population_guess()

The population will be initialized from the file ``my_guess.json`` that shall
contain a list of first guess individuals. This initialization can be combined
with a regular initialization to have part random and part not random
individuals. Note that the definition of :func:`initIndividual` and the
registration of :func:`individual_guess` are optional as the default
constructor of a list is similar. Removing those lines leads to the following.
::

toolbox.register("population_guess", initPopulation, list, creator.Individual, "my_guess.json")

6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

eap_ctools = Extension('deap.cTools',
sources = ['deap/cTools.cpp'])
#sn_cevaluator = Extension('evaluateSN_C',
#sources = ['examples/SNC.cpp'])


setup(name='deap',
version=deap.__version__,
version=deap.__revision__,
description='Distributed Evolutionary Algorithms in Python',
long_description=open('README.txt').read(),
author='deap Development Team',
Expand Down

0 comments on commit f923b77

Please sign in to comment.