Polarith AI
1.8
Sensor< T > Class Template Referenceabstract

Description

Represents the sensorial system of an agent (implementation as abstract base class).

It determines how the agent perceives (samples) its world (problem space).

A Sensor<T> is made up of IReceptor<T> instances which form the sensor. Therefore, receptors define neighbourhood structures between each other. Every receptor has got an IReceptor<T>.ID and within one Sensor<T> instance this ID is unique in order to definitely identify a receptor.

This abstract base class mainly serves as container for intermediate methods which are useful for the further inheritance hierarchy, like for instance RepairAfterInsert(int) and RepairBeforeRemove(int). All other class members are abstract and cannot be implemented here because of Unity's serialization pipeline. In order to support the serialization, we need to store a list of concrete Receptor<T> typed instances, whereby the type T must be fixed/hidden through inheritance, like it is done for Move.Receptor.

The concrete problem space representation of a sensor is depended on the type T of the structural element hold by each IReceptor<T>.

Template Parameters
TType of the structural sensor element defining the problem space.
Inheritance diagram for Sensor< T >:
ISensor< T >

Properties

abstract int ReceptorCount [get]
 The number of contained receptors (read only). More...
 
abstract IReceptor< T > this[int id] [get]
 Provides quick read-only access to a contained IReceptor<T> instance. More...
 

Public Methods

abstract IReceptor< T > AddReceptor ()
 Constructs and adds an IReceptor<T> instance into this sensor. More...
 
abstract IReceptor< T > InsertReceptor (int id)
 Constructs and inserts an IReceptor<T> instance into this sensor with the specified id . More...
 
abstract IReceptor< T > GetReceptor (int id)
 Gets the IReceptor<T> with the specified id . More...
 
abstract void RemoveReceptorAt (int id)
 Removes the IReceptor<T> with the specified id . More...
 
abstract void ClearReceptors ()
 Removes all contained IReceptor<T> instances. More...
 

Protected Methods

virtual void RepairAfterInsert (int id)
 Might be called at the beginning of InsertReceptor(int). More...
 
virtual void RepairBeforeRemove (int id)
 Might be called at the end of RemoveReceptorAt(int). More...
 
Imprint