Nano Brain for Unity v0.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
NanoBrain.Receptor Class Reference

Description

Basic IReceptor to receive external input.

Inheritance diagram for NanoBrain.Receptor:
NanoBrain.Neuron NanoBrain.IReceptor NanoBrain.Nucleus

Public Types

enum  CombinatorType { Sum , Product , Max }
 The type of combinators. More...
 
enum  CurvePresets {
  Linear , Power , Sqrt , Reciprocal ,
  Custom
}
 The type of.
 
enum  Type {
  None , Neuron , MemoryCell , Cluster ,
  Receptor , ClusterReceptor
}
 The types of Nucleus.
 

Public Member Functions

 Receptor (Cluster parent, string name)
 Create a new Receptor in a Cluster instance.
 
 Receptor (ClusterPrefab prefab, string name)
 Create a new Receptor in a Cluster Prefab.
 
string GetName ()
 Get the name of the receptor.
 
override Nucleus ShallowCloneTo (Cluster parent)
 Function to make a partial clone of this nucleus.
 
override Nucleus Clone (ClusterPrefab prefab)
 Function to clone a nucleus to a Cluster prefab.
 
void AddReceptorElement (ClusterPrefab prefab)
 Extends the nucleiArray with an additional element.
 
void RemoveReceptorElement ()
 Removes the last element from the nucleiArray.
 
virtual void AddArrayReceiver (Nucleus receiverToAdd, float weight=1)
 Add a receiver for this receptor array.
 
override void UpdateStateIsolated ()
 
override void UpdateNuclei ()
 Update the state and recursively all Nuclei receiving data from this Nucleus.
 
override void UpdateNuclei ()
 Update the state and recursively all Nuclei receiving data from this Nucleus.
 
override void ProcessStimulus (Vector3 inputValue, int thingId=0, string thingName=null)
 Process an external stimulus.
 
AnimationCurve GenerateCurve ()
 
float3 CombinatorSum ()
 
Vector3 CombinatorSum ()
 
float3 CombinatorProduct ()
 
Vector3 CombinatorProduct ()
 
float3 CombinatorMax ()
 
Vector3 CombinatorMax ()
 
virtual void AddReceiver (Nucleus receiverToAdd, float weight=1)
 
virtual void RemoveReceiver (Nucleus receiverToRemove)
 
void ProcessStimulusDirect (Vector3 inputValue, int thingId=0, string thingName=null)
 
Synapse AddSynapse (Neuron sendingNucleus, float weight=1)
 Add a new synapse to this nuclues.
 
Synapse GetSynapse (Nucleus sender)
 Find a synapse.
 
void RemoveSynapse (Nucleus sendingNucleus)
 Remove a synapse from a Nucleus.
 
virtual void SetBias (Vector3 inputValue)
 Set the bias, recalculate the output and update all Nuclei receiving from this Nucleus.
 

Static Public Member Functions

static void Delete (Nucleus nucleus)
 

Public Attributes

CombinatorType combinator = CombinatorType.Sum
 The type of combinator used for this Neuron.
 
CurvePresets _curvePreset
 
AnimationCurve curve
 
float curveMax = 1.0f
 
Action WhenFiring
 
int stale = 1000
 
readonly int staleValueForSleep = 20
 
string name
 The name of the Nucleus.
 
ClusterPrefab clusterPrefab
 The cluster prefab in which the nucleus is located.
 
Cluster parent
 The cluster instance in which the nucleus is located.
 
bool trace = false
 Toggle for printing debugging trace data.
 
Vector3 bias = Vector3.zero
 The bias of the nucleus.
 

Protected Member Functions

virtual void CloneFields (Neuron clone)
 
float3 ActivatorLinear (float3 input)
 
Vector3 ActivatorLinear (Vector3 input)
 
float3 ActivatorSqrt (float3 input)
 
Vector3 ActivatorSqrt (Vector3 input)
 
float3 ActivatorPower (float3 input)
 
Vector3 ActivatorPower (Vector3 input)
 
float3 ActivatorReciprocal (float3 input)
 
Vector3 ActivatorReciprocal (Vector3 input)
 
float3 ActivatorCustom (float3 input)
 
Vector3 ActivatorCustom (Vector3 input)
 

Protected Attributes

float3 _outputValue
 
Vector3 _outputValue
 

Properties

NucleusArray array [set]
 
Nucleus[] nucleiArray [get, set]
 The array of nuclei used to track multiple things sending stimuli.
 
CurvePresets curvePreset [get, set]
 
virtual float3 outputValue [get, set]
 
virtual Vector3 outputValue [get, set]
 
float outputMagnitude [get]
 
float outputSqrMagnitude [get]
 
bool isFiring [get]
 
virtual bool isSleeping [get]
 
Func< float3 > Combinator [get]
 
Func< Vector3 > Combinator [get]
 
Func< float3, float3 > Activator [get]
 
Func< Vector3, Vector3 > Activator [get]
 
virtual List< Nucleusreceivers [get, set]
 
