How do I know the crypto trading rates

Final report PG 467 AbSIntH - Agent-based simulation of interactive university scenarios


1 final report PG 467 AbSIntH - agent-based simulation of interactive university scenarios Klaus Friedrichs Philip Geismann Patrick Lenger Tycho Moenck's Christian Mosblech Bastian Nau Jan Salmen Marc Schlipsing Christian Swede Alessandro Selvaggio Nuhad Shaabani Tobias Wagner

2 Contents 1 Introduction Foreword Structure of the final report Motivation Creation of the PG Teamwork and organization Acquisition of knowledge and experience Communication Extreme programming Time schedule Description of requirements Minimum goal Sociological requirements The sociological theory of action Sociological requirements for the agent and the environment Sociological requirements for the multi-agent system Requirements modeling of agent and Environment data model of agent and environment Requirements modeling of the multi-agent system Description of the algorithm of the multi-agent system Procedure and concept development Procedure for the implementation of agent and environment Procedure for the implementation of the multi-agent system Tools used

3 4 Draft environment Class description Basic procedure Negotiation Agent Agent in negotiation Character type and value expectation table The rule base GUI draft correction / problems Structure of resources The memory Application Test with Robocode Integration in Robocode Results of the contest scenarios Producer / consumer scenario The university scenario Conclusion Conclusion Cooperation with the sociologist Outlook A Seminar and tutorial phase 83 A.1 Seminars 1st semester A.2 Seminars 2nd semester A.2.1 Innovation Networks - A Simulation Approach A.2.2 The GeoGraph 3D Computational Laboratory A.2.3 Critical Incident Management A.2.4 Reciprocity, Normative Reputation , and the Development of Mutual Obligation in Gift-Giving Societies A.2.5 Simulating Norms, Social Inequality, and Functional Change in Artificial Societies A.2.6 DIAGAL: Commitment-Based Dialogues between Agents

4 A.2.7 Design Versus Cognition A.2.8 Group Reputation Supports Beneficent Norms A.2.9 VIR-POX: An Agent-Based Analysis of Smallpox Preparedness and Response Policy A.2.10 An Individual-Based Modeling Approach to Simulating Recreation Use in Wilderness Settings A .2.11 Introducing Emotions into the Computational Study of Social Norms A.3 Tutorials B Manual 106 B.1 Introduction B.2 GUI B.2.1 General B.2.2 Scenario B.2.3 Agents B.2.4 Character Types B.2.5 Resources B.2.6 Consequences B.2.7 Actions B.2.8 Events B.2.9 Negotiation B.3 Evaluation B.3.1 Start simulation B.3.2 Evaluation for resources B.3.3 Evaluation for actions B.3.4 Evaluation for negotiations B.3.5 Evaluation for VETs B.4 The XML Files B.4.1 General B.4.2 Layout B.4.3 Action B.4.4 Agent B.4.5 CType B.4.6 Event B.4.7 Negotiation B.4.8 Resource

5 Chapter 1 Introduction 1.1 Foreword The implementation of project groups is part of the Computer Science and Applied Computer Science courses at the University of Dortmund. Over the course of two semesters, there is the opportunity to work in a team with other students on a task that, due to its size, could not be completed by individuals or in a reasonable amount of time. This gives you the opportunity to practice teamwork and coordination as well as to work on a complex problem over a longer period of time. In the period from the 2004/2005 winter semester to the end of the 2005 summer semester, the AbSIntH (agent-based simulation of interactive university scenarios) project took place at the University of Dortmund in the computer science department (Chair 11). This final project report describes the objective, the course and the result of the project. Our special thanks go to Prof. Dr.-Ing. Hans-Paul Schwefel, under whose patronage the project took place, as well as our two supervisors Christian Lasarczyk and Mike Preuß, who were always at our side with advice and action. 1.2 Structure of the final report The structure and structure of the final report is described below. 4th

