Not Logged In

marathoner 1.2.4

Marathoner is a command line tool for effective local testing of solutions for [Marathon Match competitions](http://community.topcoder.com/longcontest/?module=ViewActiveContests) organized by [TopCoder Inc.](http://www.topcoder.com/)

- Works with solutions written in C++, C#, Java, Python, VB.- Simple way to run your solution on big number of test cases. To run on the first hundred seeds, just type: ```1 100```.- Keeps track of the best scores for each seed, so you can compare your solutions locally.- Exports input data from visualizer into external file, so you can debug on them.- (**NEW**) Caches the output of your solution, so you don't have to wait again when running the same code on the same seed.- and many more...

Installation------------

Marathoner is written in Python, so first get some Python at [http://www.python.org](http://www.python.org) (versions 2.6, 2.7 and 3.x are supported).

Or download the source code from GitHub and from *tc-marathoner* directory run: ```python setup.py install```.

Getting started---------------

Let me show you how to setup Marathoner for a recent Marathon Match called [RectanglesAndHoles](http://community.topcoder.com/longcontest/?module=ViewProblemStatement&compid=40847&rd=15982)

1. Download the visualizer [RectanglesAndHolesVis.jar](http://www.topcoder.com/contest/problem/RectanglesAndHoles/RectanglesAndHolesVis.jar) Create a solution that communicates with visualizer as described [here](http://apps.topcoder.com/forums/?module=Thread&threadID=670892&start=0) and make sure your solution works by running:

```java -jar RectanglesAndHolesVis.jar -exec "<command>" -seed 1```

2. From command line run: ```marathoner new RectanglesAndHolesMarat```

In your current directory Marathoner will create a new directory named *RectanglesAndHolesMarat* where it will store all its work files related to RectanglesAndHoles match.

3. Go into newly created directory *RectanglesAndHolesMarat* and edit *marathoner.cfg* file. Fill out its contents as described in comments inside the file. Here is an example of my *marathoner.cfg* file for this match:

4. While still in *RectanglesAndHolesMarat* directory, from command line run: ```marathoner run```. If everything is okay, you should see a welcome message and the command line prompt. Try to run: ``` >>> 1 Running single test 1... Holes count (Cnt) = 12345 Holes area (Area) = 6789 Score = 123456.0 Run time: 0.14 New score: 1234567.00 Best score: 123456.00 Relative score: 0.09999 ``` You should also see the visualization for the seed number 1. Close the visualizer and type another command.

#### best [seed1] [seed2]Print the best scores for the seeds. Examples:```>>> best # print the best scores for all the known seeds>>> best 5 # print the best score for seed 5>>> best 1 100 # print the best scores for seeds from interval 1-100, inclusive```

#### clearClear console window.

#### helpShow list of available commands.

#### quitQuit Marathoner prompt.

Tagging of solutions--------------------

Once you have implemented a solution that you plan to run on a large numberof tests you can *tag* the solution, before you do so:```>>> tag create my_solution # create a tag from the current solution and name it "my_solution"```Marathoner will compute the hash of your current source code (you specified path to your source code in .cfg file)and store it under the name "*my_solution*". Now whenever you run some tests,Marathoner will check the hash of your current source code against the hashesof the source codes that you have already tagged. If there is a match between the hashes,Marathoner will store the results of the tests under the matched tag name.```>>> tag # display the list of existing tags|-----------------|---------------------|| Tag | Created ||-----------------|---------------------|| (*) my_solution | 2013-12-13 04:26:54 ||-----------------|---------------------|(*) means current active tag>>> 1 100 # run seeds 1-100 and store the scores under "my_solution" tagRunning 100 tests with tag "my_solution"...>>> 101 200 # run seeds 101-200 and add them to "my_solution" tagRunning 100 tests with tag "my_solution"...>>> tag my_solution # view the scores of seeds 1-200 of "my_solution" tag```And now comes the killer! When you have tagged many different solutionsand you want to compare them against each other, simply run the command:```>>> tag my_solution other_solution # compare the scores of tags "my_solution" and "other_solution"```

**WARNING**: When you change the source code of your solution and don't compile it,Marathoner will still run the old solution, but the hash of the source file will be different.I.e. the solution will not run with the correct tag name.

#### tag <tag_name1> <tag_name2> ...Compare the scores of the selected tags. Only the seeds that all the tags have in common will be compared. Examples:```>>> tag create solution1 # create tag "solution1">>> 1 10 # run the seeds 1-10 and store them under "solution1" tag

#### tag create <tag_name>Create a tag from the current solution and name it *tag_name*. Examples:```>>> tag create solution1 # tag the current solution with name "solution1">>> 1 10 # run the seeds 1-10 and store them under "solution1" tagRunning 10 tests with tag "solution1"...

( change source code of solution )>>> 1 10 # now, because the source code has changed, the current solution doesn't have any tagRunning 10 tests...

- If your solution gets stuck, press ```q``` to easily terminate it. If you are running multiple tests, it terminates the whole execution (best scores of already run tests are still saved, though).- If your solution crashes on some seed and you want to debug it, you can find input data of this seed in file specified by *testcase* field in *marathoner.cfg*.- You can find log of the last multiple-tests run in *RectanglesAndHolesMarat* directory, called *multiple_tests.log*.- When you run multiple tests, standard error output from your solution is not displayed. But lines starting with ```!``` are displayed, still.- Marathoner stores copies of all tagged source codes in ```RectanglesAndHolesMarat/tags``` directory, so you can later return to them.- If you internally measure running time of your solution, output to standard error a line in format: ```Run time = <run_time>```. Marathoner will use this time instead of the one it measures externally, which can be rather imprecise.

The MIT License (MIT)
Copyright (c) 2013-2014 Michal "Mimino" Danilák
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.