Giter Club home page Giter Club logo

genetic_algorithms's Introduction

genetic

Basic Genetic Algorithm Implementation in python

Example Run

$ ./sentence_evolution.py 
Generation:  0          Average Fitness:  0.0182        Best Candidate:  YWpFwXbArSHNan SsGoof  [Fitness: 0.1429 ]
Generation:  1          Average Fitness:  0.0643        Best Candidate:  v wlooccEWinrjP rNIcQ  [Fitness: 0.2381 ]
Generation:  2          Average Fitness:  0.0873        Best Candidate:  AKhOgykAMainrjP rNgog  [Fitness: 0.2857 ]
Generation:  3          Average Fitness:  0.1094        Best Candidate:  MoDMTWJTrZLK r VUArec  [Fitness: 0.2857 ]
Generation:  4          Average Fitness:  0.1304        Best Candidate:  MoDMTWJTrMinjawhuhIvn  [Fitness: 0.381 ]
Generation:  5          Average Fitness:  0.1501        Best Candidate:  MoDMTWJTrMinjawhrNgog  [Fitness: 0.4762 ]
Generation:  6          Average Fitness:  0.1692        Best Candidate:  HoOYwDJTrMinjawhrNgog  [Fitness: 0.4762 ]
Generation:  7          Average Fitness:  0.1894        Best Candidate:  hoe TWJTrMinjawhrNgog  [Fitness: 0.5238 ]
Generation:  8          Average Fitness:  0.2088        Best Candidate:  HHq TWJTrMinjawhrNgog  [Fitness: 0.5238 ]
Generation:  9          Average Fitness:  0.2301        Best Candidate:  How vockrcinja hrNgog  [Fitness: 0.619 ]
Generation:  10         Average Fitness:  0.2543        Best Candidate:  hoe TWJTrMinjawhrNgon  [Fitness: 0.5714 ]
Generation:  11         Average Fitness:  0.2763        Best Candidate:  Hxe TWJTrMinjawhrNgon  [Fitness: 0.5714 ]
Generation:  12         Average Fitness:  0.2988        Best Candidate:  HowMTWJTrcinja hwwgog  [Fitness: 0.5714 ]
Generation:  13         Average Fitness:  00.318        Best Candidate:  How TdJTrcinja hwwgog  [Fitness: 0.619 ]
Generation:  14         Average Fitness:  0.3399        Best Candidate:  How TdJTrcin n DrKgpc  [Fitness: 0.6667 ]
Generation:  15         Average Fitness:  0.3572        Best Candidate:  How TdJTrcin n OragWz  [Fitness: 0.6667 ]
Generation:  16         Average Fitness:  0.3729        Best Candidate:  fWC ToJTroinja Drvgon  [Fitness: 0.6667 ]
Generation:  17         Average Fitness:  0.3915        Best Candidate:  How TPdTrMic asDrvgon  [Fitness: 0.7143 ]
Generation:  18         Average Fitness:  0.4054        Best Candidate:  HoLrTZJTrMin asDrvgon  [Fitness: 0.6667 ]
Generation:  19         Average Fitness:  0.4212        Best Candidate:  HowlToJTrHpn n DrNgon  [Fitness: 0.7143 ]
Generation:  20         Average Fitness:  0.4373        Best Candidate:  How vo crainra hrNgow  [Fitness: 0.7143 ]
Generation:  21         Average Fitness:  0.4527        Best Candidate:  How loherain achrNgon  [Fitness: 0.7143 ]
Generation:  22         Average Fitness:  00.465        Best Candidate:  How TdVTrMinRf DrNgon  [Fitness: 0.7143 ]
Generation:  23         Average Fitness:  0.4797        Best Candidate:  How To Trainza hrzgin  [Fitness: 0.8095 ]
Generation:  24         Average Fitness:  0.4916        Best Candidate:  How locTrMVn a  ragon  [Fitness: 0.7619 ]
Generation:  25         Average Fitness:  0.5026        Best Candidate:  HoC TWJTrainra Drsgon  [Fitness: 0.7619 ]
Generation:  26         Average Fitness:  0.5114        Best Candidate:  gow Tr TrainjaADrGgon  [Fitness: 0.7619 ]
Generation:  27         Average Fitness:  0.5235        Best Candidate:  How To UrMinja Drjgon  [Fitness: 0.8095 ]
Generation:  28         Average Fitness:  0.5331        Best Candidate:  HoN So Trainra DragWn  [Fitness: 0.8095 ]
Generation:  29         Average Fitness:  0.5411        Best Candidate:  Vow To Trainga DrKgon  [Fitness: 0.8571 ]
Generation:  30         Average Fitness:  0.5509        Best Candidate:  How vo Trainga DrKgon  [Fitness: 0.8571 ]
Generation:  31         Average Fitness:  0.5602        Best Candidate:  How ToJTrMin j Dragon  [Fitness: 0.8571 ]
Generation:  32         Average Fitness:  0.5683        Best Candidate:  How TohTrain a hragon  [Fitness: 0.9048 ]
Generation:  33         Average Fitness:  0.5788        Best Candidate:  How To TrMinga DrKgon  [Fitness: 0.8571 ]
Generation:  34         Average Fitness:  0.5814        Best Candidate:  How TZcTryin a Dragon  [Fitness: 0.8571 ]
Generation:  35         Average Fitness:  00.587        Best Candidate:  How To TraDn aTDrsgon  [Fitness: 0.8571 ]
Generation:  36         Average Fitness:  0.5963        Best Candidate:  How TW Train n DrZgon  [Fitness: 0.8571 ]
Generation:  37         Average Fitness:  0.6025        Best Candidate:  How uocTrain a Dragog  [Fitness: 0.8571 ]
Generation:  38         Average Fitness:  0.6102        Best Candidate:  HoL To TrainBa DrXgon  [Fitness: 0.8571 ]
Generation:  39         Average Fitness:  0.6191        Best Candidate:  How vo Train a DragoL  [Fitness: 0.9048 ]
Generation:  40         Average Fitness:  0.6245        Best Candidate:  How To TrMin a DrNgon  [Fitness: 0.9048 ]
Generation:  41         Average Fitness:  0.6341        Best Candidate:  How ToJTrainPa Dragon  [Fitness: 0.9048 ]
Generation:  42         Average Fitness:  0.6431        Best Candidate:  Low To Train a Dragoc  [Fitness: 0.9048 ]
Generation:  43         Average Fitness:  0.6514        Best Candidate:  How To Trazn a Drwgon  [Fitness: 0.9048 ]
Generation:  44         Average Fitness:  0.6577        Best Candidate:  How To Train a DrNgoK  [Fitness: 0.9048 ]
Generation:  45         Average Fitness:  0.6589        Best Candidate:  How To Train B Dragon  [Fitness: 0.9524 ]
Generation:  46         Average Fitness:  0.6661        Best Candidate:  How To Train B Dragon  [Fitness: 0.9524 ]
Generation:  47         Average Fitness:  0.6735        Best Candidate:  How To Train B Dragon  [Fitness: 0.9524 ]
Generation:  48         Average Fitness:  0.6781        Best Candidate:  HoO To Train a Dragon  [Fitness: 0.9524 ]
Generation:  49         Average Fitness:  0.6818        Best Candidate:  How To Train B Dragon  [Fitness: 0.9524 ]
Generation:  50         Average Fitness:  0.6915        Best Candidate:  How To Train a Dragon  [Fitness: 1.0 ]
>> Completed  51 generations of a population of 2000 candidates with a mutation rate of 1.0 %
>> Best Candidate is "How To Train a Dragon" with a fitness of  1.0

genetic_algorithms's People

Contributors

saursin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.