In order to use the offline tester / visualizer tool for testing your solution locally, you'll have to modify your solution by adding the main method that interacts with the tester / visualizer via reading data from standard input and writing data to standard output. As long as you do not change the implementation of method trainingData, testingData and getAnswer this doesn't affect the way your solution works when being submitted to our server.
To simulate a single test case, your program should implement the following protocol (each integer/string is to be read from / printed in a separate line):
In other words, you should implement the following pseudocode in the main method of your solution:
for (i=0; i < 1000; i++) { N = parseInt(readLine()) for (j=0; j < N; j++) imageData[j] = readInt() M = parseInt(readLine()) for (j=0; j < M; j++) detections[j] = readLine() result = trainingData(imageData, detections) printLine(result) flush(stdout) } for (i=0; i < 200; i++) { N = parseInt(readLine()) for (j=0; j < N; j++) imageData[j] = readInt() M = parseInt(readLine()) for (j=0; j < M; j++) detections[j] = readLine() result = testingData(imageData, detections) printLine(result) flush(stdout) } results = getAnswer() printLine(length(results)) for (i=0;i < length(results); i++) printLine(results[i]) flush(stdout)
The tester can be run as follows.
java -jar tester.jar -folder <folder> -train <training file> -test <test file> -exec <exec command> -vis
Your solution supplied by "exec command" will be executed on a training and test set specified by "training file" and "test file".
"exec command" should contain a path to an executable of your solution. "training file" and "test file" should point to the supplied example_train.txt and example_test.txt. "folder" specifies the directory in which all the training data is stored.
Visualization results will be saved in PNG format into files "D_XX.png" or "R_XX.png". Where XX is the number of the detection. "D_XX.png" will be used when the detections was not rejected by the operator and "R_XX.png" if it was rejected.
Sample usage
Download the training data, put it into some folder at your machine and extract archives. The contents of your folder should be like:
data example_train.txt example_test.txt
Modify your solution as explained above and put the executable (solution or solution.exe) into the same folder. Also put the provided tester.jar there.
Now you can run the tester like this:
java -jar tester.jar -folder data/ -train example_train.txt -test example_test.txt -exec solution[.exe] -vis
This will execute your solution using the example test case data. The visualizations will be saved.
Final notes
You can print any debug information of your solution to the standard error stream and it will be forwarded to the standard output of the tester.
For more information on using visualizers, please check the following recipe draft from TopCoder Cookbook. Note that this is not a troubleshooting thread, please use the match forum for questions instead.