Giter VIP home page Giter VIP logo

genetic's Introduction

genetic: A simple Genetic Programming library

This is a simple Genetic Programming library for Java. It is easy to follow and has no external dependencies.

The best way to learn it at the moment is to browse through its unit tests.

EvolutionEngineTest: Promoting "dominant" genes

EvolutionEngineTest.testEvolution() - Initialises and runs the Evolution Engine.

In this simple example, the fitness function promotes the "dominant" genes 0 and 1 and ingnores the "useless" . gene.

The initial generation

Chromosome                                       Fitness Score
==========                                       =============
010101010101010101010101010101010101010101010101 0.5
10101010101010101010101.....01010101010101010101 0.4583333333333333
01010101010110101.....................0101010101 0.2916666666666667
10101010101010101010..........101010101010101010 0.3958333333333333
01010010...010101010101....011010101101010101010 0.4375
101010010101010101010101010101101010101010101010 0.5
0101010101010101...10101010101010101101010101010 0.4791666666666667
1010101010101.........01010101010101010101101010 0.4166666666666667
01010101.................0101010..........101010 0.22916666666666666
10101010101............010101010..........101010 0.2708333333333333
01010101010101010101010101010101...........01010 0.3958333333333333
101010101010101010010101010101010101010101101010 0.5
010101010101101....01010101010101010101010101010 0.4583333333333333
101010101010101010101010101010101010101010101010 0.5

evolves into this (0 has won)

Chromosome                                       Fitness Score
==========                                       =============
000000000000000000000000000000010000000000000000 0.9791666666666666
000000000000000000000000000000010000000000000000 0.9791666666666666
000000000000000000000000000000010000000000000000 0.9791666666666666
000000000000000000000000000000001000000000000000 0.9791666666666666
000000000000000000000000000000010000000000000000 0.9791666666666666
000000000000000000000000000000010000000000000000 0.9791666666666666
001000000000000000000000000000010000000000000000 0.9583333333333334
000000000000000000000000000000000000000000000000 1.0 <- Winner!
000000000000000000000000000000010000000000000000 0.9791666666666666
000000000000000000000000000000010000000000000000 0.9791666666666666
000000000000000100000000000000000000000000000000 0.9791666666666666
000000000000000000000000000000010000000000000000 0.9791666666666666
000000000000000000000000000000010000000000000000 0.9791666666666666
000000000000000000000000000000010000000000000000 0.9791666666666666

Here is the alterntive outcome (1 has won):

Chromosome                                       Fitness Score
==========                                       =============
111111111111101111111111111111011111111111111111 0.9583333333333334
111111101111111111111111111111011111110111111111 0.9375
111111111110111111111111011111111111111111111111 0.9583333333333334
111111101111111111111111111111011111111111111101 0.9375
111111111110111111111111111111011111110111111111 0.9375
111111101111111111111111111111011111111111111101 0.9375
111111111111101111111111111111011111111111111111 0.9583333333333334
111111101111111111111111111111011111110111111111 0.9375
111111111110111111111111111111111111111111111111 0.9791666666666666
111111101111111111111111011111011111110111111101 0.8958333333333334
111111111111111111111111111111111111111111111111 1.0 <- Winner!
111111101111111111111111011111111111111111111101 0.9375
111111111110111111111111111111011111110111111101 0.9166666666666666
111110111110111111111111111111011111110111111111 0.9166666666666666

Enjoy! โ˜•

genetic's People

Contributors

algodesigner 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.