Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Behavior Model

Janis Sprenger edited this page Feb 18, 2021 · 1 revision

Behavior

In the tree-based Behavior Model (MBehavior), which is defined as a Behavior Tree, five important classes of leaf nodes (MBTLeafNode ← MBTTreeNode) or executable primitives will be used: MBTCondition; MBTUpdate; MBTService; MBTAction; MBTScene. All these nodes are united by the fact that they access the knowledge base of the agent via SPARQL queries and process the resulting information or forward it to a service, for example. With so-called conditions (MBTCondition) the current state of the simulation or the character to be simulated is queried; with updates (MBTUpdate) the internal knowledge of the agent can be updated; services nodes (MBTService), with which external or internal services are called to receive external data or to process internal data; and action nodes (MBTAction), which represent the individual instruction steps or MMUs. In addition, further types of nodes (MBTBranchNode ← MBTTreeNode) are used to define the internal operational logic of the BT. With such a node the functionality mentioned in the previous chapter to generate instructions (MInstruction) based on linked actions and tree nodes, will be implemented. At each execution cycle of the agent, such an instruction is generated and sent to the co-simulator for execution. Successful or failed instruction execution is reported (MInstructionResult) from the co-simulator to the agent. MBTLeafNode and MBTBranchNode are derived from MBTTreeNode. They are not considered in the following list of classes and interfaces, since they are represented by their relevant variants for the project. In summary, it can be said that a branch node has at least one child node and all leaf nodes have queries with which they access the knowledge base of the agent.

MBehavior
+ID: string
+Name: string
+Root: MTreeNode
+Beliefs: list
+State: MBTState
+Run(list):MBTState
+Abort():bool

Detailed description of available parameters/functions:

Function/ Parameter Name Description
ID ID of the behavior
Name Name of the behavior
Root Root node or starting point of the behavior
Beliefs Link to the agent beliefs
State State of the behavior: FRESH, RUNNING, SUCCESS, FAILURE, ABORTED
Run Method to run the behavior
Abort Method to abort the behavior
MBTState (enum)
FRESH
RUNNING
SUCCEEDED
FAILED
ABORTED

Behavior Modeling & Execution

The Behavior Model and Execution unit (MBehaviorExecution) generates instructions (MInstruction) for the co-simulator based on the scene and a predefined behavior model. The unit that generates these instructions for one simulated character and manages its knowledge is called agent that is represented with the MAgent class. MBehaviorExecution manages these agents. With this unit, you can create so called agent templates (MTemplate), which describes a certain type of agent. Such a template contains configuration information about an agent and its behavior models. It is a blueprint for an agent (MAgent), so to speak. To create an agent, the name of the agent and the template to be used as well as its initial knowledge (MInitialKnowledge) or the initial state of the scene to be viewed are transferred to the Behavior Model & Execution unit.

MBehaviorExecution
+Agents: list
+Templates: list
+AddTemplate(MTemplate):bool
+DeleteTemplate(MTemplate):bool
+CreateAgent(template:ID, name, MInitialKnowledge):MAgentState
+ListAgents():list
+DeleteAgent(agent:ID):list

Detailed description of available parameters/functions:

Function/ Parameter Name Description
Agents List of all available agents
Templates List of all available agent templates
AddTemplate Add new agent template which describes an agent model
DeleteTemplate Delete an agent template
CreateAgent Create an agent with a defined name, linked agent template and initial agent knowledge
ListAgents List all agents
DeleteAgent Delete specified agent
Agents List of all available agents
Templates List of all available agent templates
AddTemplate Add new agent template which describes an agent model

In addition to its behavior, an agent has several storage units for storing RDF-based data, the so-called Triple Data Bases (MTripleDataBase). In these the scene updates (MSceneUpdate) are stored which are mapped to RDF in an intermediate step. These triple stores are accessed by the behaviors (MBehavior) during their execution in order to query states or to read data for the generation of instructions (MInstruction). Actions or MMUs and services that should be available for the behavior models will be referenced in the agent.

MRDFGraph

MRDFGraph
+ContentType: string
+Graph: string

Detailed description of available parameters/functions:

Parameter Name Required Description
ContentType
Graph

MAgent

MAgent
+ID: string
+Name: string
+SceneAccess: MSceneAccess
+ServiceAccess: MServiceAccess
+AgentState: MAgentState
+Beliefs: list
+Behaviors: list
+Services: listMService:ID
+Actions: listMMU:ID
+Initialize(list):MAgentState
+GetState():MAgentState
+Perceive(list):bool
+CompleteInstruction(MInstructionResult):bool
+Run(list,):MInstruction
+Abort():bool

Detailed description of available parameters/functions:

Function/ Parameter Name Description
ID Agent ID.
Name Name of the Agent.
SceneAccess Access to the Scene for agent-scene interaction, like reading out the current state of the scene or to manipulate it.
ServiceAccess Access to available services to make use of their provided methods while behavior execution.
AgentState State of the agent.
Beliefs All beliefs of an agent stored as RDF in multiple triple stores.
Behaviors List of all SPARQL-BTs of the agent.
Services List of used services.
Actions List of used MMUs.
Initialize Method to initialize the agent by executing a specific SPARQL-BT for configuration purposes, like setting variables.
GetStatus Method for returning the agent status.
Perceive Method which is used by the consumer to update the agent knowledge if a scene or simulation update comes up:
CompleteInstruction Method to tell the agent that an action or motion instruction is finished successfully or faulty.
Run Method to run the defined SPARQL-BT of the agent.
Abort Method to abort a running SPARQL-BT.

MBTLeafNode

MISSING Documentation!

MBTAction

