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
###Chromosomes Add your own chromosome representation implementing IChromosome interface or extending ChromosomeBase
###Fitness Add your own fitness evaluation, implementing IFitness interface.
###Populations
###Selections
- Elite (also know as Truncate or Truncation)
- Roulette Wheel
- Stochastic Universal Sampling
- Tournament
- Others selections can be added implementing ISelection interface or extending SelectionBase.
###Crossovers
- Cut and Splice
- Cycle (CX)
- One-Point (C1)
- Order-based (OX2)
- Ordered (OX1)
- Partially Mapped (PMX)
- Position-based (POS)
- Three parent
- Two-Point (C2)
- Uniform
- Others crossovers can be added implementing ICrossover interface or extending CrossoverBase.
###Mutations
- Reverse Sequence (RSM)
- Twors
- Uniform
- Others mutations can be added implementing IMutation interface or extending MutationBase.
###Reinsertions
- Elitist
- Fitness Based
- Pure
- Uniform
- Others reinsertions can be added implementing IReinsertion interface or extending ReinsertionBase.
###Terminations
- Generation number
- Time evolving
- Fitness stagnation
- Fitness threshold
- And e Or (allows combine others terminations)
- Others terminations can be added implementing ITermination interface or extending TerminationBase.
- Basic randomization (using System.Random)
- Fast random
- If you need a special kind of randomization for your GA, just implement the IRandomization interface.
###Runner app (console) with samples
AutoConfig
Bitmap equality
Equality equation
Equation solver
Function builder
Ghostwriter
TSP (Travelling toman Problem)
###Runner app (GTK#) with visual samples:
####TSP (Travelling Salesman Problem).

###Multi-platform
###Code quality
- 100% unit test code coverage.
- FxCop validated.
- Code duplicated verification.
- Good (and well used) design patterns.
- 100% code documentation.
PM> Install-Package GeneticSharp
publicclassMyProblemFitness:IFitness{publicdoubleEvaluate(IChromosomechromosome){// Evaluate the fitness of chromosome.}}publicclassMyProblemChromosome:ChromosomeBase{// Change the argument value passed to base construtor to change the length // of your chromosome.publicMyProblemChromosome():base(10){CreateGenes();}publicoverrideGeneGenerateGene(intgeneIndex){// Generate a gene base on my problem chromosome representation.}publicoverrideIChromosomeCreateNew(){returnnewMyProblemChromosome();}}varselection=newEliteSelection();varcrossover=newOrderedCrossover();varmutation=newReverseSequenceMutation();varfitness=newMyProblemFitness();varchromosome=newMyProblemChromosome();varpopulation=newPopulation(50,70,chromosome);varga=newGeneticAlgorithm(population,fitness,selection,crossover,mutation);ga.Termination=newGenerationNumberTermination(100);Console.WriteLine("GA running...");ga.Start();Console.WriteLine("Best solution found has {0} fitness.",ga.BestChromosome.Fitness);- Unity3d game sample (WIP)
- Improve Runner.GtkApp
- Add new problems/classic samples
- Checkers
- Time series
- Knapsack problem
- Add new problems/classic samples
- 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)
Having troubles?
- Read our wiki.
- Ask on Twitter @ogiacomelli.
- Ask on Stack Overflow using the tag GeneticSharp.
Create a fork of GeneticSharp.
Did you change it? Submit a pull request.
bitcoin:3GDWZCzu389UT2vwGHTML1gYxpS4pzKhVZ
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.
- 1.0.100 Added Order-based (OX2) and Position-based (POS) crossovers.
- 1.0.56 NuGet package published.
- 0.5.0 First version.




