GeneticAlgorithm<T> class

Constructors

GeneticAlgorithm({required List<T> initPopulation(), required double fitness(T), required T crossover(T, T, Random), required T mutate(T, Random), int populationSize = 100, double mutationRate = 0.01, int elitism = 1, int? seed})

Properties

crossover → T Function(T, T, Random)
final
elitism → int
final
fitness → double Function(T)
final
hashCode → int
The hash code for this object.
no setterinherited
initPopulation → List<T> Function()
final
mutate → T Function(T, Random)
final
mutationRate → double
final
populationSize → int
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run({int generations = 100, int tournamentK = 3}) → Map<String, dynamic>
Run GA for generations. Returns a map with best and fitness.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited