Preparing Your Own Program

As explained in lesson Example 1: A Simple Program, every possible parameterization of your algorithm (according to your parameter and selection settings) results in a job, that is, an execution of your executable. Your task is to extend your code such that it reads its parameterization and writes back its results. Currently, the Ultimate Framework provides bindings for Java, C/C++, C#, and MATLAB.

In the following, the preparation procedure is described in detail for Java. For the other languages, the procedure is essentially the same, so you will be able to learn the principle from the Java example even if you use another language. You can download the example code for all languages here:

Java: example_java.zip
C: example_c.zip
C++: example_cpp.zip
C#: example_cs.zip
MATLAB: example_matlab.zip

The preparation procedure using Java

1 For algorithms written in Java, the Ultimate Framework provides the class UFioHandler that does almost all of the work for you.

→ Add the file UFioHandler.java to your project.

2 img → Add the line UFioHandler.loadParamValuesFromXML(args[0]); somewhere in the initialization part of your algorithm. The Ultimate Framework passes the name of the XML parameter file as the first argument to your executable, so this call will read the current parameterization.

3 img → Somewhere in your algorithm, you will now want to access the given parameter values. Do so by using the static method String getParameterValue(String parameterName). For example, you could say UFioHandler.getParameterValue("alpha") to obtain the current value of an alpha parameter that your algorithm needs. Since the method returns always a string, you have to convert the value manually into the data type that is appropriate for you. For example, if you want to convert the string into a double, you can use the static method Double Double.parseDouble(String).

4 img As soon as your algorithm has finished its computation, it must write back the resulting evaluations of its objective functions. For example, your algorithm could contain two objective functions time, which measures runtime, and quality, which measures the quality of the computed result, based on some heuristic or exact reference algorithm. These values will be used by the Ultimate Framework in the Explore perspective to render performance curves for every objective function.

→ Use the static method void storeResults(HashMap<String,Double>, String) for storing the objective function evaluations. The first parameter is a hashmap mapping objective function names onto their values. The second parameter contains additional data that is passed to subsequent jobs. Set it to NULL if you don't need it.