©Copyright JASSS

  JASSS logo ----

Kai-H. Brassel (2001)

Flexible Modelling with VSEit, the Versatile Simulation Environment for the Internet

Journal of Artificial Societies and Social Simulation vol. 4, no. 3,
<https://www.jasss.org/4/3/10.html>

To cite articles published in the Journal of Artificial Societies and Social Simulation, please reference the above information and include paragraph numbers if necessary

Received: 29-Jun-01      Published: 30-Jun-01


* Abstract

Social science research calls for the explorative modelling of complex problem domains. A modelling tool that aims at supporting this kind of effort has to strike the balance between offering sufficient flexibility for free exploration on the one hand and effective measures to relieve the modeler from the more cumbersome parts of programming on the other. The Java-based VSEit framework, presented in this paper, embodies a pragmatic approach to strike that middle ground. One key element of the VSEit architecture is the supplementation of the usual object-oriented class concept with the capability for specifying types of model entities and structures at a high semantic level.

Keywords:
Object-oriented simulation, multi-paradigm modelling, Java, simulation framework, web-based simulation, simulation visualization.

* Introduction

1.1
This contribution offers a general overview of the architecture, capabilities, and use of the Versatile Simulation Environment for the Internet (VSEit), a Java-based modelling and simulation framework. Another article in this issue of the JASSS (Haffner & Gramel 2001) presents a real-world application of that tool. (Additional information and examples of simulation models are accessible via the VSEit home page at www.vseit.de.)

1.2
VSEit (pronounced as "use it") was developed by the author at the Department of Sociology of the Technical University of Darmstadt, Germany. Several versions of the framework were used by students and scientists in teaching and research, for studying the interplay of social, economic, and natural processes.1 Common to these applications are the explorative style of modelling and the high complexity of problem domains.

1.3
Rather than providing predictions about future states of a target system, explorative modelling and simulation serves to build an understanding of the principle behavior and functioning of a system (Troitzsch 1997). A complex problem domain may roughly be characterized by the presence of many system elements of different types that are connected by different types of relationships, and are possibly placed at different levels of the system's hierarchy.

1.4
Complex problem domains call for a multi-paradigm modelling approach. According to Vangheluwe (2001), multi-paradigm modelling aims at integrating (1) different modelling formalisms, (2) the description of models at different levels of abstraction, and (3) different model classes (or types) tailored to specific problem domains.2 Given the heterogeneity of domains addressed by Social Science Simulation and the multitude of modelling formalisms used (Troitzsch 1997; Gilbert & Troitzsch 1999), there is a need for the development of simulation tools that support multi-paradigm modelling in this area of research.

VSEit was designed to support the flexible creation of simulation models. It enables the modeler to

1.5
Usually, the explorative modelling of complex domains requires the implementation of simulation models from scratch, with universal programming languages and integrated development environments (IDEs). While these, especially the new object-oriented ones, provide many useful capabilities and base technologies for modelers, they do not support simulation-specific tasks like model specification and parameterization, animation of model entities, visualization of simulation results, interactive simulation control, and so on. The VSEit framework tries to fill that gap. It constitutes a pragmatic approach to combine the comfort of high-level simulation tools with the flexibility of universal programming languages.

The remainder of the text presents two example models, gives an overview about the architecture and features of VSEit, describes how to implement types of model entities, and offers some conclusions.

* Example Models

2.1
This section introduces VSEit from the end-user's point of view. From the dozen or so simulation models that were implemented within the VSEit framework so far, we present two quite different models in order to illustrate the versatility of the tool. The first model is an irregular cellular automaton simulating opinion formation processes, the second a variable structure model of technological change and the behavior of economic firms.

2.2
Besides the "logical" versatility that VSEit offers in not restricting the modeler to a specific model type, it also offers a high degree of "physical" versatility, meaning that VSEit simulation models, by virtue of being Java-based, can be executed within any web browser connected to the World Wide Web. Since the reader can view the model's on-line documentation and even run simulations on his or her own computer, the discussion of the example models in the following will be brief.

Opinion Formation in an Irregular Cellular Automaton

2.3
The first example is a simple opinion formation model that was used in an introductory course on social science simulation. Unlike the synergetic two-level models of opinion formation, in which individuals determine their new opinion stochastically depending on the average opinion found in the population (Weidlich & Haag 1983, pp. 18-53), the individuals here interact directly at micro level, and only there.

