Module evolver
[hide private]
[frames] | no frames]

Module evolver

source code

evolver

This module contains the methods to start and finish a complete evolutionary run. The present version can run strongly-typed Koza-based GP using tournament selection.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Author: by Mehdi Khoury

Version: 1.20

Copyright: (c) 2009 Mehdi Khoury under the mit license http://www.opensource.org/licenses/mit-license.html

Contact: mehdi.khoury at gmail.com

Classes [hide private]
  CrossoverProbError
  MutationProbError
  OperatorProbError
  PopSizeError
Functions [hide private]
 
EvolutionRun(popsize, root_node, mindepth, maxdepth, buildmethod, max_nb_runs, fitness_criterion, crossover_prob, mutation_prob, size, prob_selection, dbname, verbose)
The highest level function of the package.
source code
 
TournamentSelectionEvolveDBPopulation2(popsize, maxdepth, crossover_prob, mutation_prob, size, prob_selection, dbname, tablename, tablename2)
create a new population of randomly generated trees and write this new generation to a new table of name 'tab'+generation number in the database.
source code
Variables [hide private]
  __package__ = None
Function Details [hide private]

EvolutionRun(popsize, root_node, mindepth, maxdepth, buildmethod, max_nb_runs, fitness_criterion, crossover_prob, mutation_prob, size, prob_selection, dbname, verbose)

source code 

Function: EvolutionRun

The highest level function of the package. It starts an evolutionary run with given parameters,and gives indications of what is found after each generation.

Parameters:
  • popsize - size of the population root_node: specify the root node and its arity (nb of children). e.g. (0,2,'root')
  • mindepth - min tree depth (at the moment only 2 working)
  • maxdepth - max depth of trees in new generation (should be >=3)
  • buildmethod - which Koza method is used to build the trees (either 'AddHalfNode' or 'AddFullNode' or 'AddGrowNodeMin' respectively for Ramped Half-n-Half, Full, or Half)
  • max_nb_runs - the search will gon on until a maximum number of generations is reached
  • fitness_criterion - the search will stop if the fitness found is <= to the ideal fitness
  • crossover_prob - probability of crossover (will determine what proportion of the population will be replaced by crossover-generated offsprings)
  • mutation_prob - probability of crossover (will determine what proportion of the population will be replaced by mutation-generated offsprings)
  • dbname - path to database e.g. r'D:d_work\pythongp\pySTGP_0.51\src\pop_db'
  • verbose - print the best tree of each generation

TournamentSelectionEvolveDBPopulation2(popsize, maxdepth, crossover_prob, mutation_prob, size, prob_selection, dbname, tablename, tablename2)

source code 

Function: TournamentSelectionEvolveDBPopulation2

create a new population of randomly generated trees and write this new generation to a new table of name 'tab'+generation number in the database.

Parameters:
  • popsize - size of the population
  • maxdepth - max depth of trees in new generation
  • crossover_prob - probability of crossover (will determine what proportion of the population will be replaced by crossover-generated offsprings)
  • mutation_prob - probability of crossover (will determine what proportion of the population will be replaced by mutation-generated offsprings)
  • dbname - path to database e.g. r'D:d_work\pythongp\pySTGP_0.51\src\pop_db'
  • tablename - name of the database table of the initial population
  • tablename2 - name of the database table of the next generation