Agents and Petri Nets 1 Introduction - CiteSeerX

4 downloads 0 Views 116KB Size Report
Agents and Petri Nets. Tom Holvoet. Department of Computer Science, K.U.Leuven,. Celestijnenlaan 200A. B-3001 Leuven Belgium e-mail: Tom.
Agents and Petri Nets Tom Holvoet Department of Computer Science, K.U.Leuven, Celestijnenlaan 200A B-3001 Leuven Belgium e-mail: [email protected] Abstract

Agents are abstractions for real-world autonomous and cooperating entities. Agent-oriented software development is the most promising approach for the development of complex systems. On the other hand, Petri nets are a good formalism for describing concurrency, synchronisation and causality. After presenting the notion of agents, we present some thoughts on using nets in agent-oriented development of dynamic and exible software systems. The cover picture shows the model of an imaginary system according to our ideas about combining agents and nets.

1 Introduction

Several research disciplines have been searching for an answer to the same fundamental question: \How should we understand the real-world ?" This is a wide-ranging and very intriguing question. For psychologists, an adequate answer to this question would help in describing behaviour of humans in several contexts, such as children in a family situation, adult relationships, religious behaviour, and so on. In the domain of arti cial intelligence (AI), constructing intelligent systems requires a good understanding of real-world entities and their interaction in order to simulate their intelligent behaviour. Software engineering has certainly been going through a crisis, proving unable to cope with large and complex systems. This is mainly due to the software development methods, which are based on arti cial descriptions of systems. Methods that stand closer to the real-world description of the system would certainly help in modelling, implementing and maintaining complex systems. The most promising answer (for all of these three domains) to the question of understanding the real-world is based on the concept of agents. Agents were rst proposed in the domain of psychology. This should not come as a surprise, since psychologists have been struggling with this question for ages. In [Min85], M. Minsky masterly elaborates on the idea of agents by providing answers to hundreds of questions related to the topic \How does the mind work ?", which is an essential psychological question. Slowly, the AI community recognised that it very well could use the same model, in stead of leaning on highly arti cial and purely mathematical real-world descriptions. Agents are assigned properties similar to real-world entities, such as capabilities of surviving and maintaining themselves ([Ste95]), beliefs, obligations ([Sho93]), and so on. And nally, the domain of software engineering is also evolving towards the same vision. Objectbased and object-oriented methodologies are a major step in this direction. These aim at modelling systems by identifying application entities, objects, and describing their interdependencies (such as type-relations, interaction patterns, and so on). Next, concurrent object-orientation has been proposed, where objects are recognised as being intrinsically concurrent entities rather than merely providers of a set of services to other objects. Agent-orientation goes even further, by emphasising  Research Assistant

of the Belgian Fund for Scienti c Research

1

the self-containment and the autonomy of agents (called software agents), as well as their cooperative behaviour, often requiring some form of arti cial intelligence. Agent-orientation is very promising, especially considering the current and future computer infrastructures, consisting of thousands of world-wide distributed computer networks, containing a massive and distributed community of software components. A software system in such an environment is considered highly dynamical and subject to frequent changes (in requirements, organisation, and so on). We believe that agents are the right concept for modelling and implementing complex software systems. On the other hand, being convinced that Petri nets make a good formalism for modelling concurrency, we ask ourselves: \How can nets contribute to the system description in a context of extremely dynamic and exible systems ?"

2 Agents