2.4
Cellular automata (CA) are often used to implement a relatively big number of entities interacting via fixed relations. The easiest to implement are chessboard-like regular CAs, but these often cause simulation artifacts because of their very regularity. In order to avoid such artifacts, and also to achieve greater realism, irregular CAs are a better choice in many cases (Hegselmann et al. 1999).

2.5
Figure 1 shows a snapshot of the simulation of an opinion formation process within an irregular cellular automaton. Since the snapshot was taken from the simulation model running as a Java application, the application's main window includes all the (internal) windows that make up the simulation model's graphical user interface (GUI). If the model would run as an applet instead, the same internal windows would be displayed within the web browser. If you like to see the simulation run in your browser, visit the model's home page at www.vseit.de/de/vseit/examples/cellularOpinionFormation/index.htm and follow the instructions given there. Note that your browser must support the actual Java version (JDK 1.3) for running a VSEit simulation. Netscape Communicator 6, for example, has the actual Java version already built in, while older browsers like Netscape Communicator 4.7x or Windows Explorer 5.5 require that a plug-in of size 5MB is loaded into your browser once.

Screenshot Cellular Opinion Formation

Figure 1. Snapshot of the Cellular Opinion Formation simulation model

2.6
The largest of the three internal windows in Figure 1 shows a repository with all model entities that the modeler decided to present to the user in iconic form. Each individual is shown as a cell in the irregular cellular automaton with the individual's opinion represented by the cell's color. Note that it is up to the modeler to decide if single cells should be accessible (clickable) by the user for inspection and editing, or if the CA as a whole is modelled as one single object, albeit a more complicated one.

2.7
Next to the CA, on the left, you see other model entities common to all VSEit simulations: The model itself, one or more random number generators (symbolized by shamrocks) and one or more active model entities that are able to generate simulation events (ovals). The sub-pane on the right shows the attributes of the model entity which is currently selected. Obviously, the attributes of the model entity represent global model parameters. Hence, one use of the repository is the interactive specification of initial states of model entities and, as we will see below, their relations. A second important service offered by the repository is the visualization and animation of model entities (and structure) during simulation. In the application described here, this would be, for example, the display of how the spatial distribution of opinions changes over time.

2.8
This iconic simulation output is complemented by the output of the window in the top right corner of Figure 1, showing the time series of the summed opinions of all individuals. VSEit currently supports the animated display of time series, phase diagrams, scattergrams and arbitrary functions, e.g. frequency distributions.

2.9
The smallest window contains the buttons to control the simulation run, to generate, show, and hide other simulation windows, and to display text messages generated by the simulation. Once model parameters have been provided and accepted, and the user has pressed the "run" button, the simulation will be executed one simulation step after the other, driven by the one and only active model entity named "Clock." In each simulation step, then, each individual cell (representing an individual) randomly chooses a neighbor cell to adopt that one's opinion, or, depending on the parameter Weight of own opinion, sticks to its own opinion (for more details on the model semantics, see the on-line documentation).

Greening Investors

2.10
The Greening Investors model was originally implemented using the MIMOSE simulation environment (Möhring 1996). It reproduces some of the stylized facts that can be observed around the processes of invention, innovation, and diffusion of new technologies in an economy. For a detailed model description, including MIMOSE code, see (Brassel et al. 2000). The VSEit version of the model is accessible under www.vseit.de/de/vseit/examples/greening/index.htm.

2.11
Figure 2 shows the outcome of a simulation run after 300 time steps. The repository contains a series of rectangles, each representing one of the technologies that are available at the current time step. A technology is characterized by its labor and energy productivities, both displayed as floating point numbers. During the simulation, the active model entity labeled "Invention" randomly adds a new technology from time to time, according to a Poisson distribution. Following given trend parameters, new technologies will on average be more efficient than older ones.

Screenshot Grenning Investors

Figure 2. Snapshot of a Greening Investors simulation run

2.12
The circles at the bottom of the repository represent individual firms. A solid line links each firm to the technology that it currently uses for production. Firms utilizing more efficient technologies than their competitors experience a greater output growth. Since the diameter of a circle is proportional to the output of the firm it represents, some circles will grow over time, while others will shrink. Firms that fall below a certain output threshold begin to look for a better technology. All firms are modelled to differ in their preference for energy and labor productivity (a feature that departs from conventional economic analysis). As soon as a new technology that suits such a firm's preference is available, its link is redirected to that new technology, indicating an innovation. Note that production and innovation on the one hand, and invention on the other, are modelled as concurrent processes.

