tsp

package
v0.0.0-...-8e0f694 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CrossoverNearestPow

func CrossoverNearestPow(n float64) genetic.CrossoverFunc

func CrossoverNearestRevert

func CrossoverNearestRevert(pow float64) genetic.CrossoverFunc

func CrossoverRange

func CrossoverRange(p genetic.Population, ai int, bi int) (genetic.Single, genetic.Single)

func CrossoverRing

func CrossoverRing(p genetic.Population, ai int, bi int) (genetic.Single, genetic.Single)

func Main

func Main()

func Random

func Random(m *Map) genetic.RandomFunc

func ScoreDistancePow

func ScoreDistancePow(n float64) genetic.ScoreFunc

func ToImage

func ToImage(p genetic.Population, index int) image.Image

func Variant

func VariantRevertSwap

func VariantRevertSwap(p genetic.Population, tsp genetic.Single) genetic.Single

Types

type Map

type Map []Point

func (Map) Bounds

func (m Map) Bounds() (x0, y0, x1, y1 float64)

type Point

type Point struct {
	X float64
	Y float64
}

func (Point) Distance

func (p Point) Distance(o Point) float64

func (Point) Normalize

func (p Point) Normalize(src0, src1, dst0, dst1 Point) Point

type TSP

type TSP struct {
	Values []int
	Map    *Map
}

func (TSP) Copy

func (q TSP) Copy() genetic.Single

func (TSP) Equal

func (q TSP) Equal(o genetic.Single) bool

func (TSP) FindRings

func (q TSP) FindRings(o TSP) [][]int

func (TSP) IndexOf

func (q TSP) IndexOf(pos int) int

func (TSP) RandomSwap

func (q TSP) RandomSwap()

func (TSP) Revert

func (q TSP) Revert(from, to int)

func (TSP) Value

func (q TSP) Value(i int) Point

Jump to

Keyboard shortcuts

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