Archive for the ‘MAS’ Category

TADA!

Saturday, November 1st, 2008

I have submitted my Masters thesis today! It was pure adrenaline during the past month, but it was well worth the effort.

The problem is that I am so wound up that I can’t prevent myself from working a little bit more on AgentSpotter. So I have created a Java Web Start aka JNLP version that you can launch from here.

AgentSpotter beta

Monday, October 6th, 2008

Today I demoed AgentSpotter to Rem, my thesis supervisor, and he was really pleased so he gave me the green light for the final write up. I’d like to say that it’s just a formality now, unfortunately writing is much harder than programming for me. However I feel much lighter now that the coding part was signed off, and I think the last mile won’t be too stressful after all.

I am so proud of what I have achieved at this stage. I knew I wasn’t a bad programmer, but what I did on AgentSpotter was good beyond my own expectation. I felt like a Jedi drawing on all his accumulated experience and wisdom to write a program using an unfamiliar language, an unknown platform and a completely experimental domain. Coding was like eating peanuts, once I had started, it was very hard to stop.

Well, I have to stop coding now and start writing. Actually I think I’ll enjoy that immensely too because the concepts are really cool and I really want to share them with the world (read: the only 3 people in the world that are interested in profiling for multiagent systems)!

Alefa! — like we say in malagasy.

Snapshot of AgentSpotter main features

Snapshot of the beta version of AgentSpotter

AgentSpotter alpha is out!

Tuesday, September 23rd, 2008

Despite my rusty Java skills I managed to produce the first version of AgentSpotter my Master’s project which is a profiler for the MASses (multi-agent systems).

The deadly combination of SQLite, Netbeans Platforms and Piccolo has allowed me to create a first useful version of my tool with a cool zoomable UI and a professional touch lent by the Netbeans application framework.

Bragging rights

I am aware that this profiler thingy is a little bit obscure for most people including my wife Stéphanie. But this is, as far a I know, the first occurence of such a tool. There are gazillions of MAS visualisation tools out there but AgentSpotter is the first to display performance data: flat profiles, call graphs, space-time diagram. You name it, we have it! So that’s doubly cool and that’s something I can boast about at the watercooler.

Java Love

Smalltalk is by far my favourite OOP language, then Ruby, then C# and C++. I have used Java for some university assignments in 1998 and it was OK but I wasn’t impressed, C++ was far more interesting or OCAML. These last 2 years I have used Java again and AgentSpotter is my first major project in Java. Actually I like Java as much as C#. Nifty stuff like inner classes make it quite fun to use and the new C# language constructs are cool. I don’t like the generics implementation though, it feels less natural than the C# one. Anyway, this is a great opportunity for me to discover for myself why 90% of my Master’s colleagues are Java programmers.

At the end of day, Smalltalk is the best OOP system and language ever, but that’s another story!

Downloading AgentSpotter Station

You can download it from here. NOTE: you need the JDK or JRE 1.6 to be able to run it. MacOS users will want to try the mac version.

To be able to test the application, you will need a sample snapshot file. Download this one and save it somewhere on your hard drive so that you can load it into the AgentSpotter Station.

Building From Source

The full code is available from sourceforge.

Projects under trunk:

  • AFBenchmark — test application used to generate sample snapshots
  • AF-RTE — local copy of the runtime (SVN “cheap” copy)
  • AgentSpotterFile — snapshot file handling and querying library
  • AgentSpotterVisualisation — main UI library (space time diagram implementation)
  • AgentSpotterStation — main netbeans platform based application

The code should build out of the box using Netbeans 6.1+ (it works on my 2 machines :-) Just open the AgentSpotterStation project folder inside Netbeans and build it.

If you use Netbeans 6.5 beta, you have to change agentspotter/trunk/src/AgentSpotterStation/nbproject/platform.properties so that “enabled.clusters” contains “platform9″ instead of “platform”.

Pictures

This is a picture of the first concept dated from May 2008:

Here’s a screenshot of the actual application:

The realisation is much better than the idea. The zoomable UI is lots of fun to use, holding the mouse allows you pan or zoom (right button). I even added a “Bird’s Eye” view.

And here is the final touch, the cheesy logo! (I will ask my friend Stan to design a better one…)

Quick User Guide

After the first startup two windows will be open on the left hand side:

  • The Snapshot Explorer
  • The Bird’s Eye View

To load an existing snapshot file, right click on the “AgentSpotter Snapshots” root folder in the Snapshot Explorer and select “Add”. Use the displayed dialog to select “profile.aspot” for example.

Once the the snapshot is loaded you will have access to the different recorded sessions.

For each session the context menu contains the following options:

  • Open: display the Summary Window.
  • View: display the Space-Time Diagram.

The Summary Window contains a bunch of JTables that provide synthetised information about the session. The most interesting of course is the flat profile which reports the most CPU hungry agents.

