class Chromosome(T)

Overview

Each chromosome represents a solution for the algorithm. You should subclass this.

Defined in:

chromosome.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(dna : T) #

[View source]

Class Method Detail

def self.random #

Create a random new chromosome. Should be overridden.


[View source]

Instance Method Detail

def breed(other_chromosome : Chromosome(T)) #

[View source]
def crossover_strategy #

[View source]
def dna #

[View source]
def fitness : Int32 #

Fitness function. Must be overridden.


[View source]
def fitness_calculation #

[View source]
def inspect_dna : String #

Represent dna as string, mostly for development, testing and visualization.


[View source]
def mutate! : Nil #

Override


[View source]
def solution? : Bool #

This should return whether or not the chromosome represents a complete solution. Override if criterea for good enough solution can be determined.


[View source]