Class Agent
The abstract agent. This is the most generic agent form, it specifies the main execution
cycle and several extension points available for specialized agent implementations.
Inheritance
System.Object
Agent
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Mars.Components.Agents
Assembly: Mars.Components.dll
Syntax
public abstract class Agent : IAgent, ITickClient, IEntity, IModelObject
Constructors
| Improve this Doc View SourceAgent(ILayer, RegisterAgent, UnregisterAgent, Byte[])
Constructor for an abstract agent. It serves as a base class that is extended with
domain specific sensors, actions and reasoning, optionally containing a knowledge base.
Declaration
protected Agent(ILayer layer, RegisterAgent register, UnregisterAgent unregister, byte[] id = null)
Parameters
Type | Name | Description |
---|---|---|
ILayer | layer | Layer reference needed for delegate calls. |
RegisterAgent | register | Agent registration function pointer. |
UnregisterAgent | unregister | Delegate for unregistering function. |
System.Byte[] | id | Fixed GUID to use in this agent (optional). |
Fields
| Improve this Doc View SourceIsAlive
Alive flag for execution and deletion checks.
Declaration
protected bool IsAlive
Field Value
Type | Description |
---|---|
System.Boolean |
Layer
Layer reference needed for delegate calls.
Declaration
public readonly ILayer Layer
Field Value
Type | Description |
---|---|
ILayer |
Properties
| Improve this Doc View SourceID
The agent identifier.
Declaration
public Guid ID { get; set; }
Property Value
Type | Description |
---|---|
System.Guid |
Methods
| Improve this Doc View SourceGetHashCode()
The abstract agent. This is the most generic agent form, it specifies the main execution
cycle and several extension points available for specialized agent implementations.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
System.Object.GetHashCode()
|
Improve this Doc
View Source
GetTick()
Returns the current simulation tick.
Declaration
public long GetTick()
Returns
Type | Description |
---|---|
System.Int64 | Execution tick counter value. |
Reason()
Abstract implementation requires sub-class to implement it.
Declaration
protected abstract void Reason()
Remove()
The removal method stops external triggering of the agent. It is designed
to be overridden by more specific methods calling down to this via 'base'.
Declaration
protected virtual void Remove()
Tick()
This is the main function of the agent program. It executes all three steps,
calling the concrete functions of the domain-specific agent, respectively.
The execution is governed by some external runtime manager.
Declaration
public void Tick()
ToString()
Default debug output. It may be overwritten by more concrete functions.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | Console output string. |
Overrides
System.Object.ToString()