Skip to main content

Entities

Definition

An entity in system simulation models is a subject that holds specific properties and displays particular behaviors. This includes the Agent, Cell, and Link components.

Individuals and Populations

Populations

In the model, an entity can be a single individual or a group of individuals, commonly called a "population."

Examples
  • A flock, regarded as a population, is formed by several sheep, each represented as an individual Agent.
  • A two-dimensional plane, considered a population, is created by arranging multiple grid Cells, each individual, in rows and columns.
  • A social network, seen as a population, is composed of multiple Link individuals, each representing an individual relationship between people.

Observers

  • Each entity population has an Observer, a special role with unique properties and behaviors that remain invisible in the simulated worldview or network charts. The observer theoretically represents the entity population but does not appear directly in the simulation environment.
Tips: Observer Use Cases in Modeling
  • Directing individuals to act in a predetermined logical sequence.
  • Carrying and managing population properties and behaviors.
    • For example, the average profit rate of a group of traders can be stored in an observer's variable. Another example of this can be seen in a DeFi lending protocol that uses a risk pool model, like Compound, which can be portrayed as an Agent. In this case, the Agent's public fund pool serves as the Container object for the Agent observer. Even though individual smart contracts dictate the deposit and loan rules for different assets, these assets are stored within this public fund pool.
  • Controlling the creation and destruction of individuals, such as a product user group that might start with no users and later occasionally gain or lose users, or adjusting the size of a bird flock in real-time during flight research.
  • There is also a global observer, who is the executor of global processes and owner of global properties.
  • This observer persists indefinitely, even if all individuals in the population have been destroyed.

Property and Behavior: Belonging to Individual or Observer

  • Every individual within an entity population has their own instance of properties and behaviors when these are defined to belong to "Individual."
Example

If there is an Agent component named traders, this component is configured with a Container called wallet and a Process (behavior) called placing orders. Suppose this Agent population consists of 100 individuals. In that case, all these individuals will possess the same container and process, meaning each individual has their own independent wallet and their own independent order-placing behavior.

  • When creating behaviors and properties, it is necessary to clearly distinguish whether they belong to the observer or the individual (the default). The component icon differs accordingly; a shadow signifies that it belongs to the observer.

Commonalities and Differences Among Various Entities

Commonalities

Agents, Cells, and Links are all components of the system. They each have their own behaviors and properties. They each have individual and observer roles and can interact with other entities. They can be defined as blocks, and they are the basic units of simulated statistical data.

Differences

They differ in functions, capabilities, external dependencies, built-in properties, and built-in behaviors.

Agents

agent

An Agent can move within the space of Cell populations, generate a Link relationship with another Agent, and can be created and destroyed independently. Its existence does not depend on the presence of other entities.

Agents' Typical Use Cases in Web3
  • Trading users, EOA entities.
  • Smart contracts.
  • Protocols (a collection of smart contracts), etc.

link

A Link cannot move, and its existence depends on the presence of Agents; after all, without individuals, there is no relationship between them. When Agent entities are present, Links can be created and removed. If an Agent dies, every Link connected to it also ceases to exist.

Links' Typical Use Cases in Web3 Community Governance
  • Voters may influence each other's opinions.
  • Relationships of support and opposition between voters and community proposals.
  • Contradictory or promotional relationships between community proposals.

Cells

cell

A Cell represents space, which is the place where Agents move and will never disappear (no built-in behavior Die for Cells). The number of populations remains unchanged once space's granularity is initially set. Its existence does not depend on the presence of other entities.

Cells' Typical Use Cases in Web3 On-chain Gaming
  • Cellular automata NFT.
  • Games like wolves eating sheep and sheep eating grass in the prairie mechanism.
Tip

Agents can be understood as generally capable entities, while Cells and Links are specialized intelligent entities specifically used to simulate physical spaces and networking domains, respectively.

Spontaneity of Entity Behavior

  • Entities' behavior is divided into active and passive, controlled by the start event of their behavior process.
  • Active behavior is spontaneous (system Tick triggered) and independent of others.
  • Passive behavior depends on external triggers, such as being called, triggered by a parent process, or receiving a message.
  • All types of entities can have both active and passive behaviors. Not all Agents are active, nor are all Cells and Links passive.
  • Whether active or passive, the executor of the action is the entity's observer or individual in which the process resides.
Examples of Link and Cell behaviors:
  • The strength of the relationship Link between users (a built-in property Weight) may change with their wealth difference.
  • The concentration of chemical pheromones at a point (Cell individual) in a room (Cell population) may spread over time.
  • Each patch of grassland, referred to as a 'Cell,' can be consumed by herbivorous animals and can also naturally regenerate over time.

Built-in Properties

Built-in properties are inherent properties of an entity, such as the shape (Shape) of an Agent, the list of starting and ending points (Ends) of a Link, or the center coordinates (Coordinates) of a cell in a two-dimensional space. Further details can be found in the entity's Built-in Properties section.

  • Inherent

    • The system provides built-in properties; they are created simultaneously when an entity is created and cannot be deleted.
    • Built-in properties are inherent to the entity, regardless of whether they are added to the canvas through the Quote component.
  • How to view

    Entities002+1

    You can view an entity's built-in properties by expanding the 'Built-in' menu in the model object tree.

    Entities003

  • Graphical Modeling

    Built-in properties do not have a representation on the canvas, but they can still be integrated into your graphical modeling. You can make them accessible by quoting them through the Quote component.

  • Creating Quotes to Built-in Properties

    Generally, there are three methods to create Quotes. However, when adding quotes to built-in properties, you cannot directly drag and drop from the model object tree (Method 2) onto the canvas. Instead, you need to click the Add button for the respective built-in property. All other methods remain valid and can be used as usual.

    Entities004