The chart titled "Long Waves" illustrates the working of the advanced data sampling and output facilities of VSEit, as discussed below. It shows the rise and fall of technologies by plotting the sum of all goods produced with one technology over time. Whenever a new technology is created during a simulation run, a new curve is automatically inserted.

* Architecture and Features of VSEit

3.1
Figure 3 shows an overview of the VSEit architecture and the interdependencies between Java, VSEit components, and models, or model types, respectively. An arrow pointing from one component into another indicates that the former uses the latter.

Architecture of VSEit

Figure 3. VSEit Architecture

3.2
The rounded rectangles labeled network, showit, and simulation represent the three packages of classes that together constitute the Versatile Simulation Environment for the Internet. Other elements, also essential for using the framework, like template files, documentation, and examples, were omitted from the figure in order to keep it simple.

3.3
One way of creating models with VSEit is depicted by the squares a, b, and c. These represent models like the two examples described above that are built directly on top of the three VSEit packages. There is also an arrow pointing directly from the models to the Java box, indicating that the modeler still has to use the Java programming language and a (small) subset of Java's huge application programmers interface (API) to implement the models. This way, the modeler may introduce new types of model entities and behavior step by step, thus supporting an explorative style of modelling. On the other hand, the very same mechanisms can be applied to implement a specific model type, say C. Then, other modelers, or even end-users, will be able to graphically specify simulation models of this type (ci) without having to write any Java code themselves.

3.4
The network package provides the infrastructure required for defining, at a high semantic level, types of model entities, including their appearance on screen, their attributes, and their relations to other entities. Although these definitions are declarative in style, they still are coded within Java class source files, thus preserving the possibility to attach arbitrary behavior to the entities by defining methods in the usual fashion, including inheritance. This seamless integration of the powerful Java class concept with a "modeler-friendly" type concept was achieved by utilizing an advanced software technology called reflection. Reflection is the ability of an application to inspect its program while it is running and subsequently process information about its classes, variables and methods. Java's API for coding reflective operations has become more sophisticated with recent versions. However, this mechanism had to be carefully applied in VSEit, to avoid too big an overhead in run-time.3

3.5
Based on this infrastructure, the network package also provides a graphical network editor that allows the manipulation of arbitrary types of model entities and structures. All editing and animation of the entities and relations in a model's repository is handled by this generic user interface.

3.6
The sampling and display of numerical simulation results is supported by VSEit in a generic and interactive fashion, too. For example, in an agent-based model, the user may want to, upon observing the fate of some agents, check what is going on with other agents. VSEit allows such switching between objects to be viewed while a simulation is running. This is very useful for exploring the behavior of complex simulation models. Since standard output libraries do not accomplish this task, the showit package had to be developed for this purpose. It provides a slim API for computing and storing simulation results as well as several types of charts that are automatically updated while the simulation is running. Moreover, the GUI adapts to the dynamic creation and deletion of data sources during a simulation run.

3.7
While network and showit are self-contained software components that could be built into different sorts of applications, the simulation package depends on both of these. It provides simulation specific services, e.g. time management, interactive simulation control, window management, on-line help, random number generators, and the administration of simulation runs. Again, a high degree of genericness and interactivity was aimed at in the implementation of these functions. The window management system, e.g., is designed to handle custom window types provided by the modeler. Also, the introduction of an efficient event scheduler and of active model entities elegantly covers many time models.

3.8
The implementation of the VSEit features described above strongly draws on the advanced software technologies built into the current Java platform, e.g. enhanced reflection, inner-classes syntax, powerful data structures, modern and fast GUI (Swing), comprehensive graphic functions, bit-wise compatible arithmetic, and HTML support. As a simulation platform, Java has far more to offer than suggested by the numerous simulation applets developed ad hoc that can be found in the World Wide Web.

* The VSEit Architecture in Practice: Implementing Types of Model Entities

4.1
To see how the VSEit architecture works in practice, especially how the entities and entity types are implemented, we revisit the Greening Investors model. A relatively big portion of the model code for the two most important entity types in that model, technologies and firms, is discussed below. Note that for a full understanding of the following explanations, the reader must have a basic knowledge of object-oriented programming concepts and Java syntax.

