Coder Social home page Coder Social logo

genetic_algorithm's Introduction

Genetic_Algorithm

C++ Genetic Algorithm implementation to predict a solution for the 0/1 Knapsack problem

Compares accuracy of Genetic Algorithm's prediction to the dynamic programming solution

GeneticAlgoTerminal

Approach:

  1. Genome represented as vector of 0 or 1 values, 1 for include item, 0 for exclude item
  2. Initialize random population
  3. Compute fitness of population
  4. Preserve the top k organisms in the population (elitism)
  5. Use tournament selection and 2 point crossover to produce next generation
  6. Mutate population at the given mutation rate
  7. Repeat steps 3 to 6 for the given number of Generations

References:

https://www.youtube.com/watch?v=nhT56blfRpE
https://www.youtube.com/watch?v=9zfeTw-uFCw&list=PLRqwX-V7Uu6bJM3VgzjNV5YxVxUwzALHV
https://www.youtube.com/watch?v=MacVqujSXWE

genetic_algorithm's People

Contributors

jonl40 avatar

Stargazers

Shanahan Dean avatar

Watchers

 avatar

genetic_algorithm's Issues

ERROR in vector

I've got an error when I was running your code
image
Could you please help me with this?

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.