darwin 0.2.5

darwin

A genetic algorithm library for Dart.

Example use:

// Create first generation, either by random or by continuing with existing
// progress.
var firstGeneration = new Generation<MyPhenotype>()
  ..members.addAll([/*...*/]);

// Evaluators take each phenotype and assign a fitness value to it according
// to some fitness function.
var evaluator = new MyEvaluator();

// Breeders are in charge of creating new generations from previous ones (that
// have been graded by the evaluator). Their only required argument is
// a function that returns a blank phenotype.
var breeder = new GenerationBreeder(() => new MyPhenotype())
  ..crossoverPropability = 0.8;

var algo = new GeneticAlgorithm(firstGeneration, evaluator, breeder);

// Start the algorithm.
algo.runUntilDone()
.then((_) {
  // Print all members of the last generation when done.
  algo.generations.last.members
    .forEach((Phenotype ph) => print("${ph.genesAsString}"));
});

See test/unittest.dart for examples of subclassing Phenotype and Evaluator.

1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  darwin: "^0.2.5"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:darwin/darwin.dart';

About

Genetic algorithm library for Dart.

Author

Filip Hracek

Homepage

github.com/filiph/darwin

Documentation

www.dartdocs.org/documentation/darwin/0.2.5/

Uploader

filip.hracek@gmail.com

License

MIT (LICENSE)

Published

Feb 3, 2016