The libalf demo is a graphical user interface (GUI) written in Java. Its purpose is to demonstrate how to employ libalf in a user application. The GUI guides the user step-by-step through the implementation process simulating the steps a developer would have to do. It visualizes the result in a Java-like pseudo code. Depending on the type of the chosen learning algorithm (either online or offline) the user is put in the position of a teacher, or has to provide a set of classified examples.
Originally, the demo was designed to be a live demonstration during a talk. It was, therefore, never ment to be self-explanatory and may lack of usability. Please refert to Section Usage for a brief introduction on how to use the demo. Moreover, Section Known issues may be helpful to solve common problems.
Instead of running the demo locally (as described below) you can also try the demo online. You can find more information on the Web Start Demo page.
Please note that the libalf demo requires version 0.1 of libalf!
Running the demo
Running the demo comprises a few simple steps described below. If you want to use jalf's Java Native Interface (JNI) in addition to the dispatcher, you need to prepare some additional steps. These steps are marked as optional and may be skipped. However, it is highly recommended to set up the libalf demo for JNI use since doing otherwise can result in critial exceptions.
The demo requires a Java Runtime Environment 1.6 (or later). Moreover, two additional packages are needed:
- brics (Version 1.11) as automaton backend and
- JGraph (Version 5) for drawing the automata.
- Download libalf 0.1, compile the jalf.jar (as described in the documentation) and copy it to your working folder, e.g. demo.
Compile both the libalf and jalf C++ library (also see the documentation). Copy the compiled libraries to your demo folder.
- Download the brics and JGraph package from their respective website and install / copy the jar files to your demo folder.
- Download the libalf demo and extract the jalf_demo.jar file into your demo folder.
- Open a command line, change into your demo directory and start Java by typing
java -classpath "..." de.libalf.demo.Starter
You need to adjust Java's classpath by replacing the ... in the quotes with the exact file names of the jar files. The classpath parameter should look like
Be sure to use the right separator (e.g. ";" on Windows and ":" on Linux) to separate each jar file.
Set Java's library path to the path where you put the libalf and jalf library in. This is done by adding
right after the classpath parameter and replacing the ... with the location of the libraries.
If libalf is dynamically linked into the jalf library, you also need to make sure that Java finds the libalf library. On Windows you should be fine as Windows searches in the current working directory for the library. If this does not work, try to add the demo folder to your PATH variable. On Linux add LD_LIBRARY_PATH=. right befor the java command to set the Linux library path temporarily to the current directory.
In libalf demo, different learning settings are organized in so-called scenarios. Each scenario stores certain properties, which can be easily modified. The most important ones are:
- The connection type, i.e. whether jalf uses JNI or the dispatcher to connect to libalf.
Note that the dispatcher requires a server and a port to connect to. The default values already point to a dispatcher server located at the RWTH Aachen University you are free to use.
- The alphabet size.
libalf uses 32-bit integers to represent symbols: all values betwen 0 and alphabet_size - 1 are valid. Words are represented as sequences of symbols. For reasons of simplicity, the demo only allows alphabets of size at most ten. However, libalf itself supports alphabets of up to 232 symbols.
- The learning algorithm.
distinguishes between online and offline algorithms (see the glossary
). Depending on your choise you can specify more detailed settings.
Creating new scenarios. After the demo starts up, it shows an empty desktop. You can create a new scenario by choosing New Scenario from the Scenario menu at the top of the desktop or by right-clicking on the desktop.
Customizing scenarios. After choosing New Scenario, the Scenario Editor pops up, where you can customize your scenario. Select a connection method, an alphabet size and the desired learning algorithm. Depending on the type of the learning algorithm, you have the possibility to specify more properties.
If you choose an offline algorithm, you certainly wish to add samples to the sample set. For this purpose, click the + button and input a word not yet contained in the list. Then classify the word by either chekcing or unchecking the respective checkbox.
For online algorithms you do not need to specify more setting. Note that filters and teachers for online algorithms are not covered in this brief introduction.
Click New and a new scenario window appears after a short while. This window shows Java pseudo-code and allows running the algorithm step-by-step. For this purpose, just click Advance, Answer Membership Query or Answer Equivalence Query and follow the instructions on the screen.
There are a few things you should check:
If you still experience problems, please contact Daniel Neider for assistance.
- Since the libalf demo requires Java Runtime Environment 1.6, make sure that you have the latest version installed.
- Make sure that both the classpath and the library path are set correctly.