6 Chapter 1 provides an introduction to the topic and general information about this project group. Section 1.3 discusses the goals of the project group and a motivation for the project. The time required for this project (subdivided into the individual phases) is also shown. Chapter 2 now follows the requirements definition phase, which in turn is subdivided into agent / environment, sociological requirements and negotiation. Chapter 3 describes the timing of the development of the agent, the environment and the negotiation. In order to give the reader an insight into the working environment used, the tools used are also presented. Chapter 4 examines the phase of design and implementation in more detail. For this purpose, the structure of the most important sub-areas (environment, agent, negotiation, GUI) is described as well as in the class diagram class diagram. In the case of central methods, the calculation methods (e.g. the agent's decision-making based on the sociological model used) are explained and any problems during the implementation are pointed out. Chapter 5 describes problems encountered during the design and changes during the implementation phase. After the modeling and the ideas behind the implementation of the simulation have been discussed in the previous chapters, scenarios for testing the agent and the simulation are presented in Chapter 6. The first scenario is the popular game TicTacToe. This scenario is intended to test the agent and the environment implemented to date. The second scenario is a slightly more complex test of the agents. The game Robocode (see [ROBO]) is used as the environment, to which the agents send commands to control a tank. With this scenario, a comprehensive test of the agent (without negotiation) was possible. The third scenario models a university that is ultimately to be simulated with the software developed here. Expectations of the scenarios as well as the results of the simulation are described and explained. There are also screenshots that document the output behavior and a reference to reality is established. Chapter 7 summarizes the results of this project in a conclusion. The conclusion summarizes the implemented functions and results and presents possible extensions. The last chapter is followed by several appendices that provide further information on the project. Appendix A documents the seminar and tutorial phases that were held within the project group. The topics of the individual contributions are briefly listed and a reference to the project is established. Appendix B contains the manual that describes the individual functions of the GUI in more detail 5

7 describes. 1.3 Motivation As already mentioned in the foreword, the aim of the project group is to develop a social simulation to simulate a university scenario. In the following, the need for a simulation will be considered in more detail. At the beginning of the definition of the scenario, possible influencing factors of the scenario (e.g. employees, money, etc.) are identified and these are then modeled. Furthermore, output parameters such as Number of students, number of degrees, number of lectures, etc. are determined, which are an indication of good teaching or whose changes could improve the existing teaching. So you can e.g. define as the goal that as many lectures as possible should be offered, so that on the one hand the lectures are not overcrowded and on the other hand a wide range of knowledge is covered for the students. Another perspective would be e.g. that the increase in the number of students indicates better teaching, because on the one hand the chance of more degrees increases and on the other hand the range of courses becomes more interesting for the students. Instead of teaching, other criteria can also be used for improvement. For example, the aim of the simulation could be to minimize the financial resources required and at the same time to offer a fixed number of lectures. Which goal is to be pursued is determined by the modeling of the scenario. The simulation then allows (to a limited degree of detail) to change the values ​​of these influences assumed at the beginning and thus to analyze their interactions. Instead of a simulation, a field study would also be conceivable, e.g. is carried out within a real university. The advantage here would be that the level of detail is higher than with a simulation. On the other hand, the high costs and the time it takes to see the effects on teaching are disadvantages of this method. Furthermore, you have to be aware that in such a study at this test university the students become involuntary test objects who may suffer disadvantages (caused by poor parameterization of the influencing variables) and that a simulation is more flexible (changes can easily be modeled while in a real university it takes a certain amount of time before changes occur). In order to investigate the effects of parameter changes in a university scenario, the project group has set itself the task of modeling a university scenario and thus developing a simulation. 6th

8 1.3.1 Conclusion of the PG As a rule, a project group application arises on the initiative of a chair. He is usually interested in including students in his own research context in order to fulfill his teaching task. For example, Chair 1 at the University of Dortmund has an interest in improving soccer-playing robots. If there is interest in a certain topic, the chair registers the project group and after the examination, the PG is presented to the students so that they can apply for the PG. In contrast to most PGs, this project group was created on the initiative of students. Even if this is seldom the case, a few students in this project group came up with their own topic. They were interested in the field of simulation and artificial intelligence and found out which chair would be suitable for this topic. An island scenario was initially planned as a scenario for a simulation. When asked by Chair 11, the students were referred to Christian Lasarczyk and Mike Preuss, who were not averse to supervising a PG. In the following, they presented their ideas to the two employees of the chair and a scenario was developed together that simulates the interrelationships at a university. Since Christian Lasarczyk is working on a socionics project, he offered the support of the Fernuniversität Hagen, which is involved in the project. This project also deals with the modeling of distributed intelligent agents, whereby sociological aspects are included. Since the ideas of the students also went in the direction of an agent simulation, the two projects could be linked well. So after a supervisor for this project group had been found, the registration of the PG proceeded as with all other PGs. All the students who were involved in the idea of ​​this PG also took part in it. When this PG came about, it turned out that the search for interested parties or supervisors for a PG started a little late. The reason for this is that the students first had to develop an idea that was interesting for a chair and then had to find a chair with an interest in this idea. In addition, working out the specific topic with the future supervisors also took some time, so that only a few days were available for writing the actual PG application. This note is particularly important for those readers who would like to propose a PG topic to a chair. The participants of this PG are therefore recommended to go to the chairs as early as possible and to allow adequate time for the preparation with the future supervisors and the drafting of the PG application. That the students take the topic of this project group into the 7th

9 has finally seen two advantages, which were also confirmed in the course of the PG: on the one hand, they were able to steer the topic in the direction in which they are most interested and, on the other hand, some of the members already knew each other ( and also their individual strengths and weaknesses), so that the cooperation went very well. The other members who were not present during the brainstorming process were also quickly integrated. 1.4 Teamwork and organization One of the educational goals of the project group is to provide those involved with experience in the area of ​​teamwork. Most of the time, students work on their exercise sheets alone or only in small groups and exams have to be written alone anyway. Although the software internship also worked in a team, the two projects worked on there were much smaller in scope and the number of participants was lower. The project group should enable the students to gain experience in working in a larger team (in this case 12 students) and thus to prepare them for the job in practice. Each individual should know during or after the project at the latest that such a scope can only be processed successfully if all participants form a team. Some of the tasks that had to be done within the project had to be worked on by the group together (for example, drafting, collecting ideas, coordinating procedures). For many other tasks, however, it made little sense to work on them with all participants at the same time (e.g. research, documentation, implementation). One reason for this is, for example, that hardly anyone can know about all the details of the entire project. Another reason is the different experiences and skills of the project members. Some have e.g. already have a good knowledge of GUI programming while others take care of the core algorithms. It is therefore more effective if small groups are formed. Within the project group, the participants can find out where their strengths lie and how big the individual subgroups should be. Examples of small groups during the PG were GUI, Agent, Environment and Scenario. Of course, all participants also learned new things, as the area of ​​responsibility of a subgroup on the one hand not only includes a small sub-task and on the other hand the members of the subgroups also changed. In order to work effectively in small groups, good communication between them is essential. Part of the communication takes place via (class) diagrams prepared at the beginning of the project. Furthermore you put 8

10 found in between during the 2 semesters that some interfaces have not yet been sufficiently discussed and that there is still a need for discussion. However, ideally all participants learn from this experience that good and complete modeling is the basis for a successful and effectively implemented project. Acquisition of knowledge and experience Even if teamwork is an important aspect for the project group, further knowledge should also be acquired or acquired independently. existing ones are deepened. A few examples of the most important subject areas that were necessary for this project are given below: (Multi) agent systems Modeling of a sociological agent model Functionality of fuzzy rules and their implementation with FuzzyJ Handling of LA TEX and Javadoc for documentation In order to effectively acquire the required knowledge and to make this available to the entire project group, a seminar phase was carried out at the beginning of the project group. In this way, each PG participant has acquired in-depth knowledge about a specific topic and provided the other participants with an overview through his presentation (see Appendix A). As already mentioned in Chap, the agent simulation should be based on a sociological model. The project group was offered support by the Fernuniversität Hagen, since all students come from computer science and have not yet had any experience with sociological theories. One challenge was to see the sociological model from the perspective of a computer scientist and to model the agent accordingly. More information about the sociological model and value expectation theory can be found in chapter Another positive effect of the project group is the deepening of existing programming knowledge in Java, as each participant has implemented a part of the simulation. So everyone should come out of this project with practical programming experience. 9

11 1.4.2 Communication In order to be able to communicate as quickly and easily as possible about the course of the project, the project group made use of various options. At the beginning it was decided that every week on 2 fixed dates there would be meetings with the whole group and both supervisors. A protocol should be drawn up in each case so that the current status and current resolutions can also be traced at a later point in time (e.g. for missing members). A homepage was set up for the project group, on which the minutes were electronically archived. In addition, appointments could be managed in a calendar and files made available for everyone (documentation). In addition, ideas were often collected and tasks assigned on the site. A contact list was available for direct communication between individual members. Finally, a mailing list was set up that could be used to send s to all participants in the project group Extreme Programming At the beginning of the project group, the members agreed that a special way of working should be chosen specifically for the implementation phases, namely the so-called extreme Programming.Extreme programming is a model that is intended to enable clients and customers to quickly create suitable software, in particular avoiding all kinds of detours [BA99] [LRW05] [URL01]. Such detours could e.g. Errors (and thus their elimination) or the implementation of parts that are not required. In order to achieve this goal, special forms of work and communication are necessary in various places. So work e.g. when programming 2 or 3 developers at the same time on one screen, so that if anything is unclear, there is direct consultation and errors can hardly arise. In addition, there is regular exchange between individual members between various such groups. This ensures that every developer knows as many parts of the project as possible and the programming groups come up with new ideas and better solutions more often. In addition, the status of the project must be constantly discussed and compared with the goals set (see also section). This means that incorrect developments in the project can be quickly identified and appropriate measures can be taken. For example, the tasks of some programming staff could be 10

12 teams can be changed for a short time. Schedule At the beginning of the two semesters, the project group discussed the appearance of a schedule that was binding for all (see or). Milestones in relation to the project work were defined, such as the beginning and end of the requirements description, design and implementation. In addition, at the end of the first semester a single agent should act in a test environment (as a superordinate schedule) (see Section 6.1), and at the end of the second semester the simulation of a university with many agents should be able to run (see Section 6.2). By setting the time schedule, it should be ensured that between the phases of parallel work (see Section 1.4) sub-goals are repeatedly achieved - the status could then be discussed and assessed by the whole group. Either the sub-area was then considered to be completed or necessary improvements were planned. In each case, the further procedure, in particular the distribution of tasks, was discussed. Of course, small adjustments had to be made to the original plans over the course of the semester. Reasons for this were e.g. Incorrect assessments, technical difficulties or unexpected need for improvement. 11

13 Timetable in the 1st semester of the PG (WS04 / 05) Figure 1.1: Timetable for the first semester 12

14 Timetable in the 2nd semester of the PG (SoSe05) Figure 1.2: Timetable for the second semester 13

15 Chapter 2 Description of requirements The development of software is typically customer-related, i.e. taking into account the requirements of the future users. The purpose of a requirements model is to define the desired functions and properties of the software as precisely as possible. These requirements are specified by the customer. As a customer of the project group, two parties have to be considered. On the one hand, the project group proposal provided a formal framework that defined a minimum objective (see Section 2.1). There were also requests from the sociologists cooperating with the PG. The requirement description chapter describes the definition of the required and desired function points. First, the minimum goal from the project group description is quoted and specified in more detail. Then an insight into the sociological background of this project is given, which describes both the model used and the cooperation with the Hagen Open University. The requirements modeling of the software is considered separately over both semesters in order to show the separation that was also made during the implementation between the agent and an environment (1st semester) and its embedding in a multi-agent system (2nd semester). 2.1 Minimum goal The minimum goal is the implementation of a simulation scenario with social actors as agents who are able to negotiate with other agents about the distribution of resources. The common goal of the actors must be to provide a lot of services. So that the scenario next to 14

If the aspect of cooperation also includes conflict situations, at least some of the actors should also pursue individual interests, and the actors should perceive the situation subjectively. (PG application) 2.2 Sociological requirements This chapter deals with the discussion and development of the sociological theories that were used for the project group (PG for short). An understanding of these theories is necessary for requirements modeling. Coordination and cooperation with the Fernuniversität Hagen The aim of the project group, the implementation of a simulation scenario with social actors as agents, should be realized with the help of the Department of Cultural and Social Sciences of the Fernuniversität Hagen. A close collaboration with the sociologist Dr. Thomas Kron should contribute to ensuring the consistency of the social aspect of the simulation. The sociological theory of action In sociological theory, actors consist of different character types. These determine the behavior of the actor, as they pursue certain goals or adhere to certain rules of behavior. There is, for example, the model of a Homo Oeconomicus, who calculates the best solution for him through an economic consideration and evaluation of the tasks and conditions placed on him. On the other hand there is, for example, the model of Homo Sociologicus, whose decision is based on norms (according to Dahrendorf's - legally inspired - classification: must, should and can norms), expectations and (rewarding, punishing) social sanctions of others also: of the roll carrier itself) can be coined [WISOC]. The outward acting action of an actor is ultimately determined by the character types assigned to him and their weighting. On the basis of a few character types, it is possible to create a large number of different actors. In order to grasp this theory mathematically, the decision-making of a character type is further specified. He makes this based on a value expectation table in which actions are compared with possible consequences. Each episode has 15

17 Figure 2.1: Scheme of the sociological theory of action with a benefit for the actor and each action is associated with individual costs. This table contains probability values ​​for all possible combinations of consequences and actions that result from rules that are individually designed for each character type. The action with the highest probability that has the highest value expectation in the value expectation table is carried out. The selection of an action is therefore fitness proportional to your value expectation, but not deterministically. Fig. 2.1 gives a schematic overview of the variant of the theory used here. This differs from the basic version in that it uses several character types in one actor. In the classical value expectation theory, each actor consists of a character type Sociological requirements for agents and the environment The mathematical modeling and algorithmic implementation of the sociological theory of the value expectation table is an essential requirement. Agents should make their decisions on the basis of a value expectation table, the possible consequences of the actions juxtaposes. The rules within the expected value table should be based on assumed environmental conditions (subjective 16

18 environmental images). The result is a probability rating for the combination of action and expected consequence. A simple example is the combination of shopping (action) - impoverishment (consequence) and the rule If money is high (environmental requirement), then probability is low. The rule is checked when the value expectation table is called and provides a low probability for its entry at the point of shopping - impoverishment, depending on how much money is available at the moment of the query. This model was completely implemented in the first semester and implemented using JAVA, so that at the end of this semester a fully functional actor model based on autonomous agents will be realized. The function of the concept is to be tested in a scenario based on Robocode (see Section 6.1). Sociological requirements for the multi-agent system The investigation of negotiations and the communication between the negotiating partners involved, which is essential for this, form a broad area of ​​sociological research. Initially, the project group was not aware of any practical theories that would describe the part relevant to the simulation. As an element of familiarization with this topic, a questionnaire was therefore drawn up, with the help of which typical features were to be focused. This questionnaire was sent via to the sociologists advising the project. An overview of the answers can be found in the appendix (see Section 7.2). The evaluation of the answers revealed the minimum requirements that are placed on negotiations. These are described in Chap. 2.4 listed. 2.3 Requirements modeling of agent and environment In order to make the complex topic of simulating social systems manageable, sufficient levels of abstraction had to be determined first. With the division into the work areas agent and environment (1st semester) and multi-agent system (2nd semester), an initial breakdown could be achieved. Following this structure, this chapter is dedicated to the respective development of a requirements model, which determines the properties and functional units of the system to be implemented. 17th

19 Use case description from the user's point of view (see Fig. 2.2) User interface The system has a user interface that allows communication between the user and the simulation. The user can create a simulation by creating agents and the environment (including the necessary parameters). A saved simulation can also be loaded to continue it. The properties of the agents generated or the environment can be viewed and changed. The history of the agents can be viewed in order to understand the course of the simulation. Start simulation The user can start a simulation that has been completely created or loaded. If no environment and no agent have been created, the user is prompted to create them. Further agents can also be added by the user. Create agent The user specifies the desired profile of an agent by weighting the character types. It also defines the possible alternatives for action as well as the rules for connecting alternatives (actions) with the possible consequences. Create environment The relationships between the agents and the required parameters of the environment are specified in accordance with the scenario. Modify agent The user can change the previously set or learned (current) parameters. Manage parameters (agent) The user can view the previously set or learned (current) parameters. Save agent All parameters of the agent and its history are saved in a file. Output agent history The user can view the history (decisions of the individual character types, 18

20 important, executed actions) of an agent. The course of communication between several agents can also be observed. Modify environment The user can change the current parameters of the environment. Manage parameters (environment) The user can view the current parameters of the environment. Save environment The current parameters of the environment are saved in a file. Save simulation The complete simulation (including environment and agents) is saved persistently so that it can be continued from this state. Load simulation A saved simulation is loaded with all agents and the environment so that it can be continued. System-internal use case description (see Fig. 2.3) Record information An agent can record information from its environment. This can be information about his own resources (e.g. money) as well as other parameters (e.g. number of students in the current semester). Making decisions Agents can make decisions independently on the basis of environmental information with the help of their character types. As a consequence of a decision, actions are optionally taken by the agent. Information can be published or environmental parameters can be manipulated (according to the selected action). 19th

21 Figure 2.2: Use case diagram for the user 20

22 Figure 2.3: Use case diagram for the agent (system-internal) 21

23 2.3.1 Data model of agent and environment The simulation software to be developed is primarily intended to serve the research area of ​​sociology as a tool for evaluating behavioral theories. The user should be able to create and define virtual agents for this purpose. Since agents act in an environment, this should also be freely definable by the user in order to be able to guarantee a sufficient degree of freedom of the system. Agents and character types The agent should represent a single actor who receives information from the simulated environment and derives decisions and acts from it. It is composed of different character types, which are motivated by sociology. Your recommendations for action represent the basis of the agent's decision-making process. As a basis for generating the recommendations for action, the expectation of value theory is to be used here, which can be administrated by the user via expectation of values ​​tables. Value expectation table and rule bases The value expectation table (VET for short) should form the data storage for the values ​​calculated in the rule base, which the character type can then access. For each action of a character type, the VET must store a probability for the occurrence of each of its consequences of actions. In addition to adding and deleting actions and consequences for the character types, the VET must also provide an interface for configuring the rule bases. Each of the a f (a number of actions, f number of sequences) probability values ​​should be calculated using its own rule base. The calculation of the table is initiated when the agent enters the current environmental information. The VET forwards this to each rule base it contains for evaluating the fuzzy rules. The rule base used here must be able to return a probability value when entering the current variable values ​​on the basis of the previously created rules and linguistic terms. The functionality is implemented with the help of the FuzzyJ library (see Section 3.3). Later on, the calculation of action sequences by the environment is also to be implemented with the help of a rule base. 22nd

24 Resources A resource should contain information about the respective atomic building block of the environment. This can be, for example, an account balance, a family relationship or a truth value. It must be guaranteed that agents only carry out permitted operations on these resources. The central administration right over the resources must therefore lie with the environment, which then supplies the agents with the resources to which they have read or write rights. The resources visible to the agents form the environmental image of the respective agent. This should represent the basis for decision-making. The environment The environment is intended to house the control mechanism of the simulation. It manages all resources, informs agents about the changes and has to calculate appropriate changes in the resources according to the actions of the agents. An event-based notification mechanism is to be implemented. This means that the agents who are affected by these changes will only be asked for their reaction if there are changes in the resources. These reactions can lead to new changes, whereby these can not necessarily be immediately, but after a certain duration or cyclically. Before the changes are calculated, the environment must each check whether the rights or prerequisites for carrying out the action exist. For example, an agent can only offer a lecture if he has the appropriate staff. In addition, it must be ensured that the environment is the only place in the system at which resources, agents and actions can be changed, created and deleted. It will thus represent the direct interface to the GUI. This central management mechanism ensures the consistency of the system. Description of the problem area model This diagram (see Fig. 2.4) describes the model of a simulation in which a complex agent acts in an environment. An agent consists of a number of character types that make decisions independently of one another. Agents operate in an environment that manages resources and information. Depending on the environmental information, agents make decisions that lead to an action. The consequences of an action are calculated by changing the resources that describe the environment. 23

25 Figure 2.4: Problem area model agent and environment 2.4 Requirements modeling of the multi-agent system After the implementation of autonomous agents in the first semester, the second semester served the project group to provide the infrastructure required for negotiations. The aim was to realize a negotiation that was as realistic as possible. The aim of this negotiation should not be the determination of a purely computationally optimal result, but rather the simulation of social interactions during a negotiation process. Description of the algorithm of the multi-agent system. The subject of a negotiation is resources. The agents involved in the negotiation are informed of an upcoming negotiation.However, the agents are free to attend the hearing. All agents participating in the negotiation (hereinafter referred to as agents) receive an initial view of the resources to be negotiated from the environment. In a preliminary round, all agents should submit a proposal, which is communicated to all others. This is intended to simulate an initial exchange of ideas - as it usually takes place in the run-up to a real meeting. Now a randomly selected agent is supposed to make a suggestion. All other agents vote on the proposal made. If a quota specified by the user (number of yes votes) is reached, the 24th applies

26 Negotiation as ended. The accepted proposal will now be returned to the environment. If no agreement could be reached, another agent is iteratively asked for a proposal. A termination takes place at the latest when a specified number of negotiation rounds has been reached. When creating and evaluating proposals, the agents or their character types should refer to their value expectation tables (see Fig. 2.6). In order to avoid that the agents only optimize their own benefit, a control parameter should be introduced. This enables the character types to include the interests of the general public in the calculation. With regard to the university scenario to be simulated, this parameter corresponds to a global teaching. All agents should thereby show a defined interest in other chairs receiving a minimum amount of funds. This model is the result of a combination of different implementation ideas of the PG participants. There were mainly two areas of influence that form the basis for this concept: On the one hand, it was important for the participants to achieve a realistic representation of a negotiation, while at the same time the sociological model of the value expectation theory should continue to be used as comprehensively as possible. A detailed description of the decision-making process on which this algorithm is based can be found in the chapter

27 Figure 2.5: Problem area model of the multi-agent system 26

28 Figure 2.6: Sequence diagram for negotiation 27

29 Chapter 3 Procedure and concept development This chapter gives an overview of the development of the project group's ideas. This is structured according to the sequential subject areas agent and environment (implemented in the first semester) as well as the multi-agent system implemented by the project group in the second semester. 3.1 Procedure for the Realization of Agent and Environment The conceptual development of the project during the first semester took place over a core period of six weeks. In order to get an introduction to the topic, the individual ideas of the PG participants were made transparent through an exchange of ideas. Each participant expressed the essential aspects of an agent system from their point of view. In multiple iterations - supported by the lectures (see Appendix A.1) - decisive points crystallized. The group agreed that an agent should have a predetermined set of characteristics and behavior. With suggestions from the sociologist Dr. Thomas Krohn, this approach was further refined. In order to be able to reduce an agent to essential character specifics, a layer structure was decided. Here, an agent consists of a number of character types that influence the behavior of the agent in different weightings. This approach closely follows the views of sociology and thus enables the relevant specialist knowledge to be included. Decision-making turned out to be an essential element, i.e. a concept had to be drawn up and implemented that made human decision-making as easy as possible

30 images. Various basic characters are known from sociology (including Homo Oeconomicus, Identity Officer, Emotional Man, Homo Politicus) whose weighting leads to individual characters. To implement this weighting, the project group decided on two concepts that should be used side by side: static and dynamic weighting functions. This approach enables agents to determine their basic behavior and still keep room for dynamic changes (e.g. via evolutionary strategies). Two sub-groups were formed to better structure the concept. One team focused on the design of the agent framework, the rest of the participants concentrated on defining the infrastructure for the agent system. A communication infrastructure was developed with a view to the second semester, which should enable the exchange of information on a Blackboard basis. Such a blackboard enables information to be published by all agents and read by authorized agents (the respective recipients). An important requirement for the environment was the management of resources, in particular money, employees, premises, tasks and third-party funds. Furthermore, the environment should have the ability to map social structures or hierarchies of agents and to make framework conditions definable. In particular, there was a lively discussion about the time model to be used. The group that had the focus on the environment assumed a continuous (real) time, which is counted system-internally and continuously progresses, even when no actions are carried out or no communication takes place. This approach is intended to enable actions whose effects will only become effective in the future or to put the actors in a certain state about which information must be available in the environment at all times. In the context of the university scenario, this would be e.g. the (complex, but simplified here) plot to write a diploma thesis. Writing a diploma thesis is an interruptible, i.e. non-atomic activity. An agent can therefore decide to write a diploma thesis, interrupt it (e.g. to earn money) and resume it later. The decision for the current action can therefore be made at any point in time. The disadvantage of this approach, on the other hand, is that the system permanently counts the time, although there may be no need to do so over long periods of time. This is particularly relevant in connection with the agents' communication with the environment: At this time, the possibility was not ruled out to let the environment address all agents in every time step in order to provide them with new environmental images

31 supply. With this approach, however, there is the risk of an enormous overhead from messages sent that have no additional information content for the agents. A time model proposed by the supervisor, which has proven itself for the implementation of time-discrete simulations, can prevent this disadvantage: The system time should no longer serve as an absolute indicator, but rather be defined on the basis of successive events. The result is a kind of list in which the ongoing actions and the events triggered by them are entered relative to one another. The environment that manages this list works through it step by step, whereby the steps no longer correspond to atomic time units, but are understood more abstractly as a transition between events. This modeling raises further questions about the realization of ongoing actions (cf. writing a thesis), but it avoids the overhead mentioned above, since messages are only sent when the need arises. The integration of a memory and the mapping of plan-based action was initially rejected for the first stage of development for reasons of complexity. 3.2 Procedure for the implementation of the multi-agent system After the implementation of autonomous agents in the first semester, the second semester served the project group to provide the infrastructure required for negotiations. At the beginning of the project group there was hardly any prior knowledge of the participants about the relevant scientific point of view in sociology. The sociological background with regard to communication and possible negotiation patterns was therefore worked out in two parallel development strands. On the one hand, the PG participants worked out suggestions for the structure and course of negotiations in small groups, while at the same time a questionnaire was prepared for the sociologist Dr. Thomas Kron from Hagen should be presented. The subgroups essentially resulted in two different models, both of which, however, showed strong similarities on one point: A negotiation is always a completed component in the software to be developed. The negotiation should be started and a usable result should be returned. The first model divides a negotiation into 30

32 small units with a maximum of two agents. Each agent would negotiate with each other on this. In each of these negotiation processes, a part of the total objects to be distributed is divided between the two participants. In this way, at the end of the negotiation, all objects are distributed among all agents. The second model saw negotiation as a sequence between making a proposal and accepting or rejecting that proposal. So an agent is randomly selected from the group in the negotiation, who generates a proposal in which he distributes the negotiated objects to all agents. This proposal is then sent to all other agents who can accept or reject it. As soon as a minimum number of approvals or a maximum number of rounds specified by the user has been reached, the negotiation is ended. The answers to the questionnaire from Hagen did not reach the project group until a point in time when the preliminary considerations and planning had for the most part already been completed. Amazingly, there were many parallels to the concepts developed in the project group and the theories described by Dr. Kron. This agreement supported the concept developed in the project group with regard to its suitability for depicting a real negotiation. In multiple discussions, the participants integrated the suggestions that had arisen from answering the questionnaire. Ultimately, the implementation of the second proposal regarding the implementation of the negotiation was decided due to the greater realism, even against slight resistance on the part of a supervisor. 31

33 3.3 Tools used This chapter briefly describes the programs and tools used for work in the project group. First of all, the programming language used was set to Java, as this is known to all project group participants and, thanks to its explicit platform independence, makes it easy to port between different operating systems. In addition to the standard Java libraries, an external class library was used: The FuzzyJ Toolkit [FuzJ] offers a simple way of integrating fuzzy logic into Java projects. Functions for creating and managing fuzzy variables and (de-) fuzzification are offered here. The use of this logic was required above all for a simple input option for the rule base for calculating the expected value table (see 2.2). In this area it is possible to create fuzzy variables for each resource, which are then used to compose the rules within the rule base. The concrete use of FuzzyJ is explained in more detail in the chapter. The implementation was also carried out with the help of the Eclipse development environment. 32

34 Chapter 4 Design This chapter covers the design and implementation details. The important details of the implementation as well as the necessary deviations from the requirements definition are explained. The class structure of the implementation is presented below. For this purpose, the program is broken down into its individual logical units (environment, negotiation, agent, GUI) and described, with the graphical interface being explained later (see Chapter B in the Appendix). 4.1 Environment First, the implementation details of the environment are presented. The description of the central classes is followed by an introduction to the decisive processes. Class Description Starter This class is called up either from the graphical user interface (see Chapter B) or directly from the console. The individual objects of the simulation are generated here from XML files specially created for the simulation and the simulation is started via the environment (cycle behavior ()). 33

35 Figure 4.1: The class diagram 34

36 Environment This class represents the central administration of the simulation: the environment. This is where vectors of all agents, resources, negotiations, actions and associated events are created. The list for calling the specific actions, the AgentActionQueue and the time are also managed here. The center of the environment is the AgentActionQueue. In this all actions of the simulation are managed chronologically. Agent actions and negotiations are classified here. The individual negotiations are managed in special action classes, the NegotiationActions. These are generated in the constructor of the environment together with an introductory action that is called before the start of the actual negotiation in order to announce it. The Boolean variable negotiation finds instead of negotiation name is used for this. The environment is put into a theoretically eternal cycle via the cyclebehavior () method by executing the actions from the AgentActionQueue and adding new ones that come from the agents. Theoretically, this cycle would only end as soon as the AgentActionQueue no longer has any actions to show. In order to be able to stop the simulation anyway, the starter (see chapter 4.1.1), which calls the environment, was modeled as a thread that can be controlled externally (e.g. via the GUI). The environment also implements the time model described in Chapter 2.3. After each action, the environment adjusts the time according to the time span required for this action. Checking the access rights and changing the individual resources are also initiated by the environment. In addition, communication with the agents is initiated here via the environmental images (EnvironmentView). The agents only receive an environmental picture if a resource to which they have the right to view has changed. Resource The resources describe the current state of the environment. Resources always have names and values ​​with corresponding limits for the minimum and maximum value. The values ​​can be of the type Boolean, Integer or Double, whereby the system can be expanded as required and also allows self-defined objects. Each resource is divided into one of three categories: MASTER, PERSONAL, or SYSTEM. Master resources are only abstract types of resources. They serve as placeholders for the personnel resources in the actions and rule bases so that each agent does not have to create a separate environmental action and character types with the personal rule bases. So there are 35

37 resource for each agent a personnel resource that contains the actual value of the resource. (For example, the Spend Money action does not have to be recreated for each agent, since it only specifies the master resource, from which the corresponding personnel resource can then be determined.) Personnel resources have an agent as owner and the higher-level master resource under its attributes. Finally, system resources are resources that have no owner and are therefore generally assigned to the environment. View and change rights can be specified for each resource. These rights are managed in two vectors which contain the associated agents. In order to send resources to an agent via an environmental image (see Chapter 4.1.1), there is also a weakened resource version, the AgentRessource interface. Only the name and the current value can be queried here to ensure that not too much information is disclosed to the individual agents. Action This class represents the agents' ability to influence the environment. An action can only be carried out if certain conditions are met. This means that a certain amount of a resource must be available before the action is carried out and can therefore really be used for the action (e.g. the study action requires a minimum financial cushion). To do this, the agent must also have the appropriate rights (see Section 4.1.1). These conditions are stored in two vectors. The resources that must be available are managed in ressourcecondition and the changes to the values ​​of these resources are managed in ressourceconditionvalue. In addition to a name, actions also have a duration and a repetition number of iterations. The duration indicates the point in time after the action is taken from the AgentActionQueue of the environment in order to be executed. Example: An agent wants to perform an action with duration 3 at time 6. The environment then takes this action from the AgentActionQueue at start time 9 and executes it. The iterations in turn indicate how often the action is to be carried out one after the other, with the duration indicating the intervals between the iterations. For example, annually recurring negotiations can be generated. The effects of an action are finally indicated via a vector of events (see Chapter 4.1.1). In addition to the normal actions, there is another set of actions, the NegotiationActions. Here the negotiations of the scenario 36

38 rios are saved and thus the minimum number of votes, the start and the maximum number of laps are also given. Event The effects of an action on the environment are saved and calculated here. An event can change various resources that are stored in the resource vector. The corresponding entry in two further vectors corresponds to each of these resources: rulebase and ressourcevalue. The changes to the respective resource are calculated using the computeconsequences method with the aid of the rule bases (see Chapter 4.3.3). Example of a rule for bank interest: if A LOT OF MONEY then A LOT OF INTEREST if LOW MONEY then LOW INTEREST The results of this calculation are then saved in the resourcevalue vector. EnvironmentView This class represents the agent's view of the environment (i.e. its resources). It contains a vector consisting of AgentRessources (see Chapter 4.1.1), which contains the resources to which the special agent has viewing rights. The values ​​contained do not have to match those of the environment, whereby the principle of the incomplete or incorrect image of the world of an agent is implemented. Basic sequence The following shows the simulation sequence from the perspective of the environment. At the beginning, the environment sorts the negotiations specified by the user as actions (see chapter 4.1.1) in the AgentActionQueue. Now the first environmental picture (see chapter 4.1.1) is sent to all agents in turn, prompting them to act. If the agents act, the environment also inserts the desired actions into the AgentActionQueue. Now a cycle begins that is only ended when the environment no longer has any action to take. The first action is taken from the queue, checked and the simulation time 37

39 is set to the start time of the action. If it is a regular action (see chapter 4.1.1), the conditions are checked first. In other words, are there enough resources to carry out the action and is the agent even allowed to change these resources? If this is answered in the affirmative, the individual events (see Chapter 4.1.1) of the action are calculated and executed. Finally, all agents for whom something has changed in terms of resources are sent a new environmental report and can act again. However, if the action is a negotiation, the corresponding resource negotiation finds instead of negotiation name is set to TRUE and the agents are given time to register for the negotiation. After three rounds, the negotiation (see chapter 4.2) starts with all agents who have registered and are allowed to participate. After the negotiation, the resources are adjusted and the cycle begins again. 4.2 Negotiation Since our agents are to negotiate about resources, it is necessary to provide a communication infrastructure for this. This task is done by the Negotiation class. Accordingly, a negotiation consists of the following main elements: Negotiating agents who are to distribute certain resources. Resources to be negotiated. These correspond to the personal resources. System resources (ie of the type NegotiationRessources), whereby a system resource informs the negotiating agent how much of a resource is available. the number of rounds that determine the maximum duration of a negotiation. This is necessary because the participants in a negotiation do not necessarily come to an agreement. As soon as the environment creates a negotiation, it lets it run by calling the startnegotiation () method. startnegotiation () notifies the environment of the failure of the negotiation by returning the value zero. If the negotiation has been successfully completed, startnegotiation () returns an object of the EnvironmentView type to the environment, which shows the distribution of the system resources to the 38

40 personal resources, i.e. the result of the negotiation, encapsulates. The course of a negotiation is as follows: An initial proposal is first requested from each of the agents involved in the negotiation, with a proposal being represented by an object of the Environment View type. An agent delivers an initial suggestion by calling its method makefirstprob (), which generates it based on the current state of the environment. If an agent wants to take the initial proposals into account in his decisions in the course of the negotiation, the getsuggestedenvviews () method is available to him. This procedure simulates the small talk that usually precedes a real negotiation, with which the participants get an idea of ​​the opinion situation. Once all the initial proposals have been collected, an iterative process begins, which is repeated until an agreement has been reached or the negotiation is broken off due to the maximum number of rounds reached. In each iteration, an agent is randomly selected in an evenly distributed manner to submit a proposal for the distribution of the resources to be negotiated. This is done using the agent's makeprop () method. This ensures that an agent is not asked to submit proposals several times within a negotiation round. The addressed agent calculates a suggestion and returns it as an environmental image (EnvironmentView). All other agents involved in the negotiation are now requested to vote on this proposal. Each agent can accept or reject the proposal. The function of evaluating proposals is implemented in the agent using the getopinion () method and, like the generation of proposals, is based on the value expectation table of the agent's character types. Since agents cannot generate an environmental image themselves due to visibility restrictions, suggestions are returned as a vector of resources. The negotiation class then generates the corresponding environmental image from this vector. 4.3 Agent The agent is responsible for and implements the decision-making process. He receives the information necessary for the decision-making process via updateview (), then initiates the decision-making process, and finally returns the action he has chosen to the environment in reactonviewchanged (). The agent's environmental image, which is saved as a resource vector in myview, plays the central role in the decision-making process. The agent updates the information contained therein with each new environmental image. 39

41 When the saved environmental image is updated, the old environmental image is compared with the new one in the compareView () method. This is where the memory would start (see Chapter 5.2). Finally, the agent calls its decide () method. The completed environmental image is passed to the individual character types one after the other by calling up the evaluatealternatives () method. These independently evaluate all available actions. On the basis of these evaluations of the character types, the agent can calculate a cumulative value expectation for each available action according to their weightings (the cumulate () method is used here). The most promising action (with the highest value expectation) has the highest probability of being selected (non-deterministic, fitness-proportional action selection). In addition to the implementation of the previously discussed value expectation model (see Chapter 2.2.1) in the agent, the aim is also to implement behavior in the agent that is as intuitive and realistic as possible. To a large extent, this behavior can be generated by the user using rules. However, there are some fixed patterns of behavior, such as negotiating behavior. For this purpose, the following assumptions were made about the real agent: From the pool of his proposals for a negotiation, an agent first presents the best proposals for him An agent agrees to a proposal from his counterpart precisely when he himself no longer has a proposal that is better for him An agent always acts according to the nature of his character or his character types. Agent in negotiation If the agent is in a negotiation, it is initiated by the Negotiation class (see Section 4.2). This is done with the makefirstprop () method. The action transfers its own object to the agent so that he has all the information necessary to create a proposal. The agent then calculates proposals that he can put forward in the further course of the negotiation. All proposals have the form of a new environmental image and are based on the environmental image that was current at the beginning of the negotiation (base of discussions view). 40

42 The new environmental images (suggestions) are generated by changing the individual resources of the participating agents. The agent only considers the resources that are marked as negotiable in the negotiation (e.g. money). First, the entire negotiable amount of a resource is distributed equally among the participants. The agent now changes the share of the resource belonging to him (e.g. money agent1) by a certain percentage, for example between -40% and + 40% of the equal share (= size of the resource) and distributes the remaining amount to the other agents. The step size decreases as the number of agents increases, the number of suggestions that the agent should generate. For this purpose, the maximum number of rounds of the negotiation is selected first. Since it is also possible that several resources are to be distributed within a negotiation, the resources for a proposal are distributed in several recursion levels. (Method rekprop ()). See Figure 4.2. The negotiation resources changed in this way are then combined with the rest of the current environmental image at the start of the negotiation to form a new environmental image, so that the agent has enough suggestions available for the negotiation at the beginning. These suggestions are now sorted according to the order in which the agent should submit them. It makes sense for the agent to suggest what is best for him first in the hope that it will be accepted. The more rounds of negotiation, the more indulgent he becomes. This behavior not only makes sense from the agent's point of view, it is also realistic. The suggestions are sorted according to the value expectation of the VETs of his character types. For this purpose, the value of the best action is calculated for each proposal. Since suggestions consist of the environmental education that would be found after the negotiation, the method evaluatealternatives () can be used for this. Details on the evaluation in the university scenario can be found in Chapter 6.2. The negotiation then begins and will later ask the agent for a proposal or want to know his or her opinion (in the form of approval or rejection) on a proposal from another agent. In order to get the agent's next proposal, the negotiation calls the makeprop () method and only receives the first element of the sorted environmental images. The agent then deletes the suggestion from its vector and delivers its second-best variant the next time it is called. If the agent is asked to vote on a third-party proposal (getopinion () method), he says either yes or no. First of all, of course, the agent has to evaluate the proposal, like his own before, using his value expectation table. If he has even better suggestions in his vector, he rejects it. If this is not the case, his answer to the hearing is 41

43 Figure 4.2: Generation of an agent's proposals at the beginning of the negotiation (3 agents negotiate for 2 resources) 42

44 yes. This approach is quite intuitive, as an agent can hope to be able to make a better suggestion later on Character type and value expectation table First and foremost, the value expectation table (VET) is a data table that forms the basis for the agent's decision-making. According to the sociological concept of value expectation theory, it stores probabilities of correctness for every combination of alternative actions (action) and consequences of action (consequence). Each of these values ​​says how high the probability of the occurrence of a sequence of actions due to the execution of an alternative is in the eyes of the character type. However, the associated value is not fixed, as in the sociological value expectation model (see Chapter 2.2.1). It is calculated dynamically with the help of a fuzzy rule base based on the existing environmental situation (see Chapter 4.3.3). Also stored here are the evaluations of the alternatives and consequences that are of great importance for the agent's decision-making and have the task of expressing the different objectives of the character types. Alternatives each have a cost value that expresses how complex the action is for the respective character type. The utility value represents the subjective assessment of a consequence by the CT. The character type initiates the recalculation of the individual table entries using the evaluatealternatives () method before each use of the VET. A loop is used for all alternatives and all consequences and the calculate () method is called with the current environmental image. After the VET has been updated, the character type calculates the expected value for all available actions on the basis of the probabilities as well as its costs and benefits. For each action, the utility values ​​of the consequences are multiplied with the associated probabilities, added up and then reduced by the costs of the action. The structural structure of the VET is shown in detail in Figure 4.3. It also becomes clear that a fuzzy rule base is hidden behind every value. To create the probability table, the character type supplies all BasicActions and Consequences available for the agent and all linguistic variables (class LingVars) for the fuzzy rule base. The LingVars are a representation of all environmental resources through linguistic terms. This object is only stored here in order to be used later in every RuleBase. 43

45 VET Consequence_1 100 Consequence_2 50 Consequence_3 200 Benefit Expected value of the alternatives: Alternative_1 10 Alternative_2 20 Alternative_3 0 Alternative_4 50 0.7 0.2 0 0.5 0.9 1 0, .6 0.35 0.3 100 * * * * * * * * * * * * Costs Applicability Rule base [a lot of resource_1, little resource_2] == [Probability low] [little resource_1, a lot of resource_2] == [Probability high] Figure 4.3: Diagram for value expectation table 44

46 An empty rule base is then created for each table entry of the two-dimensional vector. In the following, the table can be expanded or reduced as required to include alternatives and consequences. The newly created rule bases can be configured using the addrule () and removerule () methods. The individual rules are put together in the GUI and only passed on here as an object of the FuzzyRule class. Once the VET is complete, the simulation can begin. To calculate the VET, the owning character type calls the calculate () method. The task of the expected value table is now to update each entry. For this purpose, every rule base is called up once with the forwarded environmental image. These then provide the new (a f) probabilities of occurrence. After running through the entire table, the results of the fuzzy rules are available in the form of probability values ​​and thus the associated character type now has the opportunity to evaluate the value expectation table and to return its subjective evaluations for all actions to the agent (Chapter 4.3) The rule base One design decision of the draft is to use a rule base for determining the values ​​expectation table (VET) entries. Each entry in the table should be described by a set of rules, the evaluation of which provides a concrete probability. The rules should depend on the current environmental picture (i.e. on the current state of the environment). The RuleBase class exists to separate the functionality of the VET from the functionality of the rule base. It has all the functions required to create a set of rules and to evaluate it on the basis of an environmental picture. A rational value (double) is returned which, in the case of the expected value table, has a value range between 0 and 1. Since the rule base should also be used to calculate the change in resources in the environment, values ​​outside the value range between 0 and 1 can also be returned. One possibility is, for example, to use the rule base to describe the change in the resource money of a chair depending on the financial resources made available to it. Then the rule base should supply the value by which the resource money changes. This change is mostly outside the interval [0, 1]. To separate the evaluation for the VET and the environment, two different calculation methods are used, as both cases are detailed in 45

47 and must therefore be handled differently. The following are the basic concepts of the RuleBase: Managing the Linguistic Variables A rule base typically uses linguistic variables, with each linguistic variable representing an input. An example of a linguistic variable is temperature. Each linguistic variable consists of linguistic terms that have slang names for possible values ​​of the linguistic variable. To stay with the example, the adjectives cold or hot are possible terms of the variable temperature. Since the same variables are often used in different rules, the aim was to encapsulate all linguistic variables in one data structure.On the one hand, less memory is required and, on the other hand, the runtime is shortened because the variables do not have to be generated twice within a RuleBase. This data structure is the LingVars class, which is located in the tools package. It consists of a set of objects of the FuzzyVariable class that is imported by the FuzzyJ toolkit. The variables are stored internally as a HashMap so that a single variable can be accessed quickly using its name (e.g. temperature). The MemoryDegree variable is a special feature. This variable is contained in every LingVars object and models a value between 0 and 1, which indicates the frequency of the observed action in relation to the number of memory entries that match the current environmental image. In this way it can be formulated in the rules how often the current alternative course of action has already been carried out in the current situation. The agent's memory is used for the specific calculation of the MemoryDegree. So that this variable is available in all scenarios, it has been integrated into the RuleBase and does not have to be defined by external configuration files. The default definition of the linguistic terms can, however, be deleted and user-defined terms can be added. The default definition only serves a meaningfully defined linguistic variable at the beginning. The existence of this special variable is of particular interest to the character type of identity supervisor, as he is inclined to repeat an alternative course of action that has already been carried out several times. So you can e.g. Describe the following requirement of a rule: If I have already carried out this alternative action many times ... In addition to storing the variables, the class contains a number of methods that facilitate the creation and access to the variables and terms. Most of the methods lead the parameters to the corresponding method of Fuz-46

48 zyj further to e.g. create or delete a variable and are only used to encapsulate all variables in an object. Administration of the rules Within the RuleBase, the rules are saved in a linear list (rules), since on the one hand each rule base can have any number of rules and on the other hand each rule is evaluated one after the other to evaluate the rules (the order does not matter). Therefore you can do without direct access and use a list. Each element of the list is an object of the class FuzzyRule, which is imported by FuzzyJ. The methods Getrules (), setrules (), addrule () and removerule () are available for managing the rules. These methods are self-explanatory and not necessary to understand the concept. Therefore, they are not explained in detail. Evaluating the rules More interesting are the methods for evaluating the rules. As already indicated above, the RuleBase should be used both for calculating the value expectation table and for determining the change in resources. The calculations differ in several details, which is why two separate methods (calculatevalue ()) are implemented for the evaluation, which differ in terms of different parameters. The basic evaluation process is the same in both methods. The method for the value expectation table has the current environmental image and the MemoryDegree as parameters, whereas the method for the environment only has the current environmental image as parameters. The evaluation of all rules of a rule base takes place in the following steps: 1. Extraction of all resources from the EnvironmentView (environmental image). 2. Fuzzification of each resource with a singleton in place of the current resource value. A FuzzyValue (class of FuzzyJ) is generated, which is then added to the HashMap fuzzifiedinputs. Thus you can use a fuzzified input in all rules. 3. All rules are supplied with the required entries one after the other. Within a rule, the entries are added in the order of the resources in the precondition. The HashMap fuzzifiedinputs is used for fast access. 47