Jaak

Contents

Jaak: When Janus Agents become Turtles

Jaak Logo

Jaak is a reactive agent execution tool that runs on the synchronous engine of Janus. It provides a discrete 2D environment model and a simplified interaction model based on LOGO-like primitives. Its purpose is similar to NetLogo, StarLogo, and TurtleKit.

Jaak relies on a logo-based simulation model. Unlike StarLogo or NetLogo, Jaak proposes a Logo programming approach while giving all the possibilities afforded by high level programming languages such as Java and Ruby.

Jaak is particularly well suited for modeling complex systems developing over time. Modelers can give instructions to hundreds or thousands of "agents" all operating independently. This makes it possible to explore the connection between the micro-level behavior of individuals and the macro-level patterns that emerge from the interaction of many individuals.

Jaak lets students open simulations and "play" with them, exploring their behavior under various conditions. It is also an authoring environment which enables students, teachers, and junior and senior developers to create their own models.

Motivations

Our primary goal when developing Jaak is to provide a simple but powerful library to develop situated multi-agent simulations. Additionally Jaak permits to test the Janus modules on a more complex system than the already provided demos.

The aims of Janus is to fill the gap between the easy-to-use platforms, eg. TinyMAS, NetLogo, StarLogo), and the advanced simulation platforms, eg. Swarm.

From Logo to Jaak

Logo is a reflexive and functional programming language from the Massachusetts Institute of Technology (MIT). In the 21st century, Logo is mainly known for its famous graphical turtle, even if it is able to use lists, files and several inputs/outputs. It is well suited for teaching, especially algorithmics.

Powerful language, Logo was paradoxically victim of his turtle which confined to a childish image. It was a good introduction to structured and modular programming, and artificial intelligence. But in Jaak only a part of the turtle's features has been exhibited. The Java language primitives are preferred to support the rest of the Logo primitives.

In Jaak a Turtle in an situated Agent which is able to move on a 2D discrete grid.

Motion Primitives

The supported motion primitives are listed in Table 1. Descriptions are given in the Jaak context, not in Logo context.

Table 1: Mapping between Logo and Jaak Concepts
Definition Logo Primitive Jaak Function
Turtle moves forward by n cells. FD n or Forward n
Turtle moves backward by n cells. BK n or Back n
Turtle turns about n degree on the right. RT n or RIGHT n
Turtle turns about n degree on the left. LT n or LEFT n
Turtle peeks something from the grid cell. PU or PENUP
Turtle puts something on the grid cell. PD or PENDOWN
Set the direction of the turtle to an angle of n degree on a trigonometric circle. SETH n or SETHEADING n
Turtle moves on the given direction by n cells, without turning itself.

Environment Model

Jaak provides an environment model defined by a discrete 2D grid with a finite number of cells. This grid is close or wrapped according to design choice:

  • Closed Environment: when turtles try to go outside the grid, their actions are ignored.
  • Wrapped Environment: when turtles try to go outside the grid, they arrive in the opposite side of the grid.

Each cell may contains:

  • zero or one turtle
  • a collection of data put and peek by turtles

Environment model owns an endogenous engine which permits to evolve environment state according to internal laws. These laws are not managed by turtles.

Turtle perceives on the grid and emits influences to it. The agent-environment interaction mechanism used in Jaak is the Influence-Reaction model, which may be illustrated by the following algorithm:

while (true) {
    influences = new ArrayList();
    // Compute all the turtle perceptions
    // from the same grid state
    environment.computeAllPerceptions();
 
    // Run turtles and collect influences
    for(Turtle turtle : getAllTurtles()) {
        turtle.setPerceptions(environment.getPerceptions(turtle);
        turtle.live();
        influences.add(turtle.getInfluences());
    }
 
    // Run endogenous engine and retreive influences
    // produced by internal environment mechanisms
    influences.addAll(environment.runEndogenousEngine());
 
    // Solve conflicts between influences and
    // produce resulting reactions
    reactions = environment.solveConflicts(influences);
    // Update the state of the grid
    environment.applyReactions(reactions);
}

This mechanism permits to solve two problems of synchronous execution of agents:

  1. execution order of agents is no more significant because all agents are perceiving the same environment state;
  2. agents actions are supposed to act at the same time, so that simultaneous actions are now possible, and potential conflicts are solved.

Perception

Turtle is able to perceive the states of the cells around the cell on which it is located. Perception distance is given by designers.

All turtles perceive the same state at the same time. It is due to the Janus synchronous execution engine based on the Influence-Reaction approach.

Influence Gathering

A turtle action may be a movement or a cell content update. Each turtle runs its live function to decide what to do. They save there decisions in the form of influences. An influence is a "desire of action": it contains the same information content as an action, but it is not directly applied on the environment grid.

Endogenous Engine

The endogenous engine computes evolutions of the environment state outside the control of the turtles. For example, in a ant-colony simulation, pheromones evaporate. It is the role of the endogenous engine to apply such evaporation.

To avoid potential conflict with turtle's actions, the endogenous engine is not able to directly update the state of the grid. In instar turtles, endogenous engine provides influences. This feature is taken from the JaSIM environment model.

Influence Conflict Detection and Solving

When all influences are collected, conflicts between them should be detected and solved. Unfortunately, there is not a general algorithm to provide such a feature. Conflict detection and solving are application-dependent.

The influence solver has the role to transform influences into reactions. Reaction is an update primitive for the environment grid. It could be one of:

  • turtle move from cell to cell;
  • turtle turn around;
  • data put inside cell;
  • data removal outside cell;
  • data update in cell.

Other Environmental Extensions

2010-08-06Release of Janus 0.3: download, changes.
This page was last modified on 3 August 2010, at 20:22. This page has been accessed 170 times.
Copyright 2010 © Janus Core Developers - Privacy policy