<<interface>>
MBTAction ← MBTLeafNode
+ID: string
+Name: string
+Beliefs: → behavior:Beliefs
+Query: String (SPARQL-Update)
+Action: MMUID
+Run():MBTState
+Validate(MInstructionResult):bool

Detailed description of available parameters/functions:

Function/ Parameter Name Description
ID ID of the leaf node.
Name Name of the leaf node.
Beliefs Beliefs of the agent.
Query CONSTRUCT or SELECT SPARQL query which defines a agent state.
Action Link to the MMU which have to be used.
Validate Method to validate the incoming MInstructionResult to decide if the action performed by the co-simulator was successful, returning: SUCCEEDED or FAILED

Example:

MBTAction Walk
ID “:WalkToTarget1” (RDF)
Name “WalkToTarget1”
Beliefs “ajan:AgentKnowledge”
Action “walk” (MotionType)
Query “PREFIX mosim: http://mosim/vocabulary SELECT ?target WHERE { ?target a mosim:Target . ?target mosim:name “Target1” . }”

MBTComposite

<<interface>>
MBTComposite ← MBTBranchNode
+ID: string
+Name: string
+Beliefs: → behavior:Beliefs
+Children: list
+Run():MBTState
+Abort():bool

Detailed description of available parameters/functions:

Function/ Parameter Name Description
ID ID of the composite node.
Name Name of the composite node.
Beliefs Beliefs of the agent.
Children Children of the composite node.
Run Method to run the composite executed by its parent node, returning its status.
Abort Method to abort composite node.

MBTCondition

<<interface>>
MBTCondition ← MBTLeafNode
+ID: string
+Name: string
+Beliefs: → behavior:Beliefs
+Query: String (SPARQL)
+Run():MBTState

Detailed description of available parameters/functions:

Function/ Parameter Name Description
ID ID of the leaf node.
Name Name of the leaf node.
Beliefs Beliefs of the agent.
Query ASK SPARQL query which defines an agent state.
Run Method to execute this node, which performs the defined query on the agent beliefs, returning: SUCCEEDED or FAILED

Example:

MBTCondition
ID “:WalkToTarget1?” (RDF)
Name “WalkToTarget1?”
Beliefs “ajan:AgentKnowledge”
Query “PREFIX mosim: http://mosim/vocabulary ASK WHERE{ ?avatar a mosim:Avatar. ?avatar mosim:locatedNextTo ?location . ?target a mosim:Target . ?target mosim:name "Target1" . FILTER (?location != ?target) }"

MBTDecorator

<<interface>>
MBTDecorator ← MBTBranchNode
+ID: string
+Name: string
+Beliefs: → behavior:Beliefs
+Child:
+Run():MBTState
+Run(list):MBTState
+Abort():bool

Detailed description of available parameters/functions:

Function/ Parameter Name Description
ID ID of the decorator node.
Name Name of the decorator node.
Beliefs Beliefs of the agent.
Child Child of the decorator node.
Run Method to run the decorator node executed by its parent node, returning its status.
Abort Method to abort the decorator node.

With composite nodes (MBTComposite) that can have several child nodes, sequential or parallel processes are usually implemented, whereas decorators (MBTDecorator) possess only one child node. This type is mostly used for loops. In contrast to the tree nodes just mentioned, Leaf Nodes (MBTLeafNode) do not have child nodes that are executed.

MBTScene

MBTScene ← MBTLeafNode
+ID: string
+Name: string
+Beliefs: → behavior:Beliefs
+Query: String (SPARQL-Update)
+Scene: MScene:ID
+Run():MBTState

Detailed description of available parameters/functions:

Function/ Parameter Name Description
ID ID of the leaf node.
Name Name of the leaf node.
Beliefs Beliefs of the agent.
Query UPDATE SPARQL query which defines an agent state.
Scene Link to the scene.
Run Method to run this node, which executes the MScene:GetChanges() method and performs the defined query to update the agent beliefs with the received scene updates, returning: SUCCEEDED or FAILED

MBTService

<<interface>>
MBTService ← MBTLeafNode
+ID: string
+Name: string
+Beliefs: → behavior:Beliefs
+Query: String (SPARQL-Update)
+Service: MService:ID
+Run():MBTState

Detailed description of available parameters/functions:

Function/ Parameter Name Description
ID ID of the leaf node.
Name Name of the leaf node.
Beliefs Beliefs of the agent.
Query CONSTRUCT or SELECT SPARQL query, which defines an agent state.
Service Link to the service, which has to be used.
Run Method to execute this node, which performs the defined query to gather date from the agent beliefs which will be sent to the defined service, returning: SUCCEEDED or FAILED or RUNNING

MBTUpdate

<<interface>>
MBTUpdate ← MBTLeafNode
+ID: string
+Name: string
+Beliefs: → behavior:Beliefs
+Update: String (SPARQL-Update)
+Run():MBTState

Detailed description of available parameters/functions:

Function/ Parameter Name Description
ID ID of the leaf node.
Name Name of the leaf node.
Beliefs Beliefs of the agent.
Update UPDATE SPARQL query which defines a new agent state.
Run Method to execute this node, which performs the defined query on the agent beliefs, returning: SUCCEEDED or FAILED

Example:

MBTUpdate UpdateAvatarLocation
ID “:UpdateAvatarLocation” (RDF)
Name “UpdateAvatarLocation?!”
Beliefs “ajan:AgentKnowledge”
Update “PREFIX mosim: http://mosim/vocabulary DELETE {?avatar mosim:locatedNextTo ?location .} INSERT {?avatar mosim:locatedNextTo ?target .} WHERE { ?avatar a mosim:Avatar .?avatar mosim:locatedNextTo ?location .?target a mosim:Target .?target mosim:name “Target1” .FILTER (?location != ?target)}”

MOSIM Documentation

Introduction

Documentation

Known Issues

Clone this wiki locally