Documentation ¶
Overview ¶
Package brain provides a real-time neural net framework.
A real-time neural network implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptInput ¶
type AcceptInput interface {
AddInputNode(input *Node)
}
AcceptInput defines the interface that creature inputs interact with to stimulate the brain. This is a simple interface that registers the input node.
type Brain ¶
type Brain struct {
// contains filtered or unexported fields
}
* The Brain is composed of inputs, central nodes, outputs and synapses. * They are arranged as such: * * inputNodes : o o o * inSynapses : \/ \/ * centralNodes : o o * outSynapses : /\ /\ * outputs :o o o o * * Charge flows from top to bottom in the diagram. * * Each tick, the input Nodes should be charged appropriately (by the external stimuli), * and then Update() called exactly once.
func NewBrain ¶
Returns a pointer to a new Brain with numCentralNodes central nodes. It will have no inputs, no outputs and no synapses.
func (*Brain) AddInputNode ¶
Adds an input node to the brain. Automatically connects it to all central nodes with synapses.
func (*Brain) AddOutput ¶
func (b *Brain) AddOutput(output ChargedWorker)
Adds an output node to the brain. Automatically connects it to all central nodes with synapses.
func (*Brain) GenesNeeded ¶
Start-of-day function fo querying how much genetic information is required for this brain.
type BrainExternal ¶
type BrainExternal interface { AcceptInput AddOutput(output ChargedWorker) Restore(d *genetics.Dna) GenesNeeded() int Work() }
BrainExternal defines the high-level methods that creatures can use to interact with its' brain.
type ChargeCarrier ¶
type ChargeCarrier struct {
// contains filtered or unexported fields
}
An abstract collection of electrical ChargeCarrier. Used to commonise code between different kinds of brain elements.
func (*ChargeCarrier) Charge ¶
func (c *ChargeCarrier) Charge(strength float64)
ChargeCarrier up this ChargeCarrier by strength ChargeUnits.
func (*ChargeCarrier) Decay ¶
func (c *ChargeCarrier) Decay()
Decreases this ChargeCarrier by chargeDecayRate. Should be called once per time-step.
type Chargeable ¶
type Chargeable interface {
Charge(strength float64)
}
Chargeable defines the family of objects that participate in a neural network. Objects that implement the chargable interface accept ChargeCarrier from other objects in the neural net.
type ChargedWorker ¶
type ChargedWorker interface { Charge(strength float64) Work() }
ChargedWorker combines the Chargeable and Worker interfaces. (is there a better way to do this?)
type Node ¶
type Node struct { ChargeCarrier // contains filtered or unexported fields }
type Synapse ¶
type Synapse struct { ChargeCarrier // contains filtered or unexported fields }
A Synapse is a channel for transferring ChargeCarrier between brain elements. It has exactly one output, and should be pointed to by exactly one input. Unlike Nodes, Synapses do not distribute ChargeCarrier in bursts, they slowly convey ChargeCarrier to their output over time.
func NewSynapse ¶
func NewSynapse(output Chargeable, permittivity float64) *Synapse
Creates a new Synapse which points at the given output.