In psychology ([Min85]), two di erent terms are being proposed. Agents are individual and selfcontained entities, being intrinsically non-intelligent. They mainly perform a task, possibly using other agents, but without understanding their tasks. Agencies, on the other hand, are agents that have the knowledge on how to perform a task. An example from [Min85] may clarify the di erence. One can regard a steering wheel as an agency for changing the car's direction: it seems to know how to make the car turn when you turn the wheel, and you don't care how it works. However, when something goes wrong with the steering, you want to understand what is happening. In that case, it is better to see the steering wheel as just one non-intelligent agent, merely performing its task by turning a shaft that turns a gear to pull a rod that shifts the axle of the wheel. Basically, agents are intrinsically non-intelligent entities executing a set of actions, while agencies appear intelligent by performing some particular task \on another's behalf", knowing how to accomplish it. Software agents are pieces of software that perform a task, possibly by communicating and interacting with other agents. Intelligence is not locked out. Additional properties are ascribed to software agents, such as mobility in a distributed environment (software agents can wander through a network if required for accomplishing their tasks). Intelligent agents are agents whose behaviour depends on the behaviour of other agents. In that case, one talks of a society of agents, similar to a real-world society of autonomously and cooperating entities: people. Agents in arti cial intelligence are entities that represent an intelligent component of a system. Intelligence is accomplished in two ways: through traditional \algorithms", which may change the activity of the agent (e.g. based on a learning process), and, similar to software agents, by having agent behaviour depend on the behaviour of other agents. Re ecting on the above descriptions, we remark that the di erent concepts of agents coincide, except for the intelligence aspect. This brings us to an even more basic question than the one mentioned before: \What is intelligence ?" Something that is called intelligence for AI agents, can be disposed of by considering the agent's intelligent behaviour as merely executing a particular algorithm. Intelligent software agents would be called non-intelligent agents in psychology, since they have no awareness of their task, they merely perform some algorithm that, depending on other agents, possibly changes its behaviour. Maybe provokingly, we would say that a software system is called intelligent if an outsider to the system does not expect the system to perform some task or to react accordingly in particular situations. In the early years of calculators, people called these little machines intelligent. One did not expect a cold and lifeless machine to add, subtract and multiply numbers. Nowadays, a robotic system that can keep a vertical stick resting on a small surface, into balance would be called intelligent. It is true that it needs a very complex algorithm for achieving its goal, involving sensors, engine control and fast communication medium, but why is it called intelligent ? This is a non-trivial observation. For now, we will suspend considering intelligence, and merely view agents as autonomous and cooperating entities. 2

3 Nets and Agents

Petri nets are undoubtedly a good formalism for modelling concurrency. They are simple to learn and understand, powerful in expressivity, they have a visual representation which helps in understanding the model, and they have a substantial theoretical baggage. However, they have two major drawbacks. First, large systems result in huge nets, even when using high-level Petri nets. Similar to the principles of step-wise re nement for structured programming, net researchers proposed hierarchical net construction techniques, but these do not resolve all problems1. Second, nets are very static. Complex and large distributed applications require exibility, extendibility, they are dynamic. Since the concept of agents proves to be very promising for future software engineering, and we want to bene t from the advantages of nets, we try to identify possible contributions of nets to agents. Our approach is based on a few thoughts. Having one net modelling an entire system is advantageous for performing (structural and behavioural) analysis, and it o ers a mechanism to overview, to control the entire system. However, the idea of one overall and static description of a system is not endurable. Second, we argue that all kinds of nets (from basic C/E-nets to Pr/T-nets and CPNs) have particular situations where they may be preferred over others. A particular kind of net may be chosen for its available research, or for its expressive power. We propose to model the behaviour of individual agents by separate nets in stead of modelling the entire system. One advantage that this entails immediately is what we call the multi-model principle [HV95]. This means that di erent agents may have di erent kinds of nets as their behaviour description. Such a net describes the agent's internal concurrent behaviour (multiple concurrency activities may be performed within one agent). Furthermore, agents can model the coordination of a set of cooperating agents, describing their synchronisation and causality relations. Let us present an example (see Figure 1). Consider the classical dining philosopher problem. Philosophers themselves are modelled as autonomous agents, that repeatedly think and eat. The net description (which is a simple P/T-net) for a philosopher in Figure 1 is rather ne-grain. It allows a philosopher to continue chewing on the food in his(her) mouth while grabbing some fresh food on the forks, or even while thinking. Another agent, DiningPhilosopherTableSetting, models the philosophers' synchronisation, represented by a Pr/T-net. Each token corresponding to a philosopher in this Pr/T-net is actually a reference to a philosopher agent. If one would use one net for the entire system, this view of ne-grain concurrent behaviour of philosophers would result in one huge net. Moreover, on a higher level of abstraction, when modelling the philosophers' coordination, we are not interested in the philosophers' internal concurrent behaviour (such as concurrently chewing and getting some fresh food on their forks). Another example is the consumer/producer problem (see Figure 2), consisting of a consumer and a producer agent (both described by a separate C/E-net). Here, a separate agent for modelling their synchronisation would not be meaningful as a real-world entity. At this time, we have only described the individual behaviour of agents for our examples. We have mentioned, but not yet speci ed their cooperation and synchronisation. In concreto, for the rst example, we need to specify that a philosopher agent cannot start eating (i.e. re its start-eating transition) without the coordination agent ring its eat transition with the variable x bound to this philosopher. For the other example, the inter-agent synchronisation comes down to a simple transition synchronisation. These inter-agents synchronisation speci cations in general cannot be described by traditional composition operations, such as transition merging (as overviewed in [BC92]). The multi-model principle requires new mechanisms for specifying relationships between di erent net models, such as multi-model synchronisation. Multi-model synchronisation speci cations are a mechanism for interconnecting di erent agents. In this paper, multi-model synchronisation of transitions is depicted by a double dashed line. Depending on the kinds of net the lines interconnect, annotations may be provided. Figure 3 represents the nal model of the dining philosopher system. The multi-model synchronisation ensures that the coor1

