项目作者: 0-harshit-0

项目描述 :
genetic algorithm
高级语言: JavaScript
项目地址: git://github.com/0-harshit-0/genetic-algo.git
创建时间: 2020-10-06T06:45:51Z
项目社区:https://github.com/0-harshit-0/genetic-algo

开源协议:

下载


genetic algorithm

special thaks to Daniel Shiffman and his work Nature of code.


In computer science and operations research, a genetic algorithm (GA) is a metaheuristic inspired by the process of natural selection that belongs to the larger class of evolutionary algorithms (EA). Genetic algorithms are commonly used to generate high-quality solutions to optimization and search problems by relying on biologically inspired operators such as mutation, crossover and selection.

process involved in genetic algorithm:-


    SETUP:
  1. Initialize. Create a population of N elements, each with randomly generated DNA.

  2. LOOP:
  3. Selection. Evaluate the fitness of each element of the population and build a matingpool.

  4. Reproduction. Repeat N times:

    1. Pick two parents with probability according to relative fitness.

    2. Crossover—create a “child” by combining the DNA of these two parents.

    3. Mutation—mutate the child’s DNA based on a given probability.

    4. Add the new child to a new population.



  5. Replace the old population with the new population and return to Step 2.