condition

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ElapsedTime

type ElapsedTime time.Duration

ElapsedTime is satisfied when a time duration has elapsed.

func (ElapsedTime) IsSatisfied

func (dur ElapsedTime) IsSatisfied(stats *evolve.PopulationStats) bool

IsSatisfied returns true if the time duration has elapsed.

func (ElapsedTime) String

func (dur ElapsedTime) String() string

String returns a string representation of this condition.

type GenerationCount

type GenerationCount int

GenerationCount is a condtion that is met when a number of generation has passed.

func (GenerationCount) IsSatisfied

func (n GenerationCount) IsSatisfied(stats *evolve.PopulationStats) bool

IsSatisfied reports whether or not evolution should finish at the current point.

func (GenerationCount) String

func (n GenerationCount) String() string

String returns a string representation of this condition.

type TargetFitness

type TargetFitness struct {
	Fitness float64
	Natural bool
}

TargetFitness is a condition that is met when at least one candidate in the population has reached or exceeded a given fitness score.

func (TargetFitness) IsSatisfied

func (tf TargetFitness) IsSatisfied(stats *evolve.PopulationStats) bool

IsSatisfied returns true if the specified fitness score has been reached or exceeded.

func (TargetFitness) String

func (tf TargetFitness) String() string

String returns a string representation of this condition.

type UserAbort

type UserAbort struct {
	// contains filtered or unexported fields
}

UserAbort is a condition satisfied when Abort has been called. It allows for user-initiated termination of an evolution algorithm.

func NewUserAbort

func NewUserAbort() *UserAbort

NewUserAbort creates a UserAbort condition.

func (*UserAbort) Abort

func (ua *UserAbort) Abort()

Abort triggers the condition. It is safe for concurrent use by multiple goroutines.

func (*UserAbort) IsSatisfied

func (ua *UserAbort) IsSatisfied(*evolve.PopulationStats) bool

IsSatisfied reports whether or not Abort has been called. It is safe for concurrent use by multiple goroutines.

func (*UserAbort) Reset

func (ua *UserAbort) Reset()

Reset resets the abort condition to false so that it may be reused. It is safe for concurrent use by multiple goroutines.

func (UserAbort) String

func (UserAbort) String() string

String returns a string representation of this condition.

Jump to

Keyboard shortcuts

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