Versions in this module Expand all Collapse all v0 v0.4.1 Oct 17, 2019 Changes in this version + type Agent struct + DE *DiffEvo + func (a *Agent) Crossover(q Genome, rng *rand.Rand) + func (a *Agent) Mutate(rng *rand.Rand) + func (a Agent) Clone() Genome + func (a Agent) Evaluate() (float64, error) + type DiffEvo struct + CRate float64 + DWeight float64 + F func(x []float64) float64 + GA *GA + Max float64 + Min float64 + NDims uint + func NewDefaultDiffEvo() (*DiffEvo, error) + func NewDiffEvo(nAgents, nSteps uint, min, max, cRate, dWeight float64, parallel bool, ...) (*DiffEvo, error) + func (de *DiffEvo) Minimize(f func([]float64) float64, nDims uint) ([]float64, float64, error) type GA + HallOfFame Individuals + func (ga *GA) Minimize(newGenome func(rng *rand.Rand) Genome) error + type GAConfig struct + Callback func(ga *GA) + EarlyStop func(ga *GA) bool + HofSize uint + Logger *log.Logger + MigFrequency uint + Migrator Migrator + Model Model + NGenerations uint + NPops uint + ParallelEval bool + PopSize uint + RNG *rand.Rand + Speciator Speciator + func NewDefaultGAConfig() GAConfig + func (conf GAConfig) NewGA() (*GA, error) type Individual + func (indi Individual) String() string type Individuals + func (indis Individuals) String() string type ModDownToSize + CrossRate float64 type ModGenerational + CrossRate float64 type ModSteadyState + CrossRate float64 + type OES struct + F func([]float64) float64 + GA *GA + LearningRate float64 + Mu []float64 + Sigma float64 + func NewDefaultOES() (*OES, error) + func NewOES(nPoints, nSteps uint, sigma, lr float64, parallel bool, rng *rand.Rand) (*OES, error) + func (oes *OES) Minimize(f func([]float64) float64, x []float64) ([]float64, float64, error) + type Particle struct + BestX []float64 + BestY float64 + CurrentX []float64 + CurrentY float64 + SPSO *SPSO + Velocity []float64 + func (p *Particle) Crossover(q Genome, rng *rand.Rand) + func (p *Particle) Evaluate() (float64, error) + func (p *Particle) Mutate(rng *rand.Rand) + func (p Particle) Clone() Genome type Population + RNG *rand.Rand type Populations + func (pops Populations) Apply(f func(pop *Population) error) error + type SPSO struct + BestX []float64 + BestY float64 + F func([]float64) float64 + GA *GA + Max float64 + Min float64 + NDims uint + W float64 + func NewDefaultSPSO() (*SPSO, error) + func NewSPSO(nParticles, nSteps uint, min, max, w float64, parallel bool, rng *rand.Rand) (*SPSO, error) + func (pso *SPSO) Minimize(f func([]float64) float64, nDims uint) ([]float64, float64, error) v0.1.0 Jul 27, 2017 Changes in this version + func CrossCX(p1, p2 Slice) (Slice, Slice) + func CrossCXFloat64(s1 []float64, s2 []float64) ([]float64, []float64) + func CrossCXInt(s1 []int, s2 []int) ([]int, []int) + func CrossCXString(s1 []string, s2 []string) ([]string, []string) + func CrossERX(p1, p2 Slice) (Slice, Slice) + func CrossERXFloat64(s1 []float64, s2 []float64) ([]float64, []float64) + func CrossERXInt(s1 []int, s2 []int) ([]int, []int) + func CrossERXString(s1 []string, s2 []string) ([]string, []string) + func CrossGNX(p1 Slice, p2 Slice, n int, rng *rand.Rand) (o1 Slice, o2 Slice) + func CrossGNXFloat64(s1 []float64, s2 []float64, n int, rng *rand.Rand) ([]float64, []float64) + func CrossGNXInt(s1 []int, s2 []int, n int, rng *rand.Rand) ([]int, []int) + func CrossGNXString(s1 []string, s2 []string, n int, rng *rand.Rand) ([]string, []string) + func CrossOX(p1 Slice, p2 Slice, rng *rand.Rand) (o1 Slice, o2 Slice) + func CrossOXFloat64(s1 []float64, s2 []float64, rng *rand.Rand) ([]float64, []float64) + func CrossOXInt(s1 []int, s2 []int, rng *rand.Rand) ([]int, []int) + func CrossOXString(s1 []string, s2 []string, rng *rand.Rand) ([]string, []string) + func CrossPMX(p1 Slice, p2 Slice, rng *rand.Rand) (o1 Slice, o2 Slice) + func CrossPMXFloat64(s1 []float64, s2 []float64, rng *rand.Rand) ([]float64, []float64) + func CrossPMXInt(s1 []int, s2 []int, rng *rand.Rand) ([]int, []int) + func CrossPMXString(s1 []string, s2 []string, rng *rand.Rand) ([]string, []string) + func CrossUniformFloat64(p1 []float64, p2 []float64, rng *rand.Rand) (o1 []float64, o2 []float64) + func InitJaggFloat64(n int, lower, upper []float64, rng *rand.Rand) (floats []float64) + func InitNormFloat64(n int, mean, std float64, rng *rand.Rand) (floats []float64) + func InitUnifFloat64(n int, lower, upper float64, rng *rand.Rand) (floats []float64) + func InitUnifString(n int, corpus []string, rng *rand.Rand) (strings []string) + func InitUniqueString(n int, corpus []string, rng *rand.Rand) (strings []string) + func MutNormalFloat64(genome []float64, rate float64, rng *rand.Rand) + func MutPermute(genome Slice, n int, rng *rand.Rand) + func MutPermuteFloat64(s []float64, n int, rng *rand.Rand) + func MutPermuteInt(s []int, n int, rng *rand.Rand) + func MutPermuteString(s []string, n int, rng *rand.Rand) + func MutSplice(genome Slice, rng *rand.Rand) + func MutSpliceFloat64(s []float64, rng *rand.Rand) + func MutSpliceInt(s []int, rng *rand.Rand) + func MutSpliceString(s []string, rng *rand.Rand) + func MutUniformString(genome []string, corpus []string, n int, rng *rand.Rand) + type DistanceMemoizer struct + Distances map[string]map[string]float64 + Metric Metric + func (dm *DistanceMemoizer) GetDistance(a, b Individual) float64 + type Float64Slice []float64 + func (s Float64Slice) Append(t Slice) Slice + func (s Float64Slice) At(i int) interface{} + func (s Float64Slice) Copy() Slice + func (s Float64Slice) Len() int + func (s Float64Slice) Replace(t Slice) + func (s Float64Slice) Set(i int, v interface{}) + func (s Float64Slice) Slice(a, b int) Slice + func (s Float64Slice) Split(k int) (Slice, Slice) + func (s Float64Slice) Swap(i, j int) + type GA struct + Age time.Duration + Best Individual + Callback func(ga *GA) + Generations int + GenomeFactory GenomeFactory + Logger *log.Logger + MigFrequency int + Migrator Migrator + Model Model + NPops int + PopSize int + Populations Populations + Speciator Speciator + func Generational(GenomeFactory GenomeFactory) GA + func HillClimbing(GenomeFactory GenomeFactory) GA + func SimulatedAnnealing(GenomeFactory GenomeFactory) GA + func (ga *GA) Enhance() error + func (ga *GA) Initialize() + func (ga GA) Validate() error + type Genome interface + Clone func() Genome + Crossover func(genome Genome, rng *rand.Rand) (Genome, Genome) + Evaluate func() float64 + Mutate func(rng *rand.Rand) + type GenomeFactory func(rng *rand.Rand) Genome + type Individual struct + Evaluated bool + Fitness float64 + Genome Genome + ID string + func NewIndividual(genome Genome, rng *rand.Rand) Individual + func (indi *Individual) Evaluate() + func (indi *Individual) GetFitness() float64 + func (indi *Individual) Mutate(rng *rand.Rand) + func (indi Individual) Clone(rng *rand.Rand) Individual + func (indi Individual) Crossover(mate Individual, rng *rand.Rand) (Individual, Individual) + func (indi Individual) IdxOfClosest(indis Individuals, dm DistanceMemoizer) (i int) + type Individuals []Individual + func (indis Individuals) Clone(rng *rand.Rand) Individuals + func (indis Individuals) Evaluate() + func (indis Individuals) FitAvg() float64 + func (indis Individuals) FitMax() float64 + func (indis Individuals) FitMin() float64 + func (indis Individuals) FitStd() float64 + func (indis Individuals) IsSortedByFitness() bool + func (indis Individuals) Mutate(mutRate float64, rng *rand.Rand) + func (indis Individuals) SortByDistanceToMedoid(dm DistanceMemoizer) + func (indis Individuals) SortByFitness() + type IntSlice []int + func (s IntSlice) Append(t Slice) Slice + func (s IntSlice) At(i int) interface{} + func (s IntSlice) Copy() Slice + func (s IntSlice) Len() int + func (s IntSlice) Replace(t Slice) + func (s IntSlice) Set(i int, v interface{}) + func (s IntSlice) Slice(a, b int) Slice + func (s IntSlice) Split(k int) (Slice, Slice) + func (s IntSlice) Swap(i, j int) + type Metric func(a, b Individual) float64 + type MigRing struct + NMigrants int + func (mig MigRing) Apply(pops Populations, rng *rand.Rand) + func (mig MigRing) Validate() error + type Migrator interface + Apply func(pops Populations, rng *rand.Rand) + Validate func() error + type ModDownToSize struct + MutRate float64 + NOffsprings int + SelectorA Selector + SelectorB Selector + func (mod ModDownToSize) Apply(pop *Population) error + func (mod ModDownToSize) Validate() error + type ModGenerational struct + MutRate float64 + Selector Selector + func (mod ModGenerational) Apply(pop *Population) error + func (mod ModGenerational) Validate() error + type ModMutationOnly struct + NChosen int + Selector Selector + Strict bool + func (mod ModMutationOnly) Apply(pop *Population) error + func (mod ModMutationOnly) Validate() error + type ModRing struct + MutRate float64 + Selector Selector + func (mod ModRing) Apply(pop *Population) error + func (mod ModRing) Validate() error + type ModSimAnn struct + Alpha float64 + T float64 + Tmin float64 + func (mod ModSimAnn) Apply(pop *Population) error + func (mod ModSimAnn) Validate() error + type ModSteadyState struct + KeepBest bool + MutRate float64 + Selector Selector + func (mod ModSteadyState) Apply(pop *Population) error + func (mod ModSteadyState) Validate() error + type Model interface + Apply func(pop *Population) error + Validate func() error + type Population struct + Age time.Duration + Generations int + ID string + Individuals Individuals + func (pop Population) Log(logger *log.Logger) + type Populations []Population + type SelElitism struct + func (sel SelElitism) Apply(n int, indis Individuals, rng *rand.Rand) (Individuals, []int, error) + func (sel SelElitism) Validate() error + type SelRoulette struct + func (sel SelRoulette) Apply(n int, indis Individuals, rng *rand.Rand) (Individuals, []int, error) + func (sel SelRoulette) Validate() error + type SelTournament struct + NContestants int + func (sel SelTournament) Apply(n int, indis Individuals, rng *rand.Rand) (Individuals, []int, error) + func (sel SelTournament) Validate() error + type Selector interface + Apply func(n int, indis Individuals, rng *rand.Rand) (selected Individuals, indexes []int, err error) + Validate func() error + type Slice interface + Append func(Slice) Slice + At func(i int) interface{} + Copy func() Slice + Len func() int + Replace func(Slice) + Set func(i int, v interface{}) + Slice func(a, b int) Slice + Split func(k int) (Slice, Slice) + Swap func(i, j int) + type SpecFitnessInterval struct + K int + func (spec SpecFitnessInterval) Apply(indis Individuals, rng *rand.Rand) ([]Individuals, error) + func (spec SpecFitnessInterval) Validate() error + type SpecKMedoids struct + K int + MaxIterations int + Metric Metric + MinPerCluster int + func (spec SpecKMedoids) Apply(indis Individuals, rng *rand.Rand) ([]Individuals, error) + func (spec SpecKMedoids) Validate() error + type Speciator interface + Apply func(indis Individuals, rng *rand.Rand) ([]Individuals, error) + Validate func() error + type StringSlice []string + func (s StringSlice) Append(t Slice) Slice + func (s StringSlice) At(i int) interface{} + func (s StringSlice) Copy() Slice + func (s StringSlice) Len() int + func (s StringSlice) Replace(t Slice) + func (s StringSlice) Set(i int, v interface{}) + func (s StringSlice) Slice(a, b int) Slice + func (s StringSlice) Split(k int) (Slice, Slice) + func (s StringSlice) Swap(i, j int)