< !−− A l l t h e norms f o r t h i s s c e n e −−>
8
Rodrigo Paes et al.
Requires : the Requires element contains a reference to some norms specified inside the Norms element in the organization. It does not make sense to use a reference to some norm inside the scene itself because the Requires element is a precondition to start the scene execution, but if the norm belongs to the Norms element inside the scene specification, the norm can be only activated during the scene execution. Therefore, the scene will never start. 1 2 3
Messages : the Messages element specifies all the templates of messages used in the scene. This template comprises the fields performative; sender, which specifies both the agent that is sending the message and its respective role; receiver, which defines both the addressee agent and its role; and finally the content of the message being transmitted. The protocols use these templates to specify transitions. 1 2 3 4 5
Protocol : the Protocol element is a type of non-deterministic automaton, and it is composed of only two attributes: a set of states and a set of transitions. 1 2 3 4
. . . . . . . . . . . .
State : the id attribute allows the law developer to make references to the state. In this way, transitions can connect one state to another. Moreover, a state has a label and can be the initial or the final state of the protocol. 1 2
Governing Open Multi-Agent Systems
9
Transition : transitions connect two states. A transition is activated when the protocol is at the state from and if a message that matches the pattern specified by aMessageId arrives. It is important to notice that the attributes from and to are references to states specified in the States element, and the message-ref is also a reference to a message pattern specified in the Messages element. Furthermore, transitions can also have the ActiveNorms element representing all the norms that must be active in order to the transition been activated. 1 2 3 4 5 6
Clock : clocks can be of two types- regular or periodic. Regular means that it will generate only one clock-tick after a tick-period of milliseconds have been elapsed. Periodic clocks generate clock-ticks at the interval specified at the tickperiod attribute. Clocks are activated and deactivated by law elements. The Activation and Deactivation elements represent these activations and deactivation conditions. They both have reference to other law elements, and they have two attributes: ref and event-type. The ref is a reference to an id attribute and the event-type is the type of event generated by the referenced element. It is necessary because some elements generate more than one type of event, then; with the event type attribute it is possible to specify exactly what event should start the clock. 1 2 3 4 5 6 7 8
Norm : norms can contain three types of elements - Permission, Obligation and Prohibition. In the presented language, the structure of these three elements is equal. Each type of norm contains activation and deactivation conditions. These conditions have the same semantic of the clock’s conditions. 1 2 3 4 5 6 7 8 9 10 11 12
10
Rodrigo Paes et al.
4
Software Support
Development of multi-agent systems requires appropriated techniques, models and tools [16]. Tools, in particular, play an important role in the development scenario helping to build multi-agent systems faster and less error prone. Recognizing the importance of these aspects, we developed an object-oriented framework and a monitoring tool supporting the law governed approach. In the proposed framework, agent developers have access to the API (Application Program Interface) for Law Governed which provides a basic agent communication component and other facilities. They can use this API to create their agents and interact with the law governed mechanism. Law developers can extend our framework to adapt it to their needs. Each message format must have a message pattern recognizer associated with it. Declaration of message patterns is necessary for protocol specification. Our framework provides a prolog like message pattern. It means that agents can interact with each other using prolog as the content language. Another framework’s hotspot is the communication mechanism. Currently, it is offered a default implementation for the communication this hot-spot based on the Jade platform [17]. In this way, the Jade platform is used just as a message transport layer among the agents. However, developers are also free to use any other communication infrastructure, implementing the communication interface provided by the framework. A monitoring tool provides graphical support for monitoring of laws’ execution. In this tool, it is possible to visualize all the scenes in execution, which norms and clocks are active, and also what is the current protocol execution’s state.
5
Case Study
Nowadays large airports do more than just serving as a place for airplanes landing and taking off. Aiming to increase the customer satisfaction, the fictitious airport of this case study provides an Internet based system where users can buy flight tickets. This system is based on an auction mechanism, and the airline companies placed in the airport dependencies integrate their own systems to it. The airport system should provide a good level of trust in the sense that the costumers should be protected against malicious behavior of airline companies and airline companies should be also protected against malicious users. However, the airline companies’ systems are not available to the airport development team, and therefore, they cannot blindly trust in the airline companies systems’ behavior. In this example, the whole process consists of three stages: negotiation, payment, and ticket emission. First, the customer exposes its flight preferences, such as destination and cabin type, and waits for the airline company’s bids. After that, the costumer chooses one of the bids. The second stage starts when the negotiation stage ends. The costumer should follow the required procedures and
Governing Open Multi-Agent Systems
11
carry the payment out. In the last stage, the airline company emits an electronic flight ticket to the costumer. 5.1
Applying the Conceptual Model
According to the scenario description, we can identify two participant roles: customer and airline company. During the negotiation, customers may get irritated if the airline companies take too long for providing their bids. In that way, we propose that 10 seconds is the maximum time for airline companies proposing their bids. Furthermore, if an airline company is negotiating a flight ticket with a customer, then it cannot sell the same ticket for another costumer. On the other hand, the airline companies can also have financial losses in cases where the user takes too long to choose among the bids, so, the user should also have a time-out to decide, for instance, 5 minutes. In this case study, we have a negotiation phase, a payment phase and we conclude the process with a ticket emission phase. Each phase corresponds to a scene. Each scene is analyzed and designed. We have made two simplifications on the problem. First, it is described only part of the negotiation scene, and second, it is considered the negotiation process between one agent and one airline company. The scene begins when a costumer sends a request of flight ticket proposal to the airline company through a request message. In this point, the airline company has to answer within 10 seconds; otherwise, the costumer can send a cancel message and leaves the scene. Once the airline company accepted the request on time, the customer has 5 minutes to decide about, and to send an accept-proposal or a reject-proposal message. After that, the airline company informs if the sale was well succeed or if some problem happened. That sequence of interaction is the basis of the protocol element. We specify this protocol using declarative law language (Listing 1.1). In the line 1, we specify the organization element. The line 2 delimits the beginning of the negotiation scene specification. This scene contains a protocol specification (lines 07 to 21). This protocol contains three states (lines 08 to 12) and two transitions (lines 13 to 20). The transition t1 links the states s0 and s1 and it is activated by the request message, specified in the line 4. When this transition is activated, the clock specified in the line 23 is also activated. This occurs because the activation attribute in the line 25 has a reference to the transition t1. This clock addresses the non-functional requirement response-time-1. It counts 10 seconds and fires a clock-tick event. The permission cancel-request (line 30) has specified in its activation condition (line 32) that clock-ticks events originated by the clock The response-time-1 activate this transition. The transition t2 (line 15) links the state s1 to the state s3, and it is activated by the cancel message - m2 (line 5). However, the norm cancelrequest must be active for enabling this transition (line 17). Although we do not specify the whole scene, the remaining specification is similar to the provided specification.
12
Rodrigo Paes et al.
The execution of the laws is monitored and this monitoring helps to achieve a better understanding of the system. For instance, in this case study, the monitoring can identify that many customers take more than the specified 5 minutes to decide about the bid. This might indicate that the initial time is not sufficient or that the customers are having difficulties to use the system. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37