algorithm

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package algorithm implements optimization algorithms to triangulate an image

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModifiedGenetic

func NewModifiedGenetic(newPointGroup func() normgeom.NormPointGroup, size int, cutoff int,
	newEvaluators func(n int) evaluator.Evaluator, mutator mutation.Method) *modifiedGenetic

NewModifiedGenetic returns a new modifiedGenetic algorithm.

func NewSimple

func NewSimple(newPointGroup func() normgeom.NormPointGroup, size int, cutoff int,
	newEvaluators func(n int) evaluator.Evaluator, mutator mutation.Method) *simple

NewSimple returns a new Simple algorithm.

Types

type Algorithm

type Algorithm interface {
	// Step runs one generation of the algorithm.
	Step()

	// Best returns the point group with the highest fitness.
	Best() normgeom.NormPointGroup

	// Stats returns statistics relating to the algorithm.
	Stats() Stats
}

An Algorithm is an iterative algorithm for optimizing a group of points.

type FitnessData

type FitnessData struct {
	Fitness float64
	I       int // The index of the point group in an Algorithm.
}

FitnessData stores the fitness of a point group.

type MutationsData

type MutationsData struct {
	Mutations []mutation.Mutation
	Indexes   []int // The index of the member where the mutation came from. Indexes[i] has the mutation Mutations[i].
}

MutationsData stores a set of mutations and the index of the member which each mutation came from.

func (*MutationsData) Clear

func (m *MutationsData) Clear()

Clear clears all data from the struct.

func (MutationsData) Count

func (m MutationsData) Count() int

Count returns the number of mutations stored.

type Stats

type Stats struct {
	BestFitness float64
	Generation  int
	TimeForGen  time.Duration // The time taken for the last generation.
}

Stats contains the basic statistics of an Algorithm.

Directories

Path Synopsis
Package evaluator provides an interface for a fitness evaluator and some implementations for common use cases.
Package evaluator provides an interface for a fitness evaluator and some implementations for common use cases.

Jump to

Keyboard shortcuts

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