• Keine Ergebnisse gefunden

FLAME’s Missing Functionality

Im Dokument Agent-Based Modeling (Seite 87-93)

Using the X-machine approach provides agents with much needed com-plexity to model and simulate complex models. However, there are a number of advantages other frameworks provide, which FLAME currently does not.

This makes it necessary for modelers to add more complex code, embedding complex behavior into agents.

Static global conditions. Agents behave in a world with no changing con-ditions, as there is no global environment agent acting as the world.

None of their decisions have any effect ‘on the world’. It only acts as a space. This requires a central agent to be programmed into the system if the model needs a world representation.

No learning or adaptation in agent functions. Agents cannot learn about their performance and adapt to new conditions. This would require ad-ditional programming to add a reward function and complex function choices to show adaptation.

Assumption of perfect rationality in agents. Agents have access to complete message boards and perfect knowledge, unless randomness is added to the message choice.

• Modelers assume agents have perfect knowledge of the past and the present, including the model they exist in.

• Agents are also assumed to have perfect foresight.

• All agents are homogeneous or heterogeneous, represented as dif-ferent values for the same memory variables.

• All agents have a maximum expected utility in decision-making.

The lack of networks. Most agent communications are based on networks formed [75]. FLAME models are independent agents with no links be-tween them. FLAME does not create neighborhoods, unless specified.

There are additional restrictions in FLAME, because of its parallelization ability and synchronization points in agent functions and messages. These points ensure that all prior agent functions are finished, before the simulation progresses. At these points, the message board is locked, until all agents have finished sending their messages to that particular message board. The board is only unlocked when it is read by agents. Figure 3.14 depicts this along with a time line to show when these occur.

Synchronization points are useful to remove deadlocks, but makes agents wait to finish processing before it can continue. However, this architecture also makes the system extremely predictable. The agents have pre-knowledge of what to do and makes it impossible for them to learn and change their behav-ior. This prevents emergence to occur at lower levels of these systems, only seen above by predictable behavior below. In order to encourage emergence, as in real systems, modelers need to overcome these assumptions:

• Adaptability of agents is ignored.

• Cannot allow agents to think.

• Allow emergence in the model at lower levels.

• Somehow not to compromise on the parallelism effort of the models, else it will crash during execution.

Chapter 4

Getting Started with FLAME

4.1 Setting Up FLAME . . . 62 4.1.1 MinGW . . . 63 Configuring MinGW for Windows users: . . . 63 4.1.2 GDB GNU Debugger . . . 63 4.1.3 Dotty as an Extra Installation . . . 64 4.2 Messaging Library: Libmboard . . . 64 4.3 How to Run a Model? . . . 65 4.4 Implementation Details . . . 65 4.5 Using Grids . . . 68 4.6 Integrating with More Libraries . . . 69 4.7 Writing a Model - Fox and Rabbit Predator Model . . . 71 4.7.1 Adding Complexity to Models . . . 72 4.7.2 XML Model Description File . . . 72 4.7.3 C Function . . . 76 4.7.4 Additional Files . . . 81 4.7.5 0.xml File . . . 83 4.8 Enhancing the Environment . . . 84 4.8.1 Constant Variables . . . 84 4.8.2 Time Rules . . . 84 FLAME stands out from other agent-based modeling frameworks, allowing the parallel deployment of the simulations on large parallel computers using Message Passing Interface (MPI). MPI is used to send messages between agents, located on different nodes or processors on various platforms. This capability allows FLAME to run large simulations (up to 500,000 agents) in a matter of minutes, enhancing research in time and complexity in the written models [107]. FLAME reads the model files and automatically generates a large simulation program in C which can be run in parallel by using the ‘-p’

flag or in serial by default.

The input files defined by the modeler are

• Model.xml - Multiple xml files containing the whole description of the model such as agent definitions, memory variables, functions and mes-sages between them.

• Functions.c - Multiple ‘.c’ files contain implementations of agent func-tions, names of which are specified in the xml files.

61

FIGURE 4.1: Block diagram of the Xparser, the FLAME simulation com-ponent. Blocks in blue are files automatically generated. The green blocks are modeler’s files.

• 0.xml - This contains initial states of memory variables of agents, ini-tialization of all memory parameters.

The number of the resulting XML files depends on number of iterations specified in the model run (through Main.exe).Figure 4.1 shows which parts of the model are written by modelers and which are the code produced by Xparser. Figure 4.2 shows how the software blocks exists and interact with the input files in the block diagram.

4.1 Setting Up FLAME

FLAME executes on Windows, MacOS and Linux operating systems. The list of files required:

• Latest version of the framework (Xparser)

• C compiler such as the GNU compiler

• Libmboard files for parallelization tailored for all windows, macos and linux users.

FIGURE 4.2: FLAME software blocks.

4.1.1 MinGW

The recommended C compiler is MinGW, built in Unix. Windows users can download a copy from the following link: http://sourceforge.net/

project/showfiles.php?group_id=2435&package_id=240780 Configuring MinGW for Windows users:

Computer → Properties → Advanced settings→ Environment variables

→System variables

Select ‘Path’ and edit it as follows:

• Add the path of the MinGW after ‘;’

C:\MinGW\bin

• Rename

C:\MinGW\bin\mingw32-make.exe to ‘make.exe’

4.1.2 GDB GNU Debugger

For debugging, GDB GNU Debugger is recommended. It is freely available with how-to-use tutorials. You can get your free copy from the following link:

http://sourceforge.net/project/showfiles.php?group_id=

2435&package_id=20507

Note: Windows users are recommended to use the version 5.2.1 (available at the above link).

4.1.3 Dotty as an Extra Installation

The parser creates diagrams about the function flow in the model. These are created in an ‘.dot’ format. In order to view these files, download Graphviz from www.graphviz.org. Grpahviz also allows the files to be converted into other forms of images or formats like pdf.

Im Dokument Agent-Based Modeling (Seite 87-93)