cross

package
v0.0.0-...-b9e61c6 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LinearFloatRange

func LinearFloatRange(a, b floatrange.Range) floatrange.Range

LinearFloatRange combines two floatranges into a linear range from the average of the minimum and maximum values of the inputs

func LinearIntRange

func LinearIntRange(a, b intrange.Range) intrange.Range

LinearIntRange combines two intranges into a linear range from the average of the minimum and maximum values of the inputs.

func PointCrossover

func PointCrossover(a []interface{}, b []interface{}, numPoints int) []interface{}

PointCrossover will convert two slices of interfaces into a new slice composed of elements from each slice. This composition will contain long strings of components from each input slice, at the same indices they were at in the original. The number of uninterrupted strings of elements from one slice is noted by numPoints + 1, where numPoints is the number of points the slices are split at.

func RandomPoints

func RandomPoints(numPoints int) []float64

RandomPoints returns a slice of numPoints float64s, randomly distributed from 0.0 to 1.0, but limited so that each point falls somewhere in the 1st, 2nd, etc. portion of the slice as it would be split in to as many parts as there are points.

e.g. 2 points out[0] will be between 0.0 and 0.5 out[1] will be between 0.5 and 1.0wdwdwwwwwwwww

Types

type F

type F interface {
	Crossover(a, b *env.F) *env.F
}

type FAverageCrossover

type FAverageCrossover struct {
	AWeight float64
}

func (FAverageCrossover) Crossover

func (fac FAverageCrossover) Crossover(a, b *env.F) *env.F

type FPoint

type FPoint struct {
	NumPoints int
}

func (FPoint) Crossover

func (fpc FPoint) Crossover(a, b *env.F) *env.F

type FloatRange

type FloatRange func(a, b floatrange.Range) floatrange.Range

FloatRange represents any function which can crossover floatrange.Range types

type I

type I interface {
	Crossover(*env.I, *env.I) *env.I
}

type IPoint

type IPoint struct {
	NumPoints int
}

func (IPoint) Crossover

func (ipc IPoint) Crossover(a *env.I, b *env.I) *env.I

type IntRange

type IntRange func(a, b intrange.Range) intrange.Range

IntRange represents any function which can crossover intrange.Range types

Jump to

Keyboard shortcuts

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