genetic_evolution 0.1.2 copy "genetic_evolution: ^0.1.2" to clipboard
genetic_evolution: ^0.1.2 copied to clipboard

A package that simulates a Genetic Evolutionary Algorithm among its generations.

genetic_evolution #

A package that simulates a Genetic Evolutionary Algorithm among its generations.

Installation #

Add genetic_evolution as a dependency in your pubspec.yaml file.

dependencies:
  genetic_evolution: ^0.1.0

Import Genetic Evolution:

import 'package:genetic_evolution/genetic_evolution.dart';

Basic Usage #

First, you must define your own GeneService, describing the Genes within a DNA strand. Notice that we are defining a Gene to be of type <String>.

class MyGeneService extends GeneService<String> {
...
}

Then, you must define your own FitnessService, describing how well an Entity's DNA performs.

class MyFitnessService extends FitnessService<String> {
    ...
}

Next, you can initialize a GeneticEvolution object.

GeneticEvolution geneticEvolution = GeneticEvolution(
      geneticEvolutionConfig: GeneticEvolutionConfig(
        numGenes: 10,
        mutationRate: 0.25
      ),
      fitnessService: MyFitnessService(),
      geneService: MyGeneService(),
    );

And finally, you can get the next generation using nextGeneration().

Generation generation = await geneticEvolution.nextGeneration();

Simple Word Example #

The code for this Word example can be found in the /example/word_example folder (here).

Intermediate Color Contrast Example #

The code for this Color Contrast example can be found in the /example/color_contrast_example folder (here).

color_contrast_genetic_evolution_video

1
likes
0
pub points
0%
popularity

Publisher

verified publisherimpiam.com

A package that simulates a Genetic Evolutionary Algorithm among its generations.

Repository (GitHub)
View/report issues

Topics

#evolution #genetic #algorithm

License

unknown (license)

Dependencies

equatable, flutter

More

Packages that depend on genetic_evolution