Code Monkey home page Code Monkey logo

genetic-skeleton's Introduction

Genetic Algorithm Skeleton

Simple genetic algorithm skeleton in C language. Used as scaffolding for my bachelor final project.

Genetic algorithm is a class of evolutionary algorithm inspired by natural selection processes, such as inheritance, mutation, selection and crossover.

The algorithm produces candidate solutions (probably not the best) to a problem. It can be applied to local search problems like decision trees, hyperparameter optimization, puzzle solving, etc.

The basic workflow if the algorithm is:

1. Generate a population randomly.
2. Repeat until a **termination condition** has been reached:
	2.1 Evaluate population
	2.2 Crossover population
	2.3 Mutate population
	2.4 Select individuals that survive to the next iteration.

Input values

  • Population size.
  • Number of iterations.
  • Crossover probability.
  • Mutation probability.
  • Elitism

Encoding

  • Binary encoding

TODO:

  • Permutation
  • Value encoding
  • Tree encoding

Crossover

  • One-point crossover.

TODO:

  • Uniform crossover
  • Arithmetic crossover.
  • Two-point crossover.

Mutation

  • Bit string mutation.
  • Bit flip mutation.

Tests

I've introduced MinUnit, a minimal unit testing for C. I like a lot its simplicity and effectivity.

	$ make test

Links

Application examples

Some applications of the algorithm are available in examples.

genetic-skeleton's People

Contributors

obsidianm avatar raulmartinezm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.