/zulubaseline

Automatically exported from code.google.com/p/zulubaseline

Primary LanguageJava

Baseline algorithm

The baseline is based on a simplified version of L*, by Dana Angluin. It is written in Java. You can download it below :

zuluBaselineSrc.jar

zuluBaselineSrc.jar contains the compiled .class files and the Java source files of the algorithm.

The class with the "main" is Lstar. You can also view the Javadoc for the Zulu client for more information about its structure.

You can read directly the source code here.

To use the baseline, create a project in your favorite integrated development environment and test and modify the baseline the way you want. A good way if you want to get rid of Lstar in your algorithm is to instanciate a "RemoteOracle" object as it is done in the Lstar class main function.

Some commented functions are useful if you want to see the automata as it is built by the implementation of L*. Do not hesitate to uncomment them and see what happens.

Are there some components to install before running the baseline ?

In order to RUN ONLY the baseline you need the Java runtime. If you want to modify it you need the Java Development Kit (JDK). Java SE Development Kit is enough, but if you need an IDE, choose the bundle JDK with NetBeans (click on the right on the first "Download" link). You need the Java Development Kit ("choose Java SE Development Kit (JDK)" in the second section, or any bundle) in order to rebuild and so to modify the algorithm.


Execution

java -jar zuluBaselineSrc.jar Task_Key

where Task_Key is the 8 digits number given at the task generation or at the challenge creation.

Description of the main files

  • Lstar.java : the main file, with the algorithm itself (in the constructor).
  • RemoteOracle.java : the communication interface with the server of the project. It is a child of the Oracle interface.
  • Oracle.java : the interface class for an Oracle with membership queries, getting alphabet of a target, submit your result.
  • Automaton.java : class, dedicated to the implementation of the Lstar algorithm, that produces an automaton from an observation table.
  • WordAndClass.java : class associating a string and its classification (dedicated to Lstar).
  • PrintOnScreen.java : debugging for Lstar.
For more information please see the Javadoc for the Zulu client.

Unjar archive and run:

jar -x zuluBaselineSrc.jar
javac zulu/baseline/Lstar.java
java Lstar Task_Key

Jar archives are also extractable with 7-zip and other common compression utility. You can edit and easily run the package within an integrated development environment such as Eclipse or NetBeans, under various platforms. Both are free and open-source.

Debug your program

You can process manually some queries here: Debugging tool.

You can process the queries and get information directly from a wget command. The URLs you need to call are described below.

Obtain the alphabet of the target

2-letters problems have ab as their alphabet. 3-letters problems have abc as their alphabet... and so on. If you don't want to fix it in your program you can ask for the alphabet at
http://labh-curien.univ-st-etienne.fr/zulu/oracle.php?problem=PROBLEM-KEY&alphabet=1
where PROBLEM-KEY is the 8-digit number that you can find
here (you need to be logged in).

Ask for a string

http://labh-curien.univ-st-etienne.fr/zulu/oracle.php?problem=PROBLEM-KEY&word=STRING-YOU-ASK-FOR
You obtain there "Yes" if the string belongs to the automaton, or "No" if it doesn't. If the limit is reached the response is "Limit" (ie if you have used up your credit!).

Example: If you want to know if "0110101" belong to toy task 1 (key 00000001) :

http://labh-curien.univ-st-etienne.fr/zulu/oracle.php?problem=00000001&word=0110101

Get the 1800 strings to classify

At this time you can't ask more membership queries (the target is "locked").
http://labh-curien.univ-st-etienne.fr/zulu/oracle.php?problem=PROBLEM-KEY&iThinkIFound=1

Example: If you want to obtain the words to classify for toy task 1 (key 00000001) :

http://labh-curien.univ-st-etienne.fr/zulu/oracle.php?problem=00000001&word=0110101
Please note that this toy task have fewer words to classify than regular tasks.

Get the membership queries amount limit

Please count yourself how many query you have used if you need this information.
http://labh-curien.univ-st-etienne.fr/zulu/oracle.php?problem=PROBLEM-KEY&limit=1

Example: If you want the query amount limit for toy task 1 (key 00000001) :

http://labh-curien.univ-st-etienne.fr/zulu/oracle.php?problem=00000001&word=0110101
Please note that toy tasks have no limit.

Submit your classification

http://labh-curien.univ-st-etienne.fr/zulu/oracle.php?problem=PROBLEM-KEY&submit=YNNNYNNYNNN

You can use wget in order to obtain the answers of membership queries and the 1800 strings.

wget call exemple

wget -O responseFile http://labh-curien.univ-st-etienne.fr/zulu/oracle.php\?problem\=01\&word=0110101

Troubleshooting: if you use a Proxy

You should be concerned by the following only if your environment is not correctly configured.

Command Line JVM Settings

The proxy settings are given to the JVM via command line arguments:

$ java -Dhttp.proxyHost=proxyhostURL
-Dhttp.proxyPort=proxyPortNumber
-Dhttp.proxyUser=someUserName
-Dhttp.proxyPassword=somePassword javaClassToRun

Setting System Properties in Code

Add the following lines in your Java code so that JVM uses the proxy to make HTTP calls. This would, of course, require you to recompile your Java source. (The other methods do not require any recompilation.):

System.getProperties().put("http.proxyHost", "someProxyURL");
System.getProperties().put("http.proxyPort", "someProxyPort");
System.getProperties().put("http.proxyUser", "someUserName");
System.getProperties().put("http.proxyPassword", "somePassword");

It provides a majority vote program written in PERL in order to provide an example of the use of the Zulu functions with a script language. Download.

The 5 functions provided :

zuluMQ makes a membership query

zuluLimit returns how many queries are allowed

zuluAlphabet returns the symbols allowed for the target

zuluIThinkIFound asks for the test set. No zuluMQ calls are allowed since therefore.

zuluSubmit sends your answers for the test set classification.