Code Monkey home page Code Monkey logo

invpend's Introduction

Inverted Pendulum Genetic Algorithm in C

Copyright &copyr; 2013 Bart Massey

This small program is a demo written largely in my Fall 2013 CS 441/541 Intro AI class at Portland State University. It contains a (probably borked) model of the inverted pendulum problem, together with a GA-based optimizer that tries to position the cart in a completely open-loop fashion to maximize the time that the pendulum will stay balanced while the cart remains on the track bounds.

The genome is just a list of changes to cart position over time. New instances are produced by crossover taking an arbitrary prefix of one parent to an arbitrary suffix of another. Selection is by rank-ordering. Mutation is by replacement of a single cart position in the genome.

There are a few arguments that can be discovered by reading the code. The code also contains some hard-coded constants.

Some scripts are available for running the program and plotting stats with gnuplot.

  • Use try.sh with a given population and number of generations to get files showing behavior over time. This script requires /usr/bin/time, available from the time package in Debian.

  • Use show.sh to plot a graph of performance over generations. This script requires gnuplot, available in Debian.

There is also an X version that displays some graphics. It requires pkg-config, libcairo-dev and libxcb-util0-dev. Say make xinvpend. I don't remember how it works.

This program is licensed under the "MIT License". Please see the file COPYING in this distribution for license terms.

invpend's People

Contributors

bartmassey avatar keith-packard avatar

Stargazers

 avatar

Watchers

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