Skip to content

lfarizav/geneticalgorithm

Repository files navigation

Basic Genetic Algorithm

Copyright(c) 2017 Luis Felipe Ariza Vesga (lfarizav@gmail.com)

Introduction

This repository shows how the Genetic Algorithm works. At the beginning it is a good deal to understand basic concepts, before going to master leagues. I hope this code will contribute to you to solve many basic questions about programming genetic algorithms.

Build and Run

  1. Use gcc -o algorithm test_algorithm.c algorithm.c population.c individual.c -lm to build the executable.
  2. Use ./algorithm to run the algorithm.

Note: This code do not use SSE2/AVX intrinsic instructions (SIMD).

Results

Generation: 32, fittest: 0

Population is: 000011111111111111111011 100101001111110110100011 000111001111110010111011 000111001111110110111011 000111001111110110100011 000111101111110110111001 000011001111110110100010 010011011011111111111000 000111001111110010111011 000011001111110110101011 000111001111110010111011 000111001111110010111011 000111001111110110110011 000111001111110010111011 000001111110111111111111 000011111111111111111011 000111001111110110110011 000111001111110110110011 000111101111110110111001 000011111111111111111011 000111001111110110110011 000111001111110010110011 000111101111110111111001 010111001111110110100011 000111001111110010111011 000111001111110110110011 000111001111110010111011 000011111111111111111011 000111011111110110101011 000111001111110010101011

Fitness values are: 24 .............. 17 Find the following array: 000011111111111111111011 Solution found! Generation 32 The array found is: 000011111111111111111011!

About

A basic Genetic Algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages