sim

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsMulti

func AsMulti(mk func() core.Environment) core.MultiEnvironment

func EvaluateParallel

func EvaluateParallel(newEnv EnvFactory, members []core.Individual, maxSteps int, seed int64) []float64

func GenRNG

func GenRNG(seed int64, gen int) *rand.Rand

func MasterRNG

func MasterRNG(seed int64) *rand.Rand

func MemberRNG

func MemberRNG(seed int64, idx int) *rand.Rand

func Pace

func Pace(steps int, interval time.Duration, step func())

func RunEpisode

func RunEpisode(env core.Environment, agent core.Agent, maxSteps int, rng *rand.Rand) core.Reward

func RunGeneration

func RunGeneration(env core.MultiEnvironment, pop core.PopulationAgent, maxSteps int, seed int64, onStep func()) []float64

func TrackRNG

func TrackRNG(seed int64) *rand.Rand

func TrainAgent

func TrainAgent(env core.Environment, agent core.Agent, episodes, maxSteps int, seed int64) []core.Reward

func TrainHeadless

func TrainHeadless(newEnv EnvFactory, pop core.PopulationAgent, cfg RunConfig, tel *Telemetry)

Types

type EnvFactory

type EnvFactory func() core.MultiEnvironment

type GenStats

type GenStats struct {
	Generation int
	Best       float64
	Avg        float64
	Worst      float64
}

func StatsFrom

func StatsFrom(generation int, fitness []float64) GenStats

type Live

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

func NewLive

func NewLive(env core.MultiEnvironment, pop core.PopulationAgent, maxSteps int, seed int64) *Live

func (*Live) BestIndex

func (l *Live) BestIndex() int

func (*Live) Fitness

func (l *Live) Fitness() []float64

func (*Live) NextGeneration

func (l *Live) NextGeneration()

func (*Live) Regenerate

func (l *Live) Regenerate(seed int64)

func (*Live) Step

func (l *Live) Step() (finished bool)

func (*Live) StepCount

func (l *Live) StepCount() int

type LiveEpisode

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

func NewLiveEpisode

func NewLiveEpisode(env core.Environment, agent core.Agent, maxSteps int, seed int64) *LiveEpisode

func (*LiveEpisode) Env

func (l *LiveEpisode) Env() core.Environment

func (*LiveEpisode) Episode

func (l *LiveEpisode) Episode() int

func (*LiveEpisode) NextEpisode

func (l *LiveEpisode) NextEpisode()

func (*LiveEpisode) Regenerate

func (l *LiveEpisode) Regenerate(seed int64)

func (*LiveEpisode) Return

func (l *LiveEpisode) Return() core.Reward

func (*LiveEpisode) Step

func (l *LiveEpisode) Step() (finished bool)

func (*LiveEpisode) StepCount

func (l *LiveEpisode) StepCount() int

type RunConfig

type RunConfig struct {
	Seed        int64
	MaxSteps    int
	Generations int
}

type Telemetry

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

func NewTelemetry

func NewTelemetry(historyLen int, log *slog.Logger) *Telemetry

func (*Telemetry) BestSeries

func (t *Telemetry) BestSeries() []float64

func (*Telemetry) History

func (t *Telemetry) History() []GenStats

func (*Telemetry) Publish

func (t *Telemetry) Publish(s GenStats)

Jump to

Keyboard shortcuts

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