Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeHandler ¶ added in v0.1.0
type Config ¶
type Config interface {
Generations() int
PopulationSize() int
CrossoverRate() float64
MutationRate() float64
InitMethod() int
}
Config 配置
type GA ¶
type GA interface {
Config() Config
Initializer() Initializer
Calculator() Calculator
}
type Individual ¶
type Individual interface {
Chromosomes() []Chromosome
Chromosome(int) Chromosome
Fitness() float64
SetFitness(float64)
NewInstance([]Chromosome) Individual
Print()
Change() error
}
Individual 个体
type Initializer ¶
type Initializer interface {
Init(int) Pn
GetIns() Individual
}
Initializer 种群初始化
type Pn ¶ added in v0.1.0
type Pn []Individual
type Population ¶
type Population struct {
// contains filtered or unexported fields
}
func NewPopulation ¶
func NewPopulation(ga GA) *Population
func (*Population) Evolve ¶ added in v0.1.0
func (pn *Population) Evolve() error
func (*Population) Individuals ¶ added in v0.1.0
func (pn *Population) Individuals() Pn
func (*Population) Initialize ¶
func (pn *Population) Initialize()
Click to show internal directories.
Click to hide internal directories.