genetic

package
v0.0.0-...-8e0f694 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EMPTY_PLUGIN_FUNC = func(p Population) Population { return p }

Functions

func ScoreOrderSelectTop

func ScoreOrderSelectTop(origin, less float64) func(p Population) int

func ScoreRollSelect

func ScoreRollSelect(p Population) int

func ScoreRollSelectTop

func ScoreRollSelectTop(ratio float64) func(p Population) int

Types

type CrossoverFunc

type CrossoverFunc func(Population, int, int) (Single, Single)

type Plugin

type Plugin struct {
	Start PluginFunc
	Each  PluginFunc
	End   PluginFunc
}

type PluginFunc

type PluginFunc func(Population) Population

type Population

type Population struct {
	Gen             int
	Size            int
	Dim             int
	CrossoverFactor float64
	VariantFactor   float64
	MaxGen          int

	RandomFunc    RandomFunc
	CrossoverFunc CrossoverFunc
	VariantFunc   VariantFunc
	ScoreFunc     ScoreFunc
	SelectFunc    SelectFunc
	TargetFunc    TargetFunc
	Plugins       []Plugin

	// all below always sort by score descending
	Value           []Single
	TotalScore      float64
	SingleGeneScore [][]float64
	SingleScore     []float64
}

func (Population) BestScore

func (p Population) BestScore() float64

func (Population) BestSingle

func (p Population) BestSingle() Single

****KPI*****

func (Population) Brother

func (p Population) Brother(value []Single) Population

func (Population) Child

func (p Population) Child(value []Single) Population

func (Population) Len

func (p Population) Len() int

func (Population) Less

func (p Population) Less(i, j int) bool

func (Population) MatchTarget

func (p Population) MatchTarget() bool

func (Population) NeedContinue

func (p Population) NeedContinue() bool

func (Population) NextGen

func (p Population) NextGen() Population

func (Population) Random

func (p Population) Random() Population

func (Population) Run

func (p Population) Run() Population

func (Population) Score

func (p Population) Score() Population

func (Population) Swap

func (p Population) Swap(i, j int)

type RandomFunc

type RandomFunc func(Population) Single

type ScoreFunc

type ScoreFunc func(Population, int) ([]float64, float64)

type SelectFunc

type SelectFunc func(Population) int

type Single

type Single interface {
	Copy() Single
	Equal(Single) bool
}

type TargetFunc

type TargetFunc func(Population) bool

func TargetScore

func TargetScore(s float64) TargetFunc

func TargetStableScore

func TargetStableScore(gen int) TargetFunc

func (TargetFunc) And

func (t TargetFunc) And(o TargetFunc) TargetFunc

func (TargetFunc) Or

type VariantFunc

type VariantFunc func(Population, Single) Single

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL