Coder Social home page Coder Social logo

gga's Introduction

GGA

GGA - Generic Genetic Algorithm

This is a simple library to solve problems using GA. It requires a modern C++ compiler, with C++11 enabled. It should be as portable as your compiler.

#Examples

##Simples

A simple example where the genes are a double value, and the fitness function is sin(genes). Crossover generates two children. One with a value larger than the parents, and another with the value smaller. Mutation adds a random number to fitness

##Boolean

A slightly more intricate example where the gene is enconded in a boolean vector, with fitting function as sin(genes/10.0) The crossover children will have, on average, half the genes from each parent, whereas mutation is changing the value some gene fields.

#Usage

This is a template library. The base class, T, must contain implement the following fields:

##Empty constructor

T()

##Fitness value

Plain double precision value, where the fitness of the indivitual must be stored.

double fitness;

##CrossOver function

Function that receives another individual and returns the original individual, bi and two children. These children must already have its fitness calculated.

std::array<T,4> CrossOver(const T& bi);

##Mutate function

Function that mutates the individual with probability p. How this mutation will be done depends on the user.

void Mutate(double p);

gga's People

Contributors

lucascampos avatar

Stargazers

Ruoye-W avatar

Watchers

James Cloos avatar  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.