What you’ll build

The aim is to understand and program some basic mechanisms for agent-centric coordination. These mechanisms aim at enabling agents to build an house in a dynamic environment. You will program this multi-agent system, situated in a simple environment.

What you’ll need

Code

Collapsible sections introduced by present details or questions and exercises to realise. Think to click on the icon to access to the content.

This practical work has questions and practical exercises. You are requested to provide the answers to questions Q1, Q2 and Q3 in one single file with your name. You are requested to provide the code for practical exercises PW2 and PW3. The answers and these codes have to be submitted by 12th of November on ecampus web page of the course. Answers and code of the practical exercises are taken into account for the grade.

1. Preamble

1.1. Problem description

The domain that we are considering concerns a strongly simplified multi-agent based support system for building an house. We envision the use of multiple agents in two main phases:

  1. Contracting phase where agents support the contracting of specialized companies. Various companies, specialized in different tasks for the building of an house, participate to a coordinated distributed task allocation process ;

  2. Execution phase where agents support the coordination of the companies in the execution of tasks for the building of the house. Contractees participate to the main workflow for building the house under supervision of the house owner.

Detail of the contracting phase

The objective here is to hire one company for each of the following tasks:

  • Preparation of the site (a)

  • Laying of the floors (b)

  • Building the walls of the house (c)

  • Building the roof (d)

  • Fitting the windows (e)

  • Fitting the doors (f)

  • Installing the plumbing (g)

  • Installing the electrical system (h)

  • Painting the exterior of the house (i)

  • Painting the interior of the house (j)

Some of the candidate companies may have the skills for executing several tasks. That is to say that the same company can be hired for more than one task.

Detail of the execution phase for building the house
  • After the companies have been hired, they have to execute their tasks on time and in coordination with each other

  • Some tasks depend on others and some tasks can be done in parallel, as represented for instance by the following workflow (";" for sequence and "|" for parallel):

    a ; b ; c ; (d | e | f) ; (g | h | i) ; j

This is one example of a possible workflow. Other workflows could be defined depending on the constraints.

1.2. Initial Implementation

In the initial implementation that you can download, two families of agents are defined:

  • One agent (giacomo of type owner) supporting the house owner: this agent manages the contracting and building phases considering the requirements for the house, budget limitations and preferences of the owner ;

  • One agent (companyXi of type companyX) for each company: this agent participates to the contracting by offering the services of the company given its competences and preferences. If hired by the house owner, this agent then manages the execution of the house building tasks for which the company has been contracted.

Two main artifacts are defined: (i) an auction artifact and (ii) an artifact for the simulated house. They are programmed and deployed in the shared environment to support respectively:

  • the auction mechanism used to hire the companies by managing the execution of an electronic auction mechanism ;

  • the actions of the agents on a simulated house to replicate in the digital world the action of the company in the physical world.

An organisation is defined to specify the structure and workflow to be followed by the different companies for the building of the house. This organisation aims at ensuring cooperation in the execution of the global building of the house.

The code and the execution of the multi-agent system is structured along the two main phases: (1) contracting phase and (2) execution phase.

Detail of the contracting phase (click on to access the detail)
  • On the environment’s side, the electronic auction mechanism is implemented by the AuctionArt artifact. It is used to hire the required companies as follows:

    • One auction for each task (i.e. one instance of AuctionArt for each task).

    • Each auction is started (i.e. the instance of AuctionArt is created) with:

      • the task description

      • the maximum value the owner can pay for it

    • By the end of an auction, the company to be hired for that task is determined

    • The AuctionArt has the following observable properties:

      • task initialized with the task description

      • maxValue initialized with the maximum value

      • currentBid initialized with the maximum value and showing the current best bid

      • currentWinner initialized with "no_winner" value

    • It has the following operation:

      • bid used with one double parameter for the bidding on the task

  • On the agent’s side,

    • the giacomo agent of type owner has plans to launch all auctions by creating the corresponding artifacts of type AuctionArt

    • the company agents of type companyX (X=A,B,C,D or E) have plans to look for the auction artifacts of their interest and plans defining their own bidding strategy

    • After some time giacomo looks at the best bid in each auction artifact and awards a contract for the winning company

