Giter Site home page Giter Site logo

gnome.js's Introduction

gNome.js

Javascript library for painless genetic algorithms. Pronouced gee-nome. (Genome. gNome. Get it?)

Basic Usage Guide:

  1. Include the gNome.js script in the project folder.
  2. Add the script tag to the HTML files which will access it.
  3. Script!
var baseGenome = gNome.makeGenome({
  traits:{
    traitName:{
      wildCard:function() {
        //Return a randomly generated trait.
      },
      fitness:function(_trait) {
        //Return a number.
      },
      crossover:function(_traitA, _traitB) {
        //Return a trait.
      },
      mutate:function(_trait) {
        //Return a trait.
      }
    }
  },
  selection: function(_population) {
    //Return an individual from _population.
  }
});
var basePop = baseGenome.makePopulation(20);
console.log(basePop.sumGeneration()); //Check how 'optimal' the current population is.
basePop.incrementGeneration();
console.log(basePop.sumGeneration()); //Hopefully this is larger than the previous number.

Terminology:

Trait: Anything! A Number, an Array, an Object. This is what you will use to judge fitness, what will be transferred to children, and what can be mutated to offer diversity to the genome.

Fitness: How 'good' something is. For example, an object that consumes less resource than another object would have a higher fitness. In another case, having more value than another may result in a higher fitness.

Examples:

Todo.

gnome.js's People

Contributors

zerrien avatar

Watchers

James Cloos avatar  avatar

Forkers

mhcrnl

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.