ó
ĘďLc           @   s<   d  Z  d d l Z d d d     YZ d d d     YZ d S(	   sł   Evolution Strategies for a Population.

Evolver classes manage a population of individuals, and are responsible
for taking care of the transition from one generation to the next.
i˙˙˙˙Nt   SteadyStateEvolverc           B   s   e  Z d  Z d   Z RS(   s   Evolve a population in place.

    This implements a Steady State GA, where the population of individuals
    is evolved in place.
    c         C   s   t  d   d  S(   Ns   Need to code this.(   t   NotImplementedError(   t   self(    (    s/   C:\Python27\Lib\site-packages\Bio\GA\Evolver.pyt   __init__   s    (   t   __name__t
   __module__t   __doc__R   (    (    (    s/   C:\Python27\Lib\site-packages\Bio\GA\Evolver.pyR    	   s   t   GenerationEvolverc           B   s    e  Z d  Z d   Z d   Z RS(   s    Evolve a population from generation to generation.

    This implements a Generational GA, in which the population moves from
    generation to generation.
    c         C   s   | |  _  | |  _ d S(   s  Initialize the evolver.

        Arguments:

        o starting_population -- An initial set of individuals to begin
        the evolution process from. This should be a list of Organism
        objects.

        o selector -- A Selection object that implements selection, along
        with mutation and crossover to select a new population from a
        given population.
        N(   t   _populationt	   _selector(   R   t   starting_populationt   selector(    (    s/   C:\Python27\Lib\site-packages\Bio\GA\Evolver.pyR      s    	c         C   s   x | |  j   s y: |  j j |  j   |  _  x |  j  D] } | j   q7 WWq t k
 r |  j  j   x |  j  D] } | GHqs Wt j   q Xq W|  j  S(   s8  Evolve the population through multiple generations.

        Arguments:

        o stoppping_criteria -- A function which, when passed the current
        individuals in the population, will determine when to stop
        the evolution process.

        Returns:

        o The final evolved population.
        (   R   R	   t   selectt   recalculate_fitnesst   KeyboardInterruptt   sortt   syst   exit(   R   t   stopping_criteriat   organismt   org(    (    s/   C:\Python27\Lib\site-packages\Bio\GA\Evolver.pyt   evolve(   s    	(   R   R   R   R   R   (    (    (    s/   C:\Python27\Lib\site-packages\Bio\GA\Evolver.pyR      s   	(    (    (   R   R   R    R   (    (    (    s/   C:\Python27\Lib\site-packages\Bio\GA\Evolver.pyt   <module>   s   	