Detail of the execution phase (click on to access the detail)
  • After all auctions are over, giacomo sends messages to the hired companies to enter into the execution phase by adopting the corresponding roles in the organisation

    • An organisation entity is created from the house-os.xml organisation specification

    • the functional specification is used to define the workflow

    • the structural specification is used to define the role and group structures

    • the normative specification is used to distribute the tasks of the workflow to the roles

    • By playing roles in the organisation entity, the agents will receive obligations on the tasks to realize at the right time

  • On the agent’s side,

    • the giacomo agent is equipped with the plans to construct the virtual organisation based on the result of the contracting phase

    • the company agents have plans

      • to enter the organisation, adopt the role corresponding to their contract and to catch the different events generated by the organisation management infrastructure

      • to execute autonomously the various actions achieving the goals related to the missions they are committed to in the organisation functional specification

    • NB: agents are benevolent with respect to the organisation, i.e. they don’t violate the norms and execute what is prescribed by the organisation

  • On the environment’s side, the simulated house is implemented by the House artifact that offers the following operations to the agents:

    • prepareSite for preparing the site, generating the event sitePrepared one done

    • layFloors for laying the floors, generating the event floorsLayed once done

    • buildWalls for building the walls, generating the event wallsBuilt once done

    • buildRoof for building the roof, generating the event roofBuilt once done

    • fitWindows for fitting the windows, generating the event windowsFitted once done

    • fitDoors for fitting the doors, generating the event doorsFitted once done

    • installElectricalSystem for installing the electrical system, generating the event electricalSystemInstalled once done

    • installPlumbing for installing the plumbing, generating the event plumbingInstalled once done

    • paintExterior for painting the exterior, generating the event exteriorPainted once done

    • paintInterior for painting the interior, generating the event interiorPainted once done

QUESTION 1 (Q1)
QUESTION (click on to access the detail)

What are the pros and cons of the contracting phase when considering:

  • the agent’s autonomy of the giacomo agent and of the companyXi agents

  • the openness of the system, considering that agents supporting the companies may be developed by any company and join the "market place" to participate to the auctions

PRACTICAL WORK 1 (PW1)
EXERCISE Execution of the Initial Building Use Case (click on to access the detail)
  • Execute the complete use case

Help
  • The execution will stop after the execution of the first phase since the agent giacomo waits for the creation of the goal go to trigger the plan that will launch the execution phase

  • To create this goal while executing the system, you can dynamically access the agent giacomo by using the New REPL agent in the console. In this window, you can add a new goal to giacomo agent:

!go.

2. Agent-Centric Coordination: Reasoning on the External Description of Agents

  • Instead of letting the company agents choose to which auctions they will participate, the giacomo agent now selects them.

  • This selection is based on the ability of these agents to handle the required tasks.

  • For that purpose, each company agent share a profile of its skills (which task(s) it can handle) with giacomo agent.

  • Based on the profile of each company, the giacomo agent invites the corresponding agent by sending it an invitation message. This message gives to the agent the name of the auction artifact to use for making its bids.

QUESTION 2 (Q2)
QUESTION (click on to access the detail)

What are the pros and cons of this new contracting phase when considering:

  • the agent’s autonomy of the giacomo agent and of the company agents

  • the openness of the system, considering that agents supporting the companies may be developed by any company and join the "market place" to participate to the auctions

PRACTICAL WORK 2 (PW2)
EXERCISE Presentation Phase (click on to access the detail)

In the following, the aim is to add a presentation phase in the global functioning of the multi-agent system. In this presentation phase, each companyXi agent will present itself to the giacomo agent.

  1. On the company agent side:

    1. Transform or reuse as is the file of each companyX agent. An agent has the list of the tasks it has to execute: my_task("Task") where Task is replaced by the task that the company can realize.

    2. In the companyX.asl add a plan so that the companyX sends a message to giacomo agent telling it that its external description is composed of the various my_task(Task) that it has to realize. The giacomo agent can know to whom this Task belongs by looking at the source annotation of the belief.

  2. On the owner agent side: after waiting for 5000 ms, the owner agent gathers the names of all the agents able to execute a given task from the received external description, creates the corresponding auction artifact and sends the name of this artifact to the corresponding agent through a belief auction_to_use(task,artifactname)

  3. On the company agent side: once received this new belief, the company agent lookups for this artifact and focus on it

  4. Test this new multi-agent program

Help

3. Agent Centric Coordination with the use of trust and reputation

  • Going beyond the selection of agents by their profile, the giacomo agent now selects them based on their reputation

  • The reputation is built from past experiences, based on the quality with which these agents handled the required tasks, on their respect of the deadlines, etc.

  • As for the previous exercise, the giacomo agent invites the corresponding agents by sending them an invitation message for the task they have the skills and a good reputation. What is a good reputation is the preference of giacomo.

  • The sent message gives to the company agent the name of the auction artifact to use for making its bids.

QUESTION 3 (Q3)
QUESTION (click on to access the detail)

What are the pros and cons of this new contracting phase when considering:

  • the agent’s autonomy of the giacomo agent and of the company agents

  • the openness of the system, considering that agents supporting the companies may be developed by any company and join the "market place" to participate to the auctions

PRACTICAL WORK 3 (PW3)
EXERCISE Reputation-based Selection (click on to access the detail)
  • Write the code in the different agents to implement this strongly simplified management of trust

  • To simplify, you can use a reputation belief instead of computing reputation.