Documentation ¶
Index ¶
- type Algorithm
- type Array
- type Chromosome
- type ChromosomeFactory
- type CountingTermination
- type Crossover
- type DynamicMutation
- type IndexMutation
- type LocalOptimization
- type LockedRand
- type LookAheadMutation
- type MultiTermination
- type Mutation
- type NoImprovementTermination
- type OnePointCrossover
- type ParentSelector
- type ParentSurvivorSelection
- type PassThruDynamicMutation
- type Population
- func (p *Population) Average() float64
- func (p *Population) Max() Chromosome
- func (p *Population) Min() Chromosome
- func (p *Population) NextGen(ps ParentSelector, b Crossover, m Mutation, numP int, numGoroutine int, ...) Population
- func (p *Population) NextGeneration(ps ParentSelector, b Crossover, m Mutation, numP int, numGoroutine int, ...) Population
- func (p *Population) Sort()
- type Rand
- type RandForIndex
- type Simplifyable
- type SurvivorSelection
- type SwapMutator
- type Termination
- type TimingTermination
- type TournamentParentSelector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Algorithm ¶
type Algorithm struct { Log *log.Logger RandForIndex RandForIndex ParentSelector ParentSelector Factory ChromosomeFactory Terminator Termination Crossover Crossover SurvivorSelection SurvivorSelection Mutator Mutation NumberOfParents int PopulationSize int NumGoroutine int }
func (*Algorithm) Run ¶
func (a *Algorithm) Run() Chromosome
type Chromosome ¶
type Chromosome interface { Fitness() int Clone() Chromosome Shell() Chromosome String() string }
type ChromosomeFactory ¶
type ChromosomeFactory interface { Spawn(G Rand) Chromosome Family() string }
type CountingTermination ¶
type CountingTermination struct { Limit int // contains filtered or unexported fields }
func (*CountingTermination) StopExecution ¶
func (c *CountingTermination) StopExecution(p Population, _ Rand) bool
func (*CountingTermination) String ¶
func (c *CountingTermination) String() string
type Crossover ¶
type Crossover interface { Reproduce(in []Chromosome, r Rand) Chromosome String() string }
type DynamicMutation ¶
type IndexMutation ¶
type IndexMutation struct { }
func (*IndexMutation) Mutate ¶
func (i *IndexMutation) Mutate(in Chromosome, r Rand) Chromosome
func (*IndexMutation) String ¶
func (i *IndexMutation) String() string
type LocalOptimization ¶
type LocalOptimization interface {
LocallyOptimize() Chromosome
}
type LockedRand ¶
type LockedRand struct { G Rand // contains filtered or unexported fields }
func (*LockedRand) Int ¶
func (l *LockedRand) Int() int
func (*LockedRand) Int63 ¶
func (l *LockedRand) Int63() int64
func (*LockedRand) Intn ¶
func (l *LockedRand) Intn(n int) int
type LookAheadMutation ¶
type LookAheadMutation struct { }
func (*LookAheadMutation) Mutate ¶
func (a *LookAheadMutation) Mutate(in Chromosome, r Rand) Chromosome
func (*LookAheadMutation) String ¶
func (a *LookAheadMutation) String() string
type MultiTermination ¶
type MultiTermination struct {
Executors []Termination
}
func (*MultiTermination) StopExecution ¶
func (c *MultiTermination) StopExecution(p Population, r Rand) bool
func (*MultiTermination) String ¶
func (c *MultiTermination) String() string
type Mutation ¶
type Mutation interface { Mutate(in Chromosome, r Rand) Chromosome String() string }
type NoImprovementTermination ¶
type NoImprovementTermination struct { Consecutive int // contains filtered or unexported fields }
func (*NoImprovementTermination) StopExecution ¶
func (c *NoImprovementTermination) StopExecution(p Population, _ Rand) bool
func (*NoImprovementTermination) String ¶
func (c *NoImprovementTermination) String() string
type OnePointCrossover ¶
type OnePointCrossover struct { }
func (*OnePointCrossover) Reproduce ¶
func (s *OnePointCrossover) Reproduce(in []Chromosome, r Rand) Chromosome
func (*OnePointCrossover) String ¶
func (s *OnePointCrossover) String() string
type ParentSelector ¶
type ParentSelector interface { PickParent([]Chromosome, Rand) int String() string }
type ParentSurvivorSelection ¶
type ParentSurvivorSelection struct {
ParentSelector ParentSelector
}
func (*ParentSurvivorSelection) NextGeneration ¶
func (p *ParentSurvivorSelection) NextGeneration(previous *Population, candidate *Population, r Rand) Population
func (*ParentSurvivorSelection) String ¶
func (p *ParentSurvivorSelection) String() string
type PassThruDynamicMutation ¶
type PassThruDynamicMutation struct { PassTo Mutation MutationRatio int // contains filtered or unexported fields }
func (*PassThruDynamicMutation) IncreaseMutationRate ¶
func (p *PassThruDynamicMutation) IncreaseMutationRate(r Rand)
func (*PassThruDynamicMutation) Mutate ¶
func (p *PassThruDynamicMutation) Mutate(in Chromosome, r Rand) Chromosome
func (*PassThruDynamicMutation) ResetMutationRate ¶
func (p *PassThruDynamicMutation) ResetMutationRate(r Rand)
func (*PassThruDynamicMutation) String ¶
func (p *PassThruDynamicMutation) String() string
type Population ¶
type Population struct { Individuals []Chromosome // contains filtered or unexported fields }
func SpawnPopulation ¶
func SpawnPopulation(n int, f ChromosomeFactory, r Rand) Population
func (*Population) Average ¶
func (p *Population) Average() float64
func (*Population) Max ¶
func (p *Population) Max() Chromosome
func (*Population) Min ¶
func (p *Population) Min() Chromosome
func (*Population) NextGen ¶
func (p *Population) NextGen(ps ParentSelector, b Crossover, m Mutation, numP int, numGoroutine int, rnd RandForIndex) Population
START PLAY2OMIT
func (*Population) NextGeneration ¶
func (p *Population) NextGeneration(ps ParentSelector, b Crossover, m Mutation, numP int, numGoroutine int, rnd RandForIndex) Population
func (*Population) Sort ¶
func (p *Population) Sort()
type RandForIndex ¶
func ArrayRandForIdx ¶
func ArrayRandForIdx(size int, seed int64, generator func(seed int64) Rand) RandForIndex
type Simplifyable ¶
type Simplifyable interface {
Simplify()
}
type SurvivorSelection ¶
type SurvivorSelection interface { NextGeneration(previous *Population, candidate *Population, r Rand) Population String() string }
type SwapMutator ¶
type SwapMutator struct { }
func (*SwapMutator) Mutate ¶
func (a *SwapMutator) Mutate(in Chromosome, r Rand) Chromosome
func (*SwapMutator) String ¶
func (a *SwapMutator) String() string
type Termination ¶
type Termination interface { StopExecution(p Population, r Rand) bool String() string }
type TimingTermination ¶
type TimingTermination struct { Duration time.Duration Now func() time.Time // contains filtered or unexported fields }
func (*TimingTermination) StopExecution ¶
func (c *TimingTermination) StopExecution(p Population, _ Rand) bool
func (*TimingTermination) String ¶
func (c *TimingTermination) String() string
type TournamentParentSelector ¶
type TournamentParentSelector struct {
K int
}
func (TournamentParentSelector) PickParent ¶
func (s TournamentParentSelector) PickParent(c []Chromosome, r Rand) int
func (TournamentParentSelector) String ¶
func (s TournamentParentSelector) String() string
Click to show internal directories.
Click to hide internal directories.