Code Monkey home page Code Monkey logo

geneticgpu's Introduction

Genetic GPU

Genetic GPU is a non-convex optimization algorithm that uses WebGL to optimize user-inputted functions. It parallelizes both on the GPU and across the network (by making use of multiple GPUs at once).

So What?

Uniform sampling of a 2D surface for optimization is not a new idea; Genetic GPU shines when presented with an N-dimensional function to optimize (where N is higher than 2).

In order to optimize this type of function, Genetic GPU randomly distributes a 2D grid of samples into the N-dimensional search space. It then evaluates the fitness of each sample according to the user-inputted function and then projects these samples onto the screen buffer for collection (with the vertical height being the fitness).

With this projection, post-processing can easily extract out the lowest point (sample with best fitness, denoted as a white square on the shader views). The tricky thing is that because of this N-D to 2D projection, the actual location of the sample is lost. Genetic GPU overcomes this obstacle by encoding the position of the sample into the RGB color space of the output buffer.

Since only 3 variables can be encoded at once into the RGB data, Genetic GPU will compile as many shader programs as necessary to extract out all the variables (aka 2 shader programs for 5 variables, 3 shader programs for 7).

After the best sample's position is extracted from the screen buffer, Genetic GPU then 'mutates' this sample in N-dimensions with a pre-defined accuracy and resamples. This improves accuracy and is the namesake of the algorithm.

Project Writeup

A detailed writeup of the algorithm with all the gory details (compiled for ME202 at UC Berkeley) is available here.

Demo

A hosted interface for the demo is available here (webkit only). Note that once the window location gets a room ID appended to it, you can share that link with a friend to divide up the search space and parallelize your optimization.

geneticgpu's People

Contributors

pcottle avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

martina6hall

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.