Coder Social home page Coder Social logo

jal278 / csharp-distributed-ga Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 36.33 MB

Simple distributed genetic algorithm in C# using MongoDB on the backend, with a c# worker, a unity worker, and a generalized web worker interface

C# 86.70% JavaScript 11.91% PHP 1.39%

csharp-distributed-ga's Introduction

csharp-distributed-ga

This project implements a simple distributed genetic algorithm in C# using MongoDB on the backend. Task evaluation can take place in languages other than C#: A C# worker, a Unity worker, and a generalized web worker interface are included.

The software should work wherever mono/.NET, PHP, and Mongo are supported (e.g. Linux, Windows, and OS X).

Overview

Genetic algorithms often involve significant computation to evaluate new individuals, often because of costly simulations (e.g. you want to evolve a brain for a robot that has many physical parts that must be realistically simulated).

Luckily, GAs play nice with parallelism (commonly, running a GA consists of many generations of independent evaluations of every individual in the population). Thus sometimes it is nice to have a distributed genetic algorithm in which one central server keeps track of the results and many worker computers can grab individual genomes, evaluate them, and then post the results back to the server. In this way, you can achieve a nice speed up in the GA from as many computers as you have available (assuming that the bottleneck is how long each evaluation takes, which is most often the case in real-world problems).

This particular implementation has the distributed GA written in C#, and depends on a Mongo database, which can be hosted locally or on a remote webserver. Worker clients can be written in any language although C# will likely be the most straight-forward. An example C# worker, an example Unity engine worker, and a general web-based worker interface (written in PHP) are provided.

Configuration

The basic C# configuration requires access to a mongo database (by default the c# example connects to localhost, e.g. a local database hosted on the same computer as the C# install). Mongo can be downloaded from http://www.mongodb.org/ and is multi-platform.

Running the Unity example requires a webserver (which can be locally hosted, e.g. through WAMP on windows or a local Apache/nginx install on Linux). The webserver configuration requires PHP (with the PHP MongoDB extension http://www.php.net/manual/en/mongo.installation.php).

Getting Started

The simplest way to get started is to install a local MongoDB server (download from http://www.mongodb.org/), make sure it is running, and then run the C# dist-ga project, which will populate the database with initial tasks. You can then run one or more instances of the C# simple-consumer executable which will then start evaluating the tasks and storing the results back to the database.

File Structure

  • csharp-dist-ga: The C# implementation of the distributed genetic algorithm and an example worker C# implementation.

  • simple-unity-client: A Unity game-engine client that can grab tasks from the C# server Note: requires a webserver running the generic php interface below

  • webserver-php-for-generic-clients: PHP scripts for a webserver, which can enable writing clients for any language capable of HTTP form requests. Note that this requires a webserver running PHP with the MongoDB extension.

csharp-distributed-ga's People

Contributors

jal278 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

hedrickdavid

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.