genome.go 468 B

12345678910111213141516
  1. package gago
  2. import "math/rand"
  3. // A Genome is an object that can have any number and kinds of properties. As
  4. // long as it can be evaluated, mutated and crossedover then it can evolved.
  5. type Genome interface {
  6. Evaluate() float64
  7. Mutate(rng *rand.Rand)
  8. Crossover(genome Genome, rng *rand.Rand) (Genome, Genome)
  9. Clone() Genome
  10. }
  11. // A GenomeFactory is a method that generates a new Genome with random
  12. // properties.
  13. type GenomeFactory func(rng *rand.Rand) Genome