4.2
As already mentioned above, a key feature of the VSEit architecture is the combination of the high-level definition of entity types, their appearance, attributes, and relations, with the flexibility of an object-oriented programming language. To utilize this feature, the modeler declares a new class, say Technology, in the usual way. (Later on, instances of this class will represent particular technologies in the Greening Investors model.) To make this ordinary Java class function as an entity type in the framework, the modeler declares special fields also at class level. The following initialization of the reserved class variable MULTIPLICITY, e.g., specifies that a model must have at least two technologies to be valid. VSEit guarantees the automatic satisfaction of this constraint.

  public static final Multiplicity MULTIPLICITY = new Multiplicity(2);

4.3
The following compact statements define the attributes and roles (i.e. types of relations) that technologies possess. The identifiers displayed in blue font denote predefined VSEit classes specifying the type of an attribute or role. The green parts determine the name for accessing the attribute or role within the model code and the label, that represents the corresponding value (of the attribute) or link (of the role) in the GUI. The multiplicity of an attribute or role (displayed in orange font) defines how many values or links an entity of that specific type is allowed or required to have.

  public static final IntegerAttribute KEY = new IntegerAttribute(
    "ID: ",Multiplicity.OPTIONAL,false,null,null,new ValueLook());
  public static final DoubleAttribute A = new DoubleAttribute(
    "Labour productivity: ",Multiplicity.MANDATORY,true,null,null,new ValueLook(Color.blue),2);
  public static final DoubleAttribute B = new DoubleAttribute(
    "Energy productivity: ",Multiplicity.MANDATORY,true,null,null,new ValueLook(Color.green.darker()),2);
  public static final DoubleAttribute C = new DoubleAttribute(
    "Capital productivity: ",Multiplicity.MANDATORY,false,null,null,null,2);
  public static final Role FIRM = new Role(
    "firm",Firm.class,Multiplicity.OPTIONAL_MANY,false,new LinkLook());

4.4
In the above, we see that a technology may store any number of firms under the role FIRM, while the attributes A, B, and C require exactly one value each to be specified for a technology. The boolean values following the multiplicity determine whether or not the end-user is allowed to manually edit the corresponding values or links in the network editor. The dark red portions of the statements determine the visual appearance of values and links in the GUI.

4.5
The following statement specifies that technologies are depicted in the network editor by rectangular shapes of a certain size with a black border of one pixel width, and an inner color being the same as the background of the surrounding pane.

  private static EntityShape SHAPE = new EntityShape(new Rectangle(0,0,34,20),1,Color.black,null);
  public EntityShape shape()
  {
    SHAPE.setInnerColor(entity().isEmpty(FIRM) ? null : Color.white);
    return SHAPE;
  }

4.6
The above method causes the inner color of a technology icon to turn white as soon and as long as the technology is used by any one firm. The blue part shows how the actual value (link) of an attribute (role) is accessed. First, the method entity() is called to obtain the Java object that actually stores the values and links attached to the technology. Then, sending a predefined accessor message – isEmpty() in this case – delivers the values (links) under the respective attribute (role).

4.7
The above statements pertain to the definition of an entity type. The below method encodes some of the behavior modeled within the class Technology. Again, the firms associated with the technology are accessed via the role FIRM, this time to traverse the list of firms in order to compute the total output produced by the the technology (kt).

  double produce()
  {
    kt = 0.0;
    Iterator iter = entity().iterator(FIRM);
    while (iter.hasNext())
      kt += ((Firm)iter.next()).produce(this);
    return kt;
  }

4.8
Now we turn to the firms. The following statements extracted from the source code of class Firm cause individual firms to be symbolized by a circle whose actual diameter is proportional to the firm's production output (k). Firms preferring improvements in energy productivity over improvements in labor productivity (controlled by the instance variable proEnergy) receive a green color; firms with the reverse preference are colored blue.

  private static final EntityShape SHAPE = new EntityShape(new Ellipse2D.Float(0,0,15,15),1,Color.black,null);
  public EntityShape shape()
  {
    SHAPE.setInnerColor(proEnergy ? Color.green : Color.blue);
    return SHAPE;
  }
  public double entityViewWidth() {return 300*k;}
  public double entityViewHeight() {return 300*k;}

4.9
Firm production (k) is computed by method produce(). Given technology t, this method accesses the technology's labor productivity by the expression t.entity().get(t.A) and the energy productivity by t.entity().get(t.B).

  double produce(Technology t)
  {
    k = k + model.dt * k / t.entity().get(t.C) 
        * (1 - model.w/t.entity().get(t.A) - model.p/t.entity().get(t.B));
    if (k < model.lowerlim)
    this.innovate(t);
    entity().changed("shape");
    return k;
  }

