The MadKit team
This FAQ may not be up to date, please get the last FAQ file at www.madkit.org
Yes, MadKit is an agent oriented middleware with which you may build distributed
applications. One of the most interesting feature of MadKit is that distribution
is done transparently. You do not have to take care of which agent is remote
or not, Madkit, is handling all the necessary communications and connections
to make agents situated on different platforms work together transparently.
All you have to care is 1) Use the message passing technique of communication
between agents, 2) Run MadKit on the two remote kernels (let us call the computers
toto.org
and riri.net
), and open a Communicator
agent on both of them. On one of them (toto.org
for instance) you
type the name of the other one (riri.net
then) and the two will
be connected. This means that the organization of toto.org
will
be seen by riri.net
(and vice-versa) except for local groups and
some communities, and that agents of both platforms may communicate. Test a
demo program (for instance ping-pong
or travel
) with
some agents on one kernel and some agents on the other one... See the User
Guide and the description
of the Communicator agent to get some details about it. You have to be aware
that MadKit works on a 'peer to peer' basis, i.e. there is no "server"
and "client". Every kernel is both a server and a client...
Yes MadKit has been widely used for agent based simulations. {{to be detailed}}. See the synchronous engine to get information about the basic tools and techniques of agent based simulation (scheduling and observation essentially), and see the Turtle kits manuals (TurtleKit and Turtle packs), a more "high level" development context for building simple reactive agents acting in a two dimension environment. Warbot is also a simulation context for testing coordination schemes, which is based on the synchronous engine.
Do you have a Java virtual machine installed. MadKit uses a Java 1.3. It uses only the JRE (run time support) for its own purpose, but if you want to develop your agents in Java, you should have a JDK 1.3 (or higher, we use JDK 1.4 for our own purposes) installed...
We have been aware of a very strange bug which may appear on some Linux distribution.
We use the InstallAnywhere program for installing MadKit. But this Java based
program does not use the command Java, and tries to guess what Java to run.
Unfortunately some Linux distribution comes with a very old Java virtual machine
(called Kaffe) and InstallAnywhere may use it by mistake. Thus, if the install
does not work, check your Java installation. Be sure that you have at least
a jdk 1.3 (type java -version
to know the version of your JVM)
installed and remove all obsolete JVM (and remove Kaffe!).
MadKit may hangs the first time you use it when you click on a Python agent.
The first time Python is used, it creates a cachedir
directory
in the install directory of MadKit. This may takes between 10 s to 30 s dependings
on your computer. But this will happen only once. Afterwards, you will be able
to use Python agents quite smoothly and quickly.
This is quite simple. You just have to modify the desktop.ini
file. See the User Guide, configuring
the Desktop.
For the moment you have to quit MadKit and start it back. The construction of the whole tree is done at launch time. This is a bug which will be solved very soon. We are really sorry about it...
You may only use the agent stuff (all the primitives concerning groups and
roles) of an agent AFTER its launch time. Thus, the best way to put all these
things is in its activate()
method not in its constructor. When
executing its constructor, and agent is still an object and not an agent yet.
This is not normal. Check the connection between the two computers, and use a demo program which uses the connection (for instance you connect the two computers using the communicator, and start a 'PingPong' agent on both computers).
If this test succeeds, then you must suppose that your agent is responsible
for it. Maybe you use a while
loop in the activate() or live()
methods in which your agent is trapped.
If it fails, check the connection between the computers. Make sure that the version of MadKit in the two computers are not too different (version 2.x and versions 3.x are not compatible, but all versions 3.1bx are compatibles). Try some 'pings' between the two computers. Check if they are connected by a network (sometimes a cable is simply missing... ;-) this happens to everybody..).
No you do not have to. MadKit is taking care of all the low level communications. You only have to concentrate on your application. If your agents may communicate inside the same kernel (the same MadKit application if you prefer), then they may communicate and interact through a network (local network or Internet). Sockets are handled by MadKit. RMI is good for client/server applications, but much too slow to be used a basis for building peer-to-peer applications. See the answer on distributed applications.
This may be due to an important point: if your messages have to transport objects,
these objects have to be declared as 'serializable'. Just make your objects
implements the java.io.serializable
interface.
Note: be aware that serialization of objects is time consuming and that serialization copy ALL the objects that are referenced by this object. Thus you should take care of not transporting "heavy" objects. Objects having only attributes of primitive types (such as numbers or booleans), or strings, or collections of such things are OK.
No you cannot. An agent should get its GUI object permanently. But if your GUI is a JPanel, you may add and remove graphic component to this JPanel dynamically.
To compile the tutorial, you have two solutions: the first one consists in
using the compile.bat
(there is no compile.sh
, but
this should be staightforward to make one from the compile.bat
for any Unix user). This file compiles the .java files, build the .class, makes
a jar and copy this jar into the autoload directory.
The second one, which is the best one I think, is to use the Ant
program, which is a kind a 'make' program written in Java. Ant
is very popular amond Java developper and if you plan to develop all your agents
in Java, you should consider Ant. We have placed a build.xml file (the kind
of file ant uses) in the all tutorial folders. This file does the same as the
compile.bat above, but does in a better way ;-). Open a shell (also called terminal,
DOS or command prompt) go to your tutorial directory and type: ant
.
That's all: the java files are compiled, the jar is made and placed in the autoload
folder automatically.
Unfortunately yes! Well, for the moment, If you want to use the Desktop, you have to reload MadKit each time you develop a recompile a Java agent, because Java does not like very much to remove and/or modify classes that have already been loaded. We work on that subject, and we hope that this will be possible in a near future....
Start with console, using the console.bat or console.sh command and define
a config.file (a config file is a XML file which contains a set of agents) which
will contain the agents you want to launch at startup. See the Console
container in the user guide to get more details and look at the testconfig.cfg
file to get the structure of a configuration file (see also the User
Guide, configuring the Desktop).
This is quite easy. If you do not use any of the provided agents (for instance
only the communicator and your specific agents) you just have to put boot.jar
with the jars of your application, and make your classpath application points
to these files. You must have some directories (at least libs/madkit
and libs/support
) to contains all the jars of MadKit that you want
to use (madkit.jar is required, but you may also use communicator.jar
if you want to connect to other kernels, system.jar if you
plan to use some of the system agents, etc.). You may need also to add some
support files (ex: xerces.jar) as third party support.
Then, in your applications you must have a line to start and initialize MadKit. In this line you should pass the argument to MadKit and express, that for instance you want to use the agents GUI, and the communicator. In this case, this line should look like:
Vector c = new Vector();
c.add("--communicator-on");
c.add("--graphics");
c.add("--config");
c.add("myConfigFile.cfg"); c.insertElementAt("madkit.platform.console.Booter",0); madkit.boot.Madkit.main((String[]) c.toArray(new String[0])); |
The console booter is the simplest init program to use for launching MadKit.
You may create your own by deriving your boot program from madkit.kernel.AbstractMadkitBooter
.
You may use a configuration file (here called myConfig.file) to launch agents
while starting your application.
Caution: you do not need to (and should not do it!) add the jar files to your classpath. You only have to make sure that your classpath points to the boot.jar. You may use the config.file to launch agents at start time.
MadKit may be developped in all languages that are compiled into Java (there are a great number of such languages. See the site {{}} to get a list of all these languages. For the moment, MadKit comes with 4 scripting languages which are executed in the Java Virtual Machine: Scheme (Kawa), Jess (rule based language), BeanShell (Java interpreted) and Python (jython). Using the JNI (Java Native Interface) technique, it should be possible to develop agents written in C or C++. It is also possible to embed Java agents in C/C++ applications using the same technique, using JNI as a glue between the two worlds.