Jill

This project is maintained by agentsoz

Who is Jill?

Rather, what. Jill is a fast, scalable, and lightweight execution engine, written in Java, for programming cognitive agents in the BDI tradition.

Say what?

Okay, if you know object oriented programming, then we are talking about its newer cousin called agent-oriented programming, which loosely fits within the field of artificial intelligence research. That's a paradigm shift for the programmer, just like object-oriented programming was compared to structural programming before that. So replace objects with agents, fields with beliefs, and methods with plans, and you're half way there.

What is BDI?

BDI programming is a style of agent oriented programming. BDI, which stands for Belief-Desire-Intention, is a cognitive framework for implementing practical reasoning in computer programs. It has its roots in philosophy, and is based on Bratman's theory of human practical reasoning and Dennett's theory of intentional systems. A BDI agent is characterised by an informational state (beliefs) about the world, a motivational state (desires) or objectives in the world, and a deliberative state (intentions) or commitments that are current in the world. It uses these mental attitudes to rationalise its actions, much like humans do (that last part is debatable).

Conceptually, BDI programs achieve their goals and react to different situations by matching pre-programmed abstract recipes, or plans, to the situation. For example, a programmer may provide two plans that could be used to get to work. While one plan may involve cycling to work, the other may require catching the bus. Which one of these will be used by the agent will depend on the situation, such as whether the agent believes it is going to rain or not. BDI agent systems are particularly well suited for dynamic environments where enabling conditions for a course of action can change quickly.

There is a nice overview of BDI systems in Chapter 2 of my PhD thesis, if you want a quick tour of BDI concepts and research in the last two decades.

Why Jill?

A plethora of BDI systems exist already, we hear you say. JACK. Jadex. Jason. And friends. So why do we need yet-another-BDI-engine? We should have called it Y-a-b-e anyway, you add.

That's a fair question. When we started integrating cognitive (BDI) agents with social (agent-based) simulations, we happily used the existing systems for many years. In fact, we still maintain and use an integration framework we developed, for coupling off-the-shelf BDI systems (like JACK and Jadex), with off-the-shelf ABMs (like Repast, and MATSim.)

Eventually, however, we started hitting a bottleneck as we began playing with larger simulations. Most existing BDI systems are just not built for scale. So over the years, we drew up our specifications. We wanted something scalable, fast, lightweight, open-source, extendible, and Java-based. We wanted a million BDI agents. Running on our not-so-state-of-the-art laptops with 2 GB of RAM.

So out in the outback, Jill was born. Now she is old enough to join the playground.

Why Java?

Rewind. Did we say fast, scalable, and Java all in the same breath? Surely, if we are talking optimised code, then Java is not the best choice? Wouldn't one want a native program and not something that runs within the Java Virtual Machine? Wouldn't the Java Garbage Collector kill performance before one could say, cheese and crackers?

We don't disagree. These are real concerns. Indeed, C or C++ for instance, might be better candidates. However, here's the thing. In the end, Jill wasn't to live in a void. By design, we wanted something that could be easily plugged into agent-based simulation platforms. Incidentally, many of our target platforms (like Repast, MATSim, NetLogo) live in a Java ecosystem. While it is possible for native programs to interact with Java through the Java Native Interface, these calls have insignificant overheads, and a poorly designed interface could easily kill any benefits of the native program. It also makes the entire development process more involved, since one has to then consider OS specific issues in the entire life cycle. Plus we wanted the user set up to be as simple as possible. Drop in the JAR file, and Jill's your aunt.

So in the end it was a strategic decision more than anything else, to use Java. That said, Jill is no Echidna either, Emu more like, and outruns its friends when it comes to performance.

What's the catch?

Nothing really, other than that Jill is still young. She is everyone's baby sister, and does not have all the advanced features of the big boys yet. But she is developing fast, and what she does she does pretty well.

How do I use it?

In a nutshell, you put the Jill release JAR on your classpath, and start coding. The programs you write are still Java programs, but you extend the agent specific classes that Jill provides and add Java annotations to your code so Jill knows how all the elements of your agent program fit together.

Jill is available from Maven's Central Repository. We assume you know how to use maven, but if not, here is a five minute tutorial. To use Jill, just add the dependency to your pom.xml.

<dependencies>
    ...
    <dependency>
        <groupId>io.github.agentsoz</groupId>
        <artifactId>jill</artifactId>
        <version>0.4.0</version>
    </dependency>
    ...
</dependencies>

That's it. You're ready to write your first agent program in Jill. Let's do that now.

Hello Jill!

Keeping with tradition, our first agent program will print Hello World Jill!

Before we start, remember that the process of writing agent programs in Jill is no different to writing Java programs. You do not need to change your Java development workflow in any way. In fact, we ourselves use Eclipse/Maven to write all our agent programs in Jill.

The instructions below assume you are working with Eclipse/Maven, so your mileage will vary if your set up is different. That said, any Java workflow should be fine, as long as you have the Jill JAR on your classpath. (If you are not using Maven, then you can download the JAR directly from Maven's Central Repository.)

First, the concepts.

Every BDI agent program in Jill has three parts:

As a minimum, you need one of each to get going. So to build our greeter agent, we will create a new agent type (in a new class called Greeter.java), give it a goal to greet people (in Greet.java) and add a plan that it can use to achieve this goal (in SayHello.java). Let us look at these one by one.

The Greeter agent Greeter.java

Here is the most basic agent program that you could compile in Jill. All it does is extend the Jill Agent class, and add a constructor.

package greeter;
import io.github.agentsoz.jill.lang.Agent;

public class Greeter extends Agent {
    public Greeter(String name) {
        super(name);
    }
}

Contact

For more information contact Dhirendra Singh (@dhixsingh).