in the same sense as structured programming techniques cannot resolve all software engineering problems.

3

DiningPhilosopherTableSetting agent

0,1,2,...

0,1,2,...

{x}

{x,y}

y=(x+1)mod n

eat

{x}

{x}

{x,y} {x}

y=(x+1)mod n

done_eating

DiningPhilosopher agent 0 mouth-empty pick-left-fork start-eating

prepare

grab-food

put-in-mouth swallow

pick-right-fork

think finish-eating

continue chew

enough put-down-left-fork forks-empty put-down-right-fork DiningPhilosopher agent 1

mouth-empty pick-left-fork start-eating

prepare

grab-food

put-in-mouth swallow

pick-right-fork

think finish-eating

continue chew

enough put-down-left-fork forks-empty put-down-right-fork DiningPhilosopher agent 2

mouth-empty pick-left-fork start-eating

prepare

grab-food

put-in-mouth swallow

pick-right-fork

think finish-eating

continue chew

enough put-down-left-fork forks-empty put-down-right-fork

Figure 1: Multi-model system description: DiningPhilosopherTableSetting agents coordinate DiningPhilosopher agents Producer

produce

Consumer

send

get-item

consume

Figure 2: Consumer and Producer agent description 4

DiningPhilosopherTableSetting agent

0,1,2,...

0,1,2,...

{x,y}

{x}

y=(x+1)mod n

eat

{x} {x,y}

{x}

{x} done_eating

y=(x+1)mod n

x

x

DiningPhilosopher agent mouth-empty pick-left-fork

start-eating

prepare

grab-food

put-in-mouth swallow

pick-right-fork

think finish-eating

continue chew

enough put-down-left-fork forks-empty put-down-right-fork

Figure 3: Multi-model synchronisation for the Philosopher and DiningPhilosopherTableSetting agents. dination agent coordinates the philosophers in a consistent way. Figure 2 also contains the additional speci cation, modelling and realizing the inter-agent synchronisation.

4 Conclusion

In this paper, we wanted to present a few thoughts:   

agents and agent-oriented programming appear to o er the right abstractions for modelling and realising complex and exible software systems; this is mainly because agents are good abstractions for describing the real-world; using one net for describing a complex and exible system is not endurable; we should try to nd the right place for nets in a multi-agent environment.

Nets are a good formalism for modelling concurrency. In a highly concurrent environment of autonomous agents, nets should surely be able to contribute to the formal description of agents and their coordination. We introduced one possible (but certainly still partial) solution, based on the multi-model principle. The cover picture is a purely imaginary system model. Its only purpose is to show a possible structure and organisation of agents, whose net speci cations are interrelated by multi-model synchronisations.

References

[BC92] L. Bernardinello and F. De Cindio. A Survey of Basic Net Models and Modular Net Classes. In Advances in Petri Nets '92, pages 304{351, 1992. 5

[HV95] T. Holvoet and P. Verbaeten. PN-TOX: a Paradigm and Development Environment for Object Concurrency Speci cations. In Proceedings of the Workshop on Object-Oriented Programming and Models of Concurrency, ICATPN'95, Turin, Italy, 1995. To appear. [Min85] M. Minsky. The Society of Mind. Syman and Schuster, New York, 1985. [Sho93] Y. Shoham. Agent-Oriented Programming. Arti cial Intelligence, (60):51{92, 1993. [Ste95] L. Steels. When are robots intelligent autonomous agents? Journal of Robotics and Autonomous Systems, 1995. In press.

6