Skip to content

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

License

Notifications You must be signed in to change notification settings

rfrerebe/GeneticSharp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GeneticSharp

Build status Coverage Status License

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.


Features


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 MyProblemChrosome : ChromosomeBase
{
	public override Gene GenerateGene (int geneIndex)
	{
		// Generate a gene base on my problem chromosome representation.
	}

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

Running your GA

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

var ga = new GeneticAlgorithm(population, fitness, selection, crossover, mutation);

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

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

Roadmap

  • Create and publish NuGet package
  • Unity3d game sample (WIP)
  • Improve Runner.GtkApp
    • Add new problems/classic samples
      • Checkers
      • Time series
  • Create the wiki
  • Add new selections
    • Reward-based
  • Add new crossovers
    • Order-based (OX2)
    • Position-based (POS)
    • 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.

Change Log

0.5.0 First version.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 92.7%
  • Smalltalk 7.3%