evolution

package
v1.23.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandType

type CommandType int

CommandType defines the type of evolution command

const (
	CmdStartGeneration CommandType = iota
	CmdStop
)

type EvolutionCommand

type EvolutionCommand struct {
	Type            CommandType
	Generation      int
	CrossoverPoints int
	CrossoverRate   float64
	MutationRate    float64
	ElitismPct      float64
}

EvolutionCommand represents commands sent to the evolution engine

type EvolutionEngine

type EvolutionEngine struct {
	// contains filtered or unexported fields
}

EvolutionEngine manages the evolution process using channels

func NewEvolutionEngine

func NewEvolutionEngine(
	population population.Population,
	selector selection.Selector,
	metricsChan chan<- metrics.GenerationMetrics,
	cmdChan <-chan EvolutionCommand,
	fitnessCalculator fitness.FitnessCalculator,
	crossoverInformation individual.CrossoverInformation,
	mutateInformation individual.MutateInformation,
	logger *zap.Logger,
) *EvolutionEngine

NewEvolutionEngine creates a new evolution engine

func (*EvolutionEngine) GetPopulation

func (ee *EvolutionEngine) GetPopulation() []individual.Evolvable

GetPopulation returns the current population

func (*EvolutionEngine) Start

func (ee *EvolutionEngine) Start(ctx context.Context)

Start begins processing evolution commands

func (*EvolutionEngine) Wait

func (ee *EvolutionEngine) Wait()

Wait blocks until the engine is done

Jump to

Keyboard shortcuts

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