17 lines
468 B
Go
17 lines
468 B
Go
|
package gago
|
||
|
|
||
|
import "math/rand"
|
||
|
|
||
|
// A Genome is an object that can have any number and kinds of properties. As
|
||
|
// long as it can be evaluated, mutated and crossedover then it can evolved.
|
||
|
type Genome interface {
|
||
|
Evaluate() float64
|
||
|
Mutate(rng *rand.Rand)
|
||
|
Crossover(genome Genome, rng *rand.Rand) (Genome, Genome)
|
||
|
Clone() Genome
|
||
|
}
|
||
|
|
||
|
// A GenomeFactory is a method that generates a new Genome with random
|
||
|
// properties.
|
||
|
type GenomeFactory func(rng *rand.Rand) Genome
|