Documentation ¶
Overview ¶
The maze solving experiments based on NEAT methodology with Novelty Search and Fitness based optimization
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { // The current location Location Point // The heading direction in degrees Heading float64 // The speed of agent Speed float64 // The angular velocity AngularVelocity float64 // The radius of agent body Radius float64 // The maximal range of range finder sensors RangeFinderRange float64 // The angles of range finder sensors RangeFinderAngles []float64 // The beginning angles for radar sensors RadarAngles1 []float64 // The ending angles for radar sensors RadarAngles2 []float64 // stores radar outputs Radar []float64 // stores rangefinder outputs RangeFinders []float64 }
The class for the maze navigator agent
type AgentRecord ¶
type AgentRecord struct { // The ID of agent AgentID int // The agent position at the end of simulation X, Y float64 // The agent fitness Fitness float64 // The flag to indicate whether agent reached maze exit GotExit bool // The population generation when agent data was collected Generation int // The novelty value associated Novelty float64 // The ID of species to whom individual belongs SpeciesID int // The age of species to whom individual belongs at time of recording SpeciesAge int }
The record holding info about individual maze agent performance at the end of simulation
type Environment ¶
type Environment struct { // The maze navigating agent Hero Agent // The maze line segments Lines []Line // The maze exit - goal MazeExit Point // The flag to indicate if exit was found ExitFound bool // The number of time steps to be executed during maze solving simulation TimeSteps int // The sample step size to determine when to collect subsequent samples during simulation SampleSize int // The range around maze exit point to test if agent coordinates is within to be considered as solved successfully (5.0 is good enough) ExitFoundRange float64 // contains filtered or unexported fields }
The maze environment class
func ReadEnvironment ¶
func ReadEnvironment(ir io.Reader) (*Environment, error)
Reads maze environment from reader
func (*Environment) AgentDistanceToExit ¶
func (e *Environment) AgentDistanceToExit() float64
used for fitness calculations based on distance of maze Agent to the target maze exit
func (*Environment) ApplyOutputs ¶
func (e *Environment) ApplyOutputs(o1, o2 float64) error
transform neural net outputs into angular velocity and speed
func (*Environment) GetInputs ¶
func (e *Environment) GetInputs() ([]float64, error)
create neural net inputs from maze agent sensors
func (*Environment) Update ¶
func (e *Environment) Update() error
Do one time step of the simulation
type Line ¶
type Line struct {
A, B Point
}
The simple line segment class, used for maze walls
func (Line) Intersection ¶
Returns point of intersection between two line segments if it exists
type MazeNoveltySearchEvaluator ¶
type MazeNoveltySearchEvaluator struct { // The output path to store execution results OutputPath string // The maze seed environment Environment *Environment // The target number of species to be maintained NumSpeciesTarget int // The species compatibility threshold adjustment frequency CompatAdjustFreq int }
The maze solving experiment with Novelty Search optimization of NEAT algorithm
func (MazeNoveltySearchEvaluator) GenerationEvaluate ¶
func (ev MazeNoveltySearchEvaluator) GenerationEvaluate(pop *genetics.Population, epoch *experiments.Generation, context *neat.NeatContext) (err error)
This method evaluates one epoch for given population and prints results into output directory if any.
func (MazeNoveltySearchEvaluator) TrialRunStarted ¶
func (ev MazeNoveltySearchEvaluator) TrialRunStarted(trial *experiments.Trial)
Invoked before new trial run started
type MazeObjectiveEvaluator ¶
type MazeObjectiveEvaluator struct { // The output path to store execution results OutputPath string // The maze seed environment Environment *Environment // The target number of species to be maintained NumSpeciesTarget int // The species compatibility threshold adjustment frequency CompatAdjustFreq int }
The maze solving experiment with objective fitness-based optimization of NEAT algorithm
func (MazeObjectiveEvaluator) GenerationEvaluate ¶
func (ev MazeObjectiveEvaluator) GenerationEvaluate(pop *genetics.Population, epoch *experiments.Generation, context *neat.NeatContext) (err error)
This method evaluates one epoch for given population and prints results into output directory if any.
func (MazeObjectiveEvaluator) TrialRunStarted ¶
func (ev MazeObjectiveEvaluator) TrialRunStarted(trial *experiments.Trial)
Invoked before new trial run started
type Point ¶
type Point struct {
X, Y float64
}
The simple point class
func (Point) Angle ¶
To determine angle in degrees of vector defined by (0,0)->This Point. The angle is from 0 to 360 degrees anti clockwise.
type RecordStore ¶
type RecordStore struct { // The array of agent records Records []AgentRecord // The array of the solver agent path points SolverPathPoints []Point }
The maze agent records storage