Skip to content

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

Notifications You must be signed in to change notification settings

raulmartinezm/genetic-skeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published