Documentation
¶
Index ¶
- Variables
- func NextMechanicName() int
- type ActionModCrossover
- type ActionMut
- type ActionType
- type ActionTypeCrossover
- type Base
- func (d *Base) CanCrossover(other pop.Individual) bool
- func (d *Base) Crossover(other pop.Individual) pop.Individual
- func (d *Base) Fitness(input, expected [][]float64) int
- func (d *Base) Mechanic() *Mechanic
- func (d *Base) Mutate()
- func (d *Base) Print()
- func (d *Base) SetFitness(f int)
- func (d *Base) String() string
- type BasicDevMutation
- type Creator
- type Crossover
- type Dev
- type DevMutation
- type LinearCreator
- type LinearDevCrossover
- type MechFitness
- type MechNode
- type Mechanic
- type RenderMechanic
- type SpreadCreator
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BaseActionTypes = []ActionType{ mut.Add, mut.DropOut, mut.Div, mut.LinearRange, mut.Scale, } BaseActionWeights = []float64{ 0.5, 0.3, 0.05, 0.1, 0.1, } BaseActionStrength = []floatrange.Range{ floatrange.NewLinear(-15, 15), floatrange.NewLinear(-30, 30), floatrange.NewLinear(5, 9), floatrange.NewLinear(1, 10), floatrange.NewLinear(-5, 5), } )
Functions ¶
func NextMechanicName ¶
func NextMechanicName() int
Types ¶
type ActionModCrossover ¶
type ActionModCrossover struct {
TypeLengthMod intrange.Range
TypeWeightMod floatrange.Range
TypeWeightDef floatrange.Range
StrengthMod frange.Mutator
}
func (*ActionModCrossover) Crossover ¶
func (amc *ActionModCrossover) Crossover(a, b *Base) ([]ActionType, []float64, []floatrange.Range)
type ActionMut ¶
type ActionMut func(mut.FloatMutator, *float64) func()
type ActionType ¶
type ActionType func(strength float64) mut.FloatMutator
type ActionTypeCrossover ¶
type ActionTypeCrossover interface {
Crossover(a, b *Base) ([]ActionType, []float64, []floatrange.Range)
}
type Base ¶
type Base struct {
InitSize intrange.Range
GoalSize intrange.Range
GoalDistance intrange.Range
EnvSize intrange.Range
EnvVal floatrange.Range
ActionCount intrange.Range
ActionTypes []ActionType
ActionTypeWeights []float64
ActionStrengths []floatrange.Range
// Crossover and Mutation methods set by generators
DevMutation
Cross Crossover
// contains filtered or unexported fields
}
func (*Base) CanCrossover ¶
func (d *Base) CanCrossover(other pop.Individual) bool
func (*Base) Crossover ¶
func (d *Base) Crossover(other pop.Individual) pop.Individual
func (*Base) SetFitness ¶
type BasicDevMutation ¶
type BasicDevMutation struct {
InitSize irange.Mutator
GoalSize irange.Mutator
GoalDistance irange.Mutator
EnvSize irange.Mutator
EnvVal frange.Mutator
ActionCount irange.Mutator
ActionTypeWeights mut.FloatMutator
ActionStrengths frange.Mutator
}
func (BasicDevMutation) Mutate ¶
func (bdv BasicDevMutation) Mutate(d *Base)
type DevMutation ¶
type DevMutation interface {
Mutate(*Base)
}
type LinearCreator ¶
type LinearCreator struct {
InitSizeBottom floatrange.Range
InitSizeTop floatrange.Range
GoalSizeBottom floatrange.Range
GoalSizeTop floatrange.Range
GoalDistanceBottom floatrange.Range
GoalDistanceTop floatrange.Range
EnvSizeBottom floatrange.Range
EnvSizeTop floatrange.Range
EnvValBottom floatrange.Range
EnvValTop floatrange.Range
ActionCountBottom floatrange.Range
ActionCountTop floatrange.Range
ActionTypeCount intrange.Range
ActionTypeChoices []ActionType
ActionTypeWeights floatrange.Range
ActionStrengthBottom floatrange.Range
ActionStrengthTop floatrange.Range
CrossoverOptions []Crossover
MutationOptions []DevMutation
}
func (*LinearCreator) NewDev ¶
func (ldc *LinearCreator) NewDev() Dev
type LinearDevCrossover ¶
type LinearDevCrossover struct {
ActionTypeCrossover
}
func (*LinearDevCrossover) Crossover ¶
func (ldc *LinearDevCrossover) Crossover(a, b *Base) *Base
type MechFitness ¶
type Mechanic ¶
type Mechanic struct {
Actions []func()
//Passives []func()
//Continuous bool
//PassiveTypes []ActionType
//PassiveStrengths []float64
//
Environment *env.F
Init map[int]float64
Goal map[int]float64
MechFitness
}
func (*Mechanic) FitnessAbs ¶
func (*Mechanic) FitnessElems ¶
func (*Mechanic) MechanicDistance ¶
type RenderMechanic ¶
func NewRenderMechanic ¶
func NewRenderMechanic(mch *Mechanic) *RenderMechanic
func (*RenderMechanic) GetR ¶
func (rmch *RenderMechanic) GetR() render.Renderable
func (*RenderMechanic) String ¶
func (rmch *RenderMechanic) String() string
type SpreadCreator ¶
type SpreadCreator struct {
*LinearCreator
}
SpreadDevCreators just use the same fields as Linear but with bottom=base and top=spread
func (*SpreadCreator) NewDev ¶
func (bsdc *SpreadCreator) NewDev() Dev
Click to show internal directories.
Click to hide internal directories.