darwin 0.2.0

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). 
var breeder = new MyGenerationBreeder()
  ..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 classes.

Use this package as a library

1. Depend on it

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


dependencies:
  darwin: ^0.2.0

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';
  
Awaiting analysis to complete.

Admin