Environment

A guide to environments in SCOP Framework.

Overview

Environment is a first-class abstraction in the modeling and engineering of complex computational systems, such as pervasive, adaptive, and multi-agent systems [Weyns]. It is usually modeled through the resource abstraction, as a non-goal-driven entity producing events and/or reactively waiting for requests to perform its function. Environment is essential in coordination since it works as a mediator for agent interaction through which agents can communicate and coordinate indirectly. It is active; featuring autonomous dynamics, and affecting agent coordination. It has a structure; requiring a notion of locality, and allowing agents of any sort to move through a topology.

To this end, Environment is modeled as an agent. Environment is mainly in charge of

  • allocating physical addresses (e.g., coordinate address) and/or logical addresses (e.g., agent address, wallet address or even alias) to agents and artifacts and,
  • mediating agent-agent and agent-artifact interaction through these addresses.

Defining an Environment

In this generic implementation, there is no limitation about the number of agents and/or artifacts that can be allocated to an address (e.g., in a Grid environment several agents may be at the same position). Similarly, there is also no limitation about the number of addresses an agent can allocate (e.g., in a Bitcoin environment an agent may have several wallet addresses).

To create a generic environment, do simply the following inside the setup() method of a Mage agent.

public class MyMage extends Mage {
	
	@Override
	protected void setup() {
		// create an environment named "MyEnvironment"
		Environment environment = create(new Environment("MyEnvironment"));
         ...
    }
    ...
}   

Adding Agents to an Environment

To create agents for the environment, nothing special needs to be done.

1. Create Agents

Agents can be created one by one:

Agent agent = create(new Agent() {
    //... agent setup code ...
});

or in a loop, usually for a desired amount of agent count:

for (int i = 0; i < numOfAgents; i++) {
    Agent agent = create(new Agent() {
        //... agent setup code ...
    });
}

2. Add Agents to the Environment

After an agent is created, it can be added to the environment using the add method of the GroupManager role:

environment.as(Groupanager.class).add(agent).execute();

Upon being added to the grid environment, the GroupManager role assigns the Communicator role to the agents so that they can communicate with other agents in the same environment.


Grid Environment

A guide to Grid environments in SCOP Framework.

Geographical Environment

A guide to Grid environments in SCOP Framework.


Last modified January 10, 2025: Rename MAGE as SCOP (6a3f92c)