The Space-Time diagram is a Zoomable User Interface:

  • Double clicking with the left mouse button will zoom into a component.
  • Double clicking with the right mouse button will zoom back to the parent or container of a component.
  • Right clicking and holding the button while moving the mouse will zoom in or out.
  • Left clicking and holding the button while moving the mouse will pan the view.
  • Hovering over a component (message send/receive, message line, agent name etc.) will popup a yellow tooltip.
  • Click in the Bird’s View Window and move the viewport to navigate in the diagram. You may have to move/resize the window to get the desired effect!

Building Agent Factory in NetBeans 6.1

Sunday, August 17th, 2008

After nearly 2 years of hard work, I am not done yet with my Master’s degree in Advanced Software Engineering because I still have a project to complete and a dissertation to write. I have chosen to work on a great multiagent system (MAS) development toolkit called Agent Factory, developed and maintained at my university, UCD. Even if it is a research project, Agent Factory is quite usable and is improved all the time. For my dissertation, I will have to extend the existing code to include a performance measurement infrastructure that will provide data for the MAS performance analysis I am planning to implement. So I have downloaded the code and I have begun to play with it. Not being a Java head I had some difficulty getting NetBeans to build properly the full system. The problem was me and my understanding of course, not the code which has perfectly up to date Ant build scripts. So after a full afternoon of fumbling around I managed to get everything to build smoothly and I thought that for the non-Java people around there, it could be nice to have a quick startup guide.

So, after downloading the Agent Factory source code from the CVS how do you build it? Well, it depends if you are using an IDE or Ant. But first you have to understand the build architecture. The first level module is the runtime environment, “AF-RTE”. This module does not reference any other component than the standard Java APIs. Then comes the Debugger runtime, “AF-Debugger”, and the common release APIs, grouped under “Common”, that both need only “AF-RTE”. Finally the Agent Factory development kit, “AFAPL2-DK”, references all the modules we have just cited. There are also a bunch of secondary modules that do not change much: “HTPP-MTS”, “Local-MTS” etc. Note that I do not include “AF2ME” in this tutorial, but basically you should be able to apply the recipes I am describing here.

If you want to use Ant only, then you can compile a module by going into the corresponding directory and type “ant compile” or “ant release” if compile is not available. You have to make sure that the “af-release” property defined in the “build.properties” files are consistent because the build system uses the provided value to build JAR file names that are referenced by the compilation targets. In other words, just make sure all the “af-release” properties are set to the same value throughout the properties files. There is a special build file in the “full-build” module that goes through all the projects. My advice is to read carefully the Ant build files to discover where the files are output.

If you want to use an IDE, which is more likely, the idea is that you want reproduce the dependencies described earlier. Here’s the detail of my NetBeans 6.1 configuration procedure to give you an idea of what you need to do. First I have added “AF-RTE” as a NetBeans Java project with existing source code. I specified the “$YOURPATH/AF-RTE/src” full path as the only source package folder (Note: replace $YOURPATH with the path you’re using). No other configuration step is required as “AF-RTE” depends only on the standard Java APIs. I added “AF-Debugger” the same way, pointing “$YOURPATH/AF-Debugger/src” as the source package folder, but this time I added the output of the “AF-RTE” project, “$YOURPATH/AF-RTE/dist/AF-RTE.jar”, as a compile-time library (you can also point to “$YOURPATH/AF-RTE/build/classes”.)

The “Common” module must be added as a “Java Free-form project” based on the existing Ant build file. In the “New Java Free-Form Project” wizard dialog, specify the path “$YOURPATH/Common” as the project location and “$YOURPATH/Common/build.xml” as the build script. Then select “compile” or “release” as the action for building the project. Finally add the different “src” folders as source package folders. After validating the wizard, display the properties of the new project to add some additional information to the “Java Sources Classpath” category. Make sure “Separate Classpath for Each Source Package Folder” is checked, then add the classpaths as follows:

  • Compatibility/src: add “$YOURPATH/Common/Logic/build/classes” and “$YOURPATH/AF-RTE/build/classes”.
  • Logic/src: add “$YOURPATH/AF-RTE/build/classes”.

Do the same for the “AFAPL2-DK” project with the following dependency settings:

  • Compiler/src: add “$YOURPATH/Common/Logic/build/classes” and “$YOURPATH/AF-RTE/build/classes”.
  • Core/src: add “$YOURPATH/AFAPL2-DK/Interpreter/build/classes”, “$YOURPATH/Common/Logic/build/classes” and “$YOURPATH/AF-RTE/build/classes”.
  • Debugger/src: add “$YOURPATH/AFAPL2-DK/Interpreter/build/classes”, “$YOURPATH/Common/Logic/build/classes” and “$YOURPATH/AF-RTE/build/classes”.

The following screenshots show what you should obtain the project properties pages for the AFAPL2-DK project:

List of Source Package Folders for AFAPL2-DK

List of Source Package Folders for AFAPL2-DK

Classpath example for the Core AFAPL2-DK package

Classpath example for the Core AFAPL2-DK package

Do the same for the other modules you require like “HTTP-MTS” or “Infrastructures”, et voilà, you should obtain the following Project view in NetBeans:

Final list of projects

Final list of projects

I know that hardcore Java heads will find all this perfectly obvious and redundant, but I didn’t write this article for them so all is well. And no, this is not dogwash.