* Conclusions and Outlook

5.1
Social science research needs, and increasingly relies on, the explorative modelling of complex domains. Experience with the Java-based VSEit framework suggests that it effectively and efficiently supports such explorative modelling. By exploiting advanced object-oriented technologies, VSEit combines the flexibility of a universal programming language with the expressive power of type-based modelling.

5.2
Despite VSEit's capability to produce highly complex and easy-to-handle simulations, developing a new simulation model, or even inventing a new model type, only requires moderate programming skills. In addition, VSEit provides a generic tool for the graphical definition of models belonging to different model types. Being implemented in the same environment, models of different types can be integrated, thus facilitating multi-paradigm modelling.

5.3
The VSEit framework is continuously being improved and upated. The current version of the software and the documentation is accessible on the VSEit website at www.vseit.de. Planned extensions to date include enhanced network semantics and operations; common model types, e.g., belief networks; and distributed simulation and gaming.


* Notes

1 The development of the VSEit framework benefited from the close contact to many domain experts and students, both of whom were avid users who provided valuable feedback on the design of the software.

2 For an illustration of the benefits and difficulties of combining different modelling formalisms, see Peters & Brassel (2000).

3 A comparison of the runtime performance of SWARM and VSEit show that the VSEit simulation, with all animation features switched on, runs about three times as long as the SWARM simulation. This is not a bad result, considering that the Java code of the VSEit model is interpreted for execution, while the SWARM code is compiled by a native compiler. When switching off the special animation capabilities of VSEit, its runtime decreases considerably (Brassel 2001; SWARM Development Group 2001).


* References

BRASSEL K H, Edenhofer O, Möhring M and Troitzsch K G (2000) "Modelling Greening Investors: Economic Development, Opinion Formation, and Technological Change in a Multilevel Simulation Model" In Suleiman R, Troitzsch K G and Gilbert N (Eds.), Tools and Techniques for Social Science Simulation, Heidelberg, Physica. pp. 317-343.

BRASSEL K H (2001) "Advanced Object-Oriented Technologies in Modeling and Simulation: the VSEit Framework" In Kerckhoffs E J H and Snorek M (Eds.), Modelling and Simulation 2001, 15th European Simulation Multiconference, Society for Computer Simulation International, pp. 154-160.

GILBERT N and Troitzsch K G (1999) Simulation for the Social Scientist. Open University Press.

HAFFNER Y and Gramel S (2001) Modelling Strategies for Water Supply Companies to Deal with Nitrate Pollution. Journal of Artificial Societies and Social Simulation, 4(3), https://www.jasss.org/4/3/11.html.

HEGSELMANN R, Flache A and Möller V (2000) "Cellular Automata as a Modelling Tool: Solidarity and Opinion Formation" In Suleiman R, Troitzsch K G and Gilbert N (Eds.) Tools and Techniques for Social Science Simulation. Physica, Heidelberg, pp. 151-178.

MÖHRING M (1996) "Social Science Multilevel Simulation with MIMOSE" In Troitzsch K G, Mueller U, Gilbert N and Doran J E (Eds.), Social Science Microsimulation, Springer, Berlin.

PETERS I and Brassel K H (2000) "Integrating Computable General Equilibrium Models and Multi-Agent Systems – Why and How" In Sarjoughian H S et al. (Eds.): 2000 AI, Simulation and Planning In High Autonomy Systems, SCS, pp. 27-35.

SWARM DEVELOPMENT GROUP (2001) "Documentation Set for Swarm", http://www.swarm.org/release-docs.html.

TROITZSCH K G (1997) "Social Science Simulation – Origins, Prospects, Purposes" In Conte R, Hegselmann R and Terna P (Eds.), Simulating Social Phenomena. Springer, Berlin, pp. 41-54.

VANGHELUWE H, Kerckhoffs E J H and Vansteenkiste G (2001) "Computer Automated Modelling of Complex Systems" In Kerckhoffs E J H and Snorek M (Eds.), Modelling and Simulation 2001, 15th European Simulation Multiconference, Society for Computer Simulation International, pp. 7-18.

WEIDLICH W and Haag G (1983) Concepts and Models of a Quantitative Sociology. Springer, Berlin.

----

ButtonReturn to Contents of this issue

© Copyright Journal of Artificial Societies and Social Simulation, 2001