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 init and forecast, 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 or double 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:
sampleRate = parseInt(readLine()) S = parseInt(readLine()) SLEN = parseInt(readLine()) for (i=0; i < SLEN; i++) sitesData[i] = parseDouble(readLine()) ret = init(sampleRate, S, sitesData) printLine(ret) doTraining = parseInt(readLine()) if (doTraining=1) { gtf_Site = parseInt(readLine()) gtf_Hour = parseInt(readLine()) gtf_Latitude = parseDouble(readLine()) gtf_Longitude = parseDouble(readLine()) gtf_Magnitude = parseDouble(readLine()) gtf_DistToQuake = parseDouble(readLine()) answer(gtf_Site, gtf_Hour, gtf_Latitude, gtf_Longitude, gtf_Magnitude, gtf_DistToQuake); } repeat until quake happens { hour = parseInt(readLine()) if (hour=-1) break DLEN = parseInt(readLine()) for (i=0; i < DLEN; i++) data[i] = parseInt(readLine()) K = parseDouble(readLine()) QLEN = parseInt(readLine()) for (i=0; i < QLEN; i++) globalQuakes[i] = parseDouble(readLine()) retM[] = forecast(hour, data, K, globalQuakes) printLine(retM.length) for (i=0; i < retM.length; i++) printLine(retM[i]) flush(stdout) }
In order to run the tester / visualizer, you should use the following command:
java -jar tester.jar -exec "<command>"
<command> is the command you would use to execute your solution. If your compiled solution is an executable file, the command will just be the full path to it, for example, "C:\TopCoder\solution.exe" or "~/topcoder/solution". In case your compiled solution is to be run with the help of an interpreter, for example, if you program in Java, the command will be something like "java -cp C:\TopCoder Solution".
Additionally you can use the following parameters (all are optional):
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. Place the gtf.csv file in the same folder as the tester.jar.
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.