List< Synapsesynapses [get]
 The synapses of the nucleus.
 

Member Enumeration Documentation

◆ CombinatorType

The type of combinators.

A combinator combines the weighted values of the synapses to a single value

Enumerator
Sum 

Add the weighted values together.

Product 

Multiply the weighted values.

Max 

Take the maximum of all the weighted values.

Constructor & Destructor Documentation

◆ Receptor() [1/2]

NanoBrain.Receptor.Receptor ( Cluster  parent,
string  name 
)

Create a new Receptor in a Cluster instance.

Parameters
parentThe Cluster in which the Receptor is created
nameThe name of the new Receptor

◆ Receptor() [2/2]

NanoBrain.Receptor.Receptor ( ClusterPrefab  prefab,
string  name 
)

Create a new Receptor in a Cluster Prefab.

Parameters
prefabThe Cluster Prefab in which the Receptor is created
nameThe name of the new Receptor

Member Function Documentation

◆ GetName()

string NanoBrain.Receptor.GetName ( )

Get the name of the receptor.

Returns
The name of the receptor

Implements NanoBrain.IReceptor.

◆ ShallowCloneTo()

override Nucleus NanoBrain.Receptor.ShallowCloneTo ( Cluster  parent)

Function to make a partial clone of this nucleus.

Parameters
parentThe cluster in which the cloned nucleus should be placed
Returns

◆ Clone()

override Nucleus NanoBrain.Receptor.Clone ( ClusterPrefab  prefab)

Function to clone a nucleus to a Cluster prefab.

Parameters
prefab
Returns

◆ AddReceptorElement()

void NanoBrain.Receptor.AddReceptorElement ( ClusterPrefab  prefab)

Extends the nucleiArray with an additional element.

Parameters
prefabA prefab of the nucleus to add?

Implements NanoBrain.IReceptor.

◆ RemoveReceptorElement()

void NanoBrain.Receptor.RemoveReceptorElement ( )

Removes the last element from the nucleiArray.

Implements NanoBrain.IReceptor.

◆ AddArrayReceiver()

virtual void NanoBrain.Receptor.AddArrayReceiver ( Nucleus  receiverToAdd,
float  weight = 1 
)
virtual

Add a receiver for this receptor array.

Parameters
receiverToAddThe receiving Nucleus
weightThe initial weight to use for the synapses

This function will add a synapse to the receiver for each element in the nucleiArray.

Implements NanoBrain.IReceptor.

◆ UpdateNuclei() [1/2]

override void NanoBrain.Receptor.UpdateNuclei ( )
virtual

Update the state and recursively all Nuclei receiving data from this Nucleus.

Reimplemented from NanoBrain.Nucleus.

◆ UpdateNuclei() [2/2]

override void NanoBrain.Receptor.UpdateNuclei ( )
virtual

Update the state and recursively all Nuclei receiving data from this Nucleus.

Reimplemented from NanoBrain.Nucleus.

◆ ProcessStimulus()

override void NanoBrain.Receptor.ProcessStimulus ( Vector3  inputValue,
int  thingId = 0,
string  thingName = null 
)
virtual

Process an external stimulus.

Parameters
inputValueThe value of the stimulus
thingIdThe id of the thing causing the stimulus
thingNameThe name of the thing causing the stimulus

Reimplemented from NanoBrain.Neuron.

◆ AddSynapse()

Synapse NanoBrain.Nucleus.AddSynapse ( Neuron  sendingNucleus,
float  weight = 1 
)
inherited

Add a new synapse to this nuclues.

Parameters
sendingNucleusThe nucleus from which the signals may originate
weightThe weight applied to the input. Default value = 1
Returns
The created Synapse

This will add a new input to this nucleus with the given weight.

◆ GetSynapse()

Synapse NanoBrain.Nucleus.GetSynapse ( Nucleus  sender)
inherited

Find a synapse.

Parameters
senderThe sender of the input to the Synapse
Returns
The found Synapse or null when the sender has no synapse to this nucleus.

◆ RemoveSynapse()

void NanoBrain.Nucleus.RemoveSynapse ( Nucleus  sendingNucleus)
inherited

Remove a synapse from a Nucleus.

Parameters
sendingNucleusRemote the synapse connecting to this Nucleus

◆ SetBias()

virtual void NanoBrain.Nucleus.SetBias ( Vector3  inputValue)
virtualinherited

Set the bias, recalculate the output and update all Nuclei receiving from this Nucleus.

Parameters
inputValue

Member Data Documentation

◆ bias

Vector3 NanoBrain.Nucleus.bias = Vector3.zero
inherited

The bias of the nucleus.

The bias which a value which is always added to the combined value of the nucleus It does not have a synapse and therefore no weight of source nucleus

Property Documentation

◆ nucleiArray

Nucleus [] NanoBrain.Receptor.nucleiArray
getset

The array of nuclei used to track multiple things sending stimuli.

The size of the array determines the maximum number of things which can be distinguished

Implements NanoBrain.IReceptor.


The documentation for this class was generated from the following file: