web-based simulation of agent behaviors - CiteSeerX

6 downloads 0 Views 134KB Size Report
implemented in the Java language in order to be ..... applet using the Java language [Arnold and Gosling ... current state of Java applets the only way for a.
WEB-BASED SIMULATION OF AGENT BEHAVIORS André M. C. Campos, David R. C. Hill Blaise Pascal University ISIMA (Computer Science & Modeling Institute) Campus des Cézeaux BP 125, Aubière Cedex, France Tel: (+33) 4.73.40.50.00 - Fax: (+33) 4.73.40.50.01 e-mail: [email protected], [email protected] URL: http://www.isima.fr/ecosim/ KEYWORDS Web-based Simulation, Multi-Agent System, Visual Interactive Simulation, Ecological modeling, Fuzzy sets. ABSTRACT In this paper we present a web-based simulation of autonomous software agents enabling the user to change interactively their behavior. The simulation is implemented in the Java language in order to be incorporated into Web pages and run remotely. The main goal of this work is to study web-based exploration environments, allowing on-line changes on the behavior model of a multi-agent simulation. This technique is particularly interesting when domain expert end-users are not locally present. The simulation application presented is a simple prey-predator problem example where the behavior of agents is based on the pursuit incertitude, the latter being modeled with fuzzy sets.

INTRODUCTION The use of visual-interactive features in a simulation is well suited for users exploring different situations in a virtual environment by changing the model dynamically. This approach, also known as VIS - Visual Interactive Simulation [Hurrion 76] [Bell and O’Keefe 87], can play an active role in the simulation validation process. Indeed, confrontation validation between the domain expert knowledge and the simulated system is facilitated by the VIS iterative and interactive approach. The well known risk of such an approach for stochastic simulations, is to draw conclusions from too few visual samples ; therefore this work states clearly that it does not deal with VIS as a technique aiming at the production of statistical results, but rather as an exploration tool [Hill et al. 96]. In order to enhance the validation process, we propose the use of the Web as a tool enabling distributed and distant interactions and visualizations, as well as facilitating communications between domain experts and model builders. Indeed, few or no interactions between the latter is a common error often leading to simulation failure.

Web browser features can provide steering VIS environments, thus giving for the end-user direct control on the computational model at runtime by various interactive resources (some good examples are cited in [Fishwick 96]). In the first part of this paper we discuss the agent paradigm used to develop the simulation model as well as the design approach used to specify it. Next, we expose the behavior model, briefly presenting how it was achieved using the theory of fuzzy sets [Zadeh 65]. Then, the user interface is presented relying on VIS features to enhance the validation process. Finally, we discuss about the characteristics and limitations of web-based simulation implemented with the Java language.

SIMULATION MODEL In this paper, the application domain is ecology and we retained the Agent-based simulation idea, where it is possible to represent an environmental phenomena as the consequence of interactions of sets of parallel agents [Drogoul and Ferber 94]. Each agent is defined like an active object with its own operational autonomy and social behaviour [Gasser and Briot 92][Shoham 93][Wooldrige and Jennings 95] [Bousquet et al. 96] [Guessoum 97]. In this paradigm, known as Multi-Agent System - MAS, agents encapsulate and perform their individual tasks locally, but influence the global behavior of the simulated system. In fact, moving virtual entities, changing their behavior and modifying the environment state can easily be achieved if all simulation data and behavior rules are separated into entities rather than synthesized in aggregated variables. The simulation presented in this paper was developed relying on the characteristics described above, encapsulating the behavior model into autonomous objects with their internal rules. In order to present how these autonomous objects (i.e agents) are integrated into the simulation model, we provide a UML class diagram [Booch et al. 97] [Fowler 97]

in Figure 1. It shows the relationships between the individual entities (Entity) of the model, the environment object (World) which is simulated and the simulation controller (Simulator). Those three components need others to work together, like a synchronization kernel (Synchro. Kernel) that uses the time (Time) to sort and schedule environmental events (Events) which are found in a data list (Event List). We also model entities that are just passive objects in the world (Passive Entity), entities that perform actions (Active Entity) by their behavioral rules (Rule), and entities (Agent) that have a memory (Memory) and can interact with their group (Group). Time

uses

Synchro. Kernel

sort

*

Event List

create event

Simulator

Event

modify

*

World

Entity

*

* Rule

Memory

*

Active Entity

Agent

Passive Entity

*

Group

Figure 1 - Proposed agent-based simulation framework

We can note from the UML diagram in Figure 1, that active entities have no memory, neither group association, being known by this way as tropic agents, described in [Ferber 95]. Their actions only depend on the environment and localization state at a fixed time. An agent is then an active entity type that differs by its capacity to save situations in its memory and to implement complex individual and social interactions. In addition to the classic properties of agents, like autonomy, social ability, reactivity and pro-activeness, some researchers consider that an agent is either conceptualized or implemented using characteristics usually applied to human-like entities [Bates 94][Shoham 93]. A way of giving agents human-like attributes in a computational system is to take into account the uncertainty of theirs beliefs. In this case, the use of the theory of fuzzy sets is appropriate to model the agent intentional system in accordance with the environment possibilities. In the presented simulation, preys and predators are created as agent entities in the same limited

world. The simulation goals consists in verifying and analyzing situations where a predator believes that it can catch a prey (involving an attack), and also situations where a prey believes that it can be caught (involving an escape attempt). Each prey has its own behavior but also learns about the predators with the capture of other preys. The next section provides the design underlines of this behavior model.

BEHAVIORAL MODEL The agent concept is becoming a useful tool to build virtual worlds, especially for entity-based ecosystem simulations which must represent actions of the entities in a natural way. With the purpose to represent such natural actions in computational entities, Bates introduces the believable agent concept [Bates 94]. The latter defines an agent able to provide the illusion of life like a believable character animation does. A key component of his agents is the emotion (and its representation), which plays an important role to make believable a simulated world. Our behavioral model uses Bates idea focusing the simulation on the emotion state of entities, but not just to provide believable characters. We are also interested in modeling realistic events and interactions which the agent emotions can create. Anyway, the behavior model created for this predator-prey simulation, does not reflect a real ecosystem, but it will focus on the importance of emotional rules in ecosystem simulations. In order to create an emotional action, we use the fuzzy logic in a rule-based approach. Fuzzy logic has proved be applicable to a wide range of practical problems [Maiers and Sherif 85], being basically a multi-valued logic that allows intermediate values to be defined between conventional evaluations like yes/no or true/false. Abstract notions based in human-like language like “far” or “near” can then be formulated and processed computationally. In this way an attempt is made to apply more “human-like” characteristics to simulated entities. In our case, instead of making entity beliefs like crisp truths, we construct them in fuzzy terms reflecting the environment possibilities [Klir 97]. The entity action depends on a decision made over this set by using the entity emotion to validate the pertinence degree of the belief. It is easy to illustrate the applicability of fuzzy beliefs to entity-based ecosystem simulations. For instance, in a chaotic environment it is not possible to say if a predator can catch a defined prey until knowing every environmental data (in accordance with the chaos theory). Furthermore, this imprecision

must also be reflected in an ecosystem simulation. Thus, entity actions only depends on the result of its empirical validations over fuzzy truths in the environment. These empirical issues in our approach are a reflect of the emotional states like fear, security (safety) and confidence. The present behavior model tries to express the contribution of these emotions for the dynamics of a simple prey-predator environment. The simulation dynamics is turned on when, for example, the predator believes that it can catch a prey, consequently involving an attack. Therefore, there are no precise distances at which the predator can capture a defined prey. Figure 2 exemplify this imprecision showing the crisp set of prey distances where the predator is sure to catch them: [0;D], the tolerance interval that provide just a vague idea: ]D;DUpper], and the last subset in which it believes that it is not possible to capture the preys: ]DUpper;∞[. The same dynamic occurs with prey beliefs, but involving an escape attempt.

0

DUpper

D 1 = catch

???



0 = escape

Figure 2 - Fuzzy belief of the predator concerning its ability to catch preys according to the distance between themselves

By this way, we model the key concepts of the prey and predator behaviours by the linguistic variable distance, which has the term set T(distance) = {far, near}. Therefore, to be near or far of something is an imprecise notion with no value delimiting it. Its interval values are depending on entity attributes like physical resistance, current velocity and direction, acceleration power and energy. A membership function is then requested to express an approximation and consequently define a fuzzy set for each different entity. For simulation performance reasons, we choose linear membership functions for both near and far values, expressed by:  0  1 U if x ≤ n if x ≤ f L x− f L x − n U near( x) =  if n < x ≤ n ; far( x) =  if f L < x ≤ f U L n n f f − −  0 otherwise  otherwise   1 where:

x = the distance between prey and predator; n, nU, f et f L are calculated by the resistance, velocity, direction, acceleration power and energy of each entity.

The behaviour rules expressing the “catch” and “escape” statements for predators and preys are then described in far and near terms: pred_catch(prey) ⇐near(prey) ∧ ¬far(prey) prey_escape(pred)⇐near(pred) ∧ ¬far(pred)

The result set of each one of these statements is a union between the near set and the far negation, illustrated in Figure 3. 1 0

f

n

fL

nU

Figure 3 - Membership function resulting of fuzzy operations over the near and far variables

The defuzzification process is made according to the emotional attribute of the entity. In other words, when a fuzzy set is defined for a prey, it evaluates the degree of possible capture by the predator according to its real distance from the latter. Next, this degree is judged by its emotional attributes resulting finally in an action to make. In the prey case, the emotion attribute is associated with their fear for the predator, which means that a fearful prey will try to escape with a minor signal of possible capture. In computational terms, this is expressed by the statement: escape ⇐ fear_degree > 1 - capture_degree where fear and capture degrees are in the [0;1] interval.

In the predator case, the emotion attribute is linked to its confidence in itself, which means that a high confident predator will attack a prey with a minor signal of possible capture. In computational terms: attack ⇐ confidence_degree ≥ capture_degree where confidence and capture degrees are also in the [0;1] interval.

Furthermore, an ecosystem “equilibrium” can be reached by modifying the emotion values of each entity with their respective success or failures. For predators, success and failure are obviously related with the number of captured preys and with the number of attacks without success. For preys, success and failure are attributes of theirs social groups. A prey which is captured influences negatively the fear degree of all preys in its group, and the success of its escape attempt influences the group positively.

INTERFACE MODEL With the development of Graphical User Interfaces (GUI), the study of complex dynamic systems has been intensively developed in interactive simulation environments [Hill 96]. Rather than only providing tracking features, the user interface can also give to the user tools to change simulation parameters dynamically [Wagner et al. 96]. These

exploratory visual simulations work like virtual laboratories immediately answering user inputs by changing the model state. Agent-based Simulation Model Visual-Interactive Model User input/output

configuration settings

Browser Interface Components

Simulator simulation events

environment and entity data

World

world components, to modify entity positions and attribute values. All the entity attributes intrinsic of the behaviour model are presented with the graphical interface and consequently theirs values can be changed by the user. The values are related to physical attributes like current velocity, acceleration, energy, resistance, localisation and direction, as well to emotion attributes like confidence.

Figure 4 - Abstract interactive architecture in a web-based simulation.

The graphical user interface specified in the application try to reflect the behavior model presented above, permitting the end-user to experience virtual changes in its environment. An attempt is made so that domain expert users could remotely visualize the dynamics of agent actions and consequently understand the underlines of the behavior model. The high-level abstract model of the application is presented in Figure 4, showing the relationship between the user interface, defined by browser components, and the agent-based simulation model. The latter is specified with the UML object model present in Figure 1. In this approach, the simulation system is composed of three main group of classes and objects : a simulator group, to control and schedule parallel events in a discrete event simulation approach ; a user interface group, composed by browser interface components to provide user input/outputs ; and a world group. The latter represent the environment to simulate, i.e. the system structure which possess all the entities with their respective spatial localization. The simulator and world composes together a set of classes and objects, with theirs respective relationships, called Agent-based Simulation Model, and which encapsulates the behavioral model described in the previous section. The second model gives visual-interactive features to the simulation model, and we call it the Visual-Interactive Model. This model works like a supervisor, getting the current simulation state to generate user outputs and changing the current simulation state by user inputs. The user can interact with the simulator components, by setting their configuration (like the time step used in clock-driven simulation kernel for instance). The user can also interact with the world components, thus changing environment attributes. Figure 5 shows a screen dump of the simulation where it is possible for the user to interact with the

Figure 5 - Screen dump of the simulation.

The chart of the membership function of the current entity selected is also presented in the interface. This chart provides the user a feedback of the entity beliefs relying their internal states. This is made by showing a graphical representation of the escape statement described in the previous section (or attack statement according to the type of entity selected). More than only providing animation feedback about the dynamics of simulation, the visualization area is also a complex widget providing drag-and-drop features to modify entity positions and double-click features to create new entity instances. Then, the end-user can easily compose new scenarios, create entities and change their internal attribute values (for exploration only).

IMPLEMENTATION ISSUES AND LIMITATIONS The simulation presented was implemented as an applet using the Java language [Arnold and Gosling 96] [Zeigler 97] allowing its remote execution on the

Web. Thus, domain expert end-users can test and experiment the model with their Web browsers although they are usually not located in the same office or laboratory. The Java language support of multiples threads, allowing object operations to be carried out in parallel, facilitates the implementation of processoriented discrete event simulations [McNab and Howell 96] ; however it could have been done in C++ [Watson 96]. Our approach uses a simulation kernel in order to provide and to assign threads of control, and to schedule simulation events (Figure 6). The small number of entities running in this application example justifies the use of threads as a better conceptual model. A larger number of entities would require an optimized control of processes, particularly since the Java runtime system uses the underlying operating system (OS) for generic thread support or a software emulation if the OS does not support threads. Therefore, for real case studies where computing speed is more important than distant interactions between end-users and developers, Java is not yet the solution. public void run () { while (true) { // simulation is paused by the user? if (!_paused) { // process the last event created // and return if there is nothing // more in the event list (false) if (World.processEvent()==false) { // update the user interface _interface.actualise(); // activate randomly all the // active entities and agents World.dispatchEvents(); } } try // ... delay ... { sleep (50); } catch (InterruptedException e) {} } }

Figure 6 - Excerpt of code from the simulation kernel.

Like any other applet, the application presented in this paper has some limitations due to security restrictions imposed by the virtual machine running in the client browser. In this way, there are two major restrictions in web-based simulations which differ from stand-alone systems. The first one is the inability to directly save or load simulation log files on the client file system. In other words, the current simulation state can not be directly frozen in order to save particular cases

and/or attribute values, into a file to be worked on later. In order to save/load a simulation state, a Web-based application have to use a text entry (e.g. the HTML forms) to put or to get textual data by the “copy and paste” features of its windowing environment. The textual information can then be saved or loaded by copying or pasting for any ordinary text editor. Obviously, this procedure makes a Web-based simulation harder to use than local simulation programs when we have to reuse user-defined simulation states. The second restriction deals with the incapacity for end-users to customize behavior rules by programming them with configuration languages (e.g. Tcl [Welche 95]). This feature is desired for end-users which want to do more specific and precise changes in their “virtual laboratory”. In fact, the ability to modify the intrinsic rules of a simulation is a low-level user interaction model which is often more powerful than the interactive graphical language implemented in the interface. Small portions of the behavior rule code defined by the user could be suitable in a simulation system when the behavior model itself is being validated. In this case, rather than only making experience with attributes values, the user can also make experience with logical statements. Therefore, the end-user needs to be experienced with high-level declarative programming languages. Unfortunately, with the current state of Java applets the only way for a web-based simulation to provide this feature is by implementing our own language interpreter, which could be harder than implementing the simulation itself.

CONCLUSION We have presented an experimental tool in order to study Web-based simulation in Java using its visual and interactive features. The simulation application is a simple example of multi-agents ecosystem with no compromise to any real and concrete environmental case. Its goals only consists in providing an exploration tool able to change dynamically the agent behaviors at run-time. Agent behaviors are modeled using fuzzy sets to implement emotional reactions. This gives more “human-like” characteristics to software agents, trying in this way to provide the illusion of life during the implemented simulation of predator/preys. The application presented proved that web-based simulations can be useful tools for distant interactions between domain expert end-users and simulation developers. This is then more relevant for

the confrontation validation where the iterative approach linked to web-based VIS facilitates the exploration of the behavior model of software agents. Another advantage obtained by this kind of simulation is due to the promising portability of the Java language. This means that there should be no restrictions about the executable binary, and consequently the platforms of end-users and developers do not need to be the same. If we focus on drawbacks, there are some restrictions intrinsic to the use of Java applets in a Web-based simulation. The two major restrictions are the inaccessibility of the client user files and the incapacity for end-users to customize behavior rules by configuration languages. Furthermore, if the simulation performance needs to be evaluated according to the execution time, the Java applet demonstrated to be inappropriate. To conclude, we want to highlight the interface choices and perspectives. All the elements of the user interface in the prey-predator simulation was designed in a 2D GUI (Graphical User Interface). Others interfaces approaches, using 3D views and multimedia resources, can be suited to enrich the simulation credibility. These news approaches are currently been studied using the VRML/Java technology.

ACKNOWLEDGEMENTS The first author would like to acknowledge the CAPES (Brazilian Research Council) for his doctoral fellowship.

REFERENCES [Arnold and Gosling 96] Arnold K., Gosling J., The Java Programming Language, Addison-Wesley, 1996. [Bates 94] Bates J., The Role of Emotion in Believable Agents, Communications of the ACM, vol.37, n.7, pp.122-125, 1994. [Bell and O’Keefe 87] Bell P.C., O’Keefe R.M., Visual Interactive Simulation : History, recent developments and major issues, in Simulation, vol.49, n.3, pp.109-116, 1987. [Booch et al. 97] Booch G., Rumbaugh J., Jacobson I., Unified Modeling Language User Guide, AddisonWesley Longman, to be published, 1997. [Bousquet et al. 96] Bousquet F., Duthoit Y., Proton H., Weber J., Tragedy of the Commons, Game Theory and Spatial Simulation of Complex Systems, in Ecological Economics, pp.1-8, may, 1996. [Drogoul and Ferber 94] Drogoul A., Ferber J., MultiAgent Simulation as a Tool for Studying Emergent Processes in Societies, in Simulation Societies, the

Computer Simulation of Social Phenomena, Gilbert N. and Doran J. (ed.) UCL Press, 1994. [Ferber 95] Ferber J., Les Systèmes Multi-Agents - vers une intelligence collective, InterEditions, Paris, 1995. [Fishwick 96] Fishwick P.A., Web-based Simulation: Some Personal Observations, in Winter Simulation Conference, San Diego, CA, pp.772-779, Dec. 1996. [Fowler 97] Fowler M., Scott K., UML Distilled, AddisonWesley, Longman, 1997. [Gasser and Briot 92] Gasser L., Briot J.P., Object-Based Concurrent Programming and DAI, in Avouris N.M., Gasser L. (eds.) Distributed Artificial Intelligence: Theory and Praxis. Kluwer Academic Press, Dordrecht, pp.81-108, 1992. [Guessoum 97] Guessoum Z., A Hybrid Agent Model : Reactive and Cognitive behavior, IEEE, ISADS’97, Berlin April 10-11, 1997. [Hill 96] Hill D., Object-Oriented Analysis and Simulation, Addison-Wesley, 1996. [Hill et al. 96] Hill D., Mazel C., Coquillard P., Integrating V&V in the Object-Oriented life cycle of ecological modelling simulation projects, Proceedings of the 8th. European Simulation Symposium : Simulation in Industry (ESS96), Italy, pp.21-25, 1996. [Hurrion 76] Hurrion R.D., The Design, Use and Required Facilities of an Interactive Visual Computer Simulation Language to Explore Production Planning Problem, University of London, PhD Thesis, 1976. [Klir 97] Klir G.J., Clair St., Fuzzy Set Theory Foundations & Applications, Prentice-Hall, 1997. [Maiers and Sherif 85] Maiers J., Sherif Y.S., Applications of Fuzzy Set Theory, IEEE Transactions on Systems, Man and Cybernetics, vol.15, n.1, pp.175-189, 1985. [McNab and Howell 96] McNab R., Howell F.W., Using Java for Discrete Event Simulation, proceedings of the 20th UK Computer and Telecommunication Performance Engineering Workshop (UKPEW), Univ. of Edinburgh, pp.219-228, 1996. [Shoham 93] Shoham Y., Agent-Oriented Programming, in Artificial Intelligence, vol.60, no.1, pp.51-92, 1993. [Wagner et al. 96] Wagner P., Freitas C., Wagner F., A New Paradigm for Visual Interactive Modelling and Simulation, proceedings of the 8th European Simulation Symposium, Genoa, Italy, pp.142-145, 1996. [Watson 96] Watson M. AI Agents in Virtual Reality Worlds : programming intelligent VR in C++, Wiley, 1996 [Welche 95] Welche B.B., Pratical Programming in Tcl and Tk, Prentice-Hall, 1995. [Wooldrige and Jennings 95] Wooldrige M., Jennings N.R., Intelligent Agents : Theory and Practice, in Knowledge Engineering Review, 1995. [Zadeh 65] Zadeh L.A., Fuzzy Sets, Information and Control, vol.8, pp.338-353, 1965. [Zeigler 97] Zeigler B.P., Object & Systems: Principled Design with Java/C++ Implementation, Springer Verlag, New York., 1997.

Suggest Documents