Built-in Behaviors

Built-in behaviors, also known as built-in methods or processes, are entities' inherent processes. For example, an Agent has a built-in method Die. When you call this method, it carries out the steps related to the death of that Agent, like taking it off the list of Agents alive.

  • Inherent

    The system provides built-in behaviors, which are created simultaneously when an entity is created and cannot be deleted.

  • How to view

    Expanding the Built-in menu in the model directory tree allows you to view all an entity's built-in behaviors (as shown above).

  • Usage in modeling

    • Unlike regular behavioral processes that are placed on the canvas, built-in behaviors do not have a representation on the canvas and can only be pointed to through the Call components.
    • During modeling, click on a calling or asking object. Then, select the built-in behavior to be called on the properties panel.
  • The Built-in Behaviors of Entities chapter provides further details.

Inheritance

Concept

  • An entity can inherit from an entity's definition, thereby inheriting its behaviors and properties. For example, sheep and wolves can inherit from mammals (block), while arbitrage traders and technical indicator traders can inherit from ordinary traders (block), and so on.

Graphical Modeling Implementation

  • Dragging and dropping a block (definition) into an entity's canvas represents inheritance. For instance, if you want to create a new population of wolves (Agents), you can drag and drop the mammal block from the library into the Agent's canvas, as shown below. All wolves within this population have the properties and behaviors defined in the Mammal block (e.g., giving birth).

    Entities005

  • You can also drag and drop an Agent from the components bar into the Wolf Agent's canvas. This signifies that the new Agent inherits a blank or base definition, which you can further customize.

Canceling Inheritance

If you want to cancel the inheritance, delete the aforementioned block instance from the canvas. This action removes the inherited properties and behaviors associated with that block.

Inheritance Requires Matching Definitions

Inheritance is limited to the same entity types; for instance, a Cell block cannot be placed into an Agent instance for inheritance.

Multiple inheritance

  • When you drag and drop multiple entity (parent) blocks of the same type onto the canvas within an entity (child), it represents multiple inheritance. The child entity will inherit the behaviors and properties of the parent entities.
  • In this case, properties and behaviors with the same name follow these rules of precedence: child overrides parent, and among parents, the one created first overrides those created later. When the overriding block is deleted, the properties and behaviors from the overridden block will immediately come into effect.
  • Custom behaviors with the same name as the child and one or more parent entities will not be overridden.
  • Both built-in behaviors and properties of the parent entities are invalid.
Example

Suppose you are creating a Wolf Agent:

  • You start by creating a Wolf Agent. Then, you drag and drop a Mammal block and a Carnivore block onto the Wolf Agent's canvas. Currently, the Wolf Agent inherits properties and behaviors from the Mammal and Carnivore blocks.
  • When the Wolf Agent and the Mammal block have a property named diet, the Wolf's diet property will override the Mammal's diet property. Then, the Wolf's diet property is used.
  • When the Mammal and Carnivore blocks have a property named breed, If you drag the Mammal block first and then the Carnivore block onto Wolf's canvas, which means the Mammal block is created earlier than the Carnivore, the Mammal's breed property will override the Carnivore's breed property. Then, the Wolf will inherit the Mammal's breed property. But when the Mammal block is deleted, the breed property of the Carnivore will immediately come into effect.

Multilevel Inheritance

  • Multilevel inheritance happens when a child entity inherits all properties and behaviors from multiple layers of parent entities.
Examples
  • A wolf, for instance, has properties like Age, PredationAmount, and Color, along with behaviors like Breed, Prey, and Howl, as illustrated in Figure 1 (the cover of the wolf entity on the root canvas).
  • This is achieved through inheritance during modeling, as depicted in Figure 2 (wolf entity canvas). Unique properties and behaviors of the wolf entity, such as Color and Howl, are shown in red (child level). The properties of PredationAmount and Prey, shown in green, are inherited from the Carnivore (parent level). Additionally, the Carnivore inherits properties like Age and Breed from the Mammal (blue, grandparent level). This allows the wolf entity to possess properties (Age and Breed)derived from the grandparent entity.
  • Properties with the same name follow the child-first overriding rule.
  • All behaviors with the same name coexist; please distinguish them (e.g., by renaming).

Modeling Guide

Basics

Drag and drop the entity component onto the canvas to create an entity object. You can then make configurations on the right-side properties panel.

Entity Internal Canvas

Every entity object has its own canvas. You can access this canvas from the model's root canvas by clicking the Enter button. This button is found on the control bar or at the bottom right of the entity cover when you hover over the entity, as illustrated below.

Entities008

Creating Behaviors and Properties for Entities

  • To create behaviors for an entity, drag and drop a process (block) onto its internal canvas.
  • Drag and drop data components onto the entity's internal canvas to create its properties.
  • You can establish inheritance by dragging and dropping an entity of the same type (either a component or a block) onto the entity's internal canvas. This signifies that the current entity inherits from the parent entity object that has been dragged in. It's important to note that entities of different types cannot inherit and, thus, cannot be placed within the same canvas.

Entity Object Cover

When you select to expand the entity from the style control bar (as indicated by the red box below), you can view its cover.

Entities009

  • The entity object's cover offers an overview of its internal behaviors and properties. You can choose which behaviors and properties are displayed or hidden.

  • The system supports directly dragging and dropping a process (block) and data components into the entity cover. This enables the quick creation of the entity behaviors and properties, assisting in constructing the model framework.

  • Annotation Lines can connect the entity and the processes inside its cover, which is especially handy for creating system diagrams.

  • The system allows you to adjust the layout automatically by dragging the processes and properties on the entity cover.

    Entities010

  • It's important to remember that processes inside the cover cannot be expanded further.