Git Product home page Git Product logo

geneticsharp's Introduction

GeneticSharp

####Build Build status

####Code quality Coverage Status FxCop DupFinder

####Release License Nuget Stack Overflow

GeneticSharp is a fast, extensible, multi-platform and multithreading C# Genetic Algorithm library that simplifies the development of applications using Genetic Algorithms (GAs).

Can be used in any kind of .NET apps, like ASP .NET MVC, Web Forms, Windows Forms, GTK# and Unity3D applications.


##Projects and papers using GeneticSharp

##Features

###Chromosomes Add your own chromosome representation implementing IChromosome interface or extending ChromosomeBase

###Fitness Add your own fitness evaluation, implementing IFitness interface.

###Populations

###Selections

###Crossovers

###Mutations

###Reinsertions

###Terminations

###Randomizations

###Runner app (console) with samples

  • AutoConfig

  • Bitmap equality

  • Equality equation

  • Equation solver

  • Function builder

  • Ghostwriter

  • TSP (Travelling Salesman Problem)

###Runner app (GTK#) with visual samples:

####TSP (Travelling Salesman Problem).

####Bitmap equality

###Multi-platform

  • Mono support.
  • Fully tested on Windows and MacOSX.

###Code quality

  • 100% unit test code coverage.
  • FxCop validated.
  • Code duplicated verification.
  • Good (and well used) design patterns.
  • 100% code documentation.

Setup

PM> Install-Package GeneticSharp

Usage

Creating your own fitness evaluation

public class MyProblemFitness : IFitness
{  
	public double Evaluate (IChromosome chromosome)
	{
		// Evaluate the fitness of chromosome.
	}
}

Creating your own chromosome

public class MyProblemChromosome : ChromosomeBase
{
    // Change the argument value passed to base construtor to change the length 
 	// of your chromosome.
 	public MyProblemChromosome() : base(10) 
    {
   		CreateGenes();
    }

	public override Gene GenerateGene (int geneIndex)
	{
		// Generate a gene base on my problem chromosome representation.
	}

	public override IChromosome CreateNew ()
	{
		return new MyProblemChromosome();
	}
}

Running your GA

var selection = new EliteSelection();
var crossover = new OrderedCrossover();
var mutation = new ReverseSequenceMutation();
var fitness = new MyProblemFitness();
var chromosome = new MyProblemChromosome();
var population = new Population (50, 70, chromosome);

var ga = new GeneticAlgorithm(population, fitness, selection, crossover, mutation);
ga.Termination = new GenerationNumberTermination(100);

Console.WriteLine("GA running...");
ga.Start();

Console.WriteLine("Best solution found has {0} fitness.", ga.BestChromosome.Fitness);

Roadmap

  • Unity3d game sample (WIP)
  • Improve Runner.GtkApp
    • Add new problems/classic samples
      • Checkers
      • Time series
      • Knapsack problem
  • Create the wiki
  • Add new selections
    • Reward-based
  • Add new crossovers
    • Voting recombination
    • Alternating-position (AP)
    • Sequential Constructive (SCX)
    • Shuffle crossover
    • Precedence Preservative Crossover (PPX)
  • Add new mutations
    • Non-Uniform
    • Flip Bit
    • Boundary
    • Gaussian
  • Add new terminations
    • Fitness convergence
    • Population convergence
    • Chromosome convergence
  • MonoTouch Runner app (sample)
  • Parallel populations (islands)

FAQ

Having troubles?


How to improve it?

Create a fork of GeneticSharp.

Did you change it? Submit a pull request.

License

Licensed under the The MIT License (MIT). In others words, you can use this library for developement any kind of software: open source, commercial, proprietary and alien.

geneticsharp's People

Contributors

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