cellular

package
v0.0.0-...-3c91b98 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Chunks         = 8
	ChunkSize      = 64
	CASize         = Chunks * ChunkSize
	Alpha          = 0.08
	SpikeFactor    = 2
	SpikeThreshold = .66
	NetworkSize    = 7
)

Variables

View Source
var (
	Notes = [...]uint8{
		60,
		62,
		64,
		65,
		67,
		69,
		71,
	}
	MaxEntropy = math.Log2(float64(len(Notes)))
	MaxMarkov  = 2 * MaxEntropy
)

Functions

func Bench

func Bench()

func Inference

func Inference(name string)

func Learn

func Learn()

func NetFactory

func NetFactory(rnd *rand.Rand) eaopt.Genome

Types

type CA

type CA struct {
	Rule                   uint8
	State                  []uint64
	Connections            []int
	On                     uint64
	Low, Complexity, Spike float64
	Threshold              float64
	Note                   uint8
}

CA is a cellular automaton

func NewCA

func NewCA(rule uint8, size int, threshold float64, rnd *rand.Rand) CA

NewCA creates a new cellular automaton

func (*CA) AddConnection

func (ca *CA) AddConnection(n int)

AddConnection adds a connection to another cellular automaton

func (*CA) Step

func (ca *CA) Step(next []uint64) []uint64

Step generates the next step of the cellular automaton

func (*CA) String

func (ca *CA) String() string

String converts the cellular automaton to a string

func (*CA) Test

func (ca *CA) Test() bool

Test checks if the cellular automaton is firing

type Net

type Net struct {
	Connections slices.Bool
	Thresholds  slices.Float64
}

func (*Net) Clone

func (n *Net) Clone() eaopt.Genome

func (*Net) Crossover

func (n *Net) Crossover(r eaopt.Genome, rng *rand.Rand)

func (*Net) Evaluate

func (n *Net) Evaluate() (float64, error)

func (*Net) Mutate

func (n *Net) Mutate(rng *rand.Rand)

type Network

type Network struct {
	Neurons []CA
	Rnd     *rand.Rand
	Next    []uint64
}

Network is a network of cellular automatons

func NewNetwork

func NewNetwork(seed, size int) Network

NewNetwork creates a new network of cellular automatons

func (*Network) Step

func (network *Network) Step()

Step steps all of the cellular automatons in the network

func (*Network) Swap

func (network *Network) Swap(m, n int)

Swap sends a message between two cellular automatons

Jump to

Keyboard shortcuts

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