evaluator

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMany

func NewMany(newEvaluator func() fitness.Function, n int) many

NewMany returns a new "many" fitness evaluator.

func NewOne

func NewOne(evaluator fitness.Function) one

NewOne returns a new "one" fitness evaluator.

func NewParallel

func NewParallel(fitnessFuncs []fitness.CacheFunction, cachePowerOf2 int) *parallel

NewParallel creates a new parallel evaluator.

Types

type Evaluator

type Evaluator interface {
	// Get returns a fitness function given the index of a member.
	Get(i int) fitness.Function

	// Update carries out any updates necessary for a specified member.
	Update(i int)

	// Prepare does any preparations necessary for the evaluator.
	Prepare()

	// SetBase should be called to indicate the base of member i.
	SetBase(i, base int)

	// Swap should be called if members i and j are swapped.
	Swap(i, j int)
}

An Evaluator is used by an algorithm to evaluate the fitness of its members.

Jump to

Keyboard shortcuts

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