Simple cmd-line tester for Topcoder Marathon & AtCoder Heuristic Contests.
Install the latest version with pip install psytester --upgrade
- Works with both Topcoder Marathons and AtCoder Heuristic Contests
- Run batches of tests using multiple threads and store results in a friendly JSON format
- Print the local scoreboard
- Group/Filter results by user-defined metadata
- Search through tests according to some metrics (useful for finding tests close to timing out or some more extreme test cases)
- Download official jar tester
- Run
psytester config --load topcoder
in problem's directory (note: if you're not using the new tester usepsytester config --load old_topcoder
instead) - Edit newly created tester.cfg config file to change:
- number of threads (
default/threads_no
) -exec
part to match the name of your executable (general/cmd_tester
)- change the type of scoring function used ('default/scoring'); by default the scoring function used is max (YOUR_SCORE / BEST_SCORE), you can use min (BEST_SCORE / YOUR_SCORE) or raw (YOUR_SCORE);
- number of threads (
- Download official tools
- Run
psytester config --load atcoder
in problem's directory - Edit newly created tester.cfg config file to change the number of threads (
default/threads_no
) and the command that invokes provided tester and output the scores (unfortunately AHCs do not have standardized tools across different contests) - Few examples:
- Note that
output_files
should be a list of files that psytester scans in order to extract score (in form ofScore = value
) and/or user-defined metadata (in form of[DATA] variable = value
); if you might to modifyoutput_files
as well (given examples do not require that). - psytester doesn't use the generator, so you have to generate the tests manually
- Test your solution manually (without psytester) and verify that it's working correctly.
- Verify that psytester is set up correctly by executing a small test run:
psytester r -t 10
. This should print results to standard output - Run
psytester r [results_file]
in order to run a batch of tests and create aresults_file.res
with scores. Output of each test is redirected to a text file and then later the file is scanned in order to extract the score (and potentially other variables). Results file will contain scores for each test case in JSON format. By default, output files will be stored at./tests/results_file/
. - Run
psytester s
to see the scoreboard for all of the results' files in the current directory. - By default, results files contains only Score and the test ID (seed). You can add additional metadata by printing
[DATA] X = Y
(spaces are mandatory) in your solution. For example, let's say the the problem is on the square grid of size N. If your solution prints[DATA] N = ...
, you can runpsytester s --data [results_file_with_data] --groups N
to see the summary grouped by different sizes of the grid. You can also manually specify multiple groups with different criteria like--groups N=2 N=3-5 N=6-10 D=2 D=4
. Similarly, you can use--filters N=5-10
to filter the testcases to include only those meeting specific criteria. - For more options/features, please look at the config comments and/or built-in help. You can override most of the options by specifying adequate command line option.
- Information explaining how it works incoming
- Use
--tests A-B
to select the range of seeds to use;--tests N
is equivalent to--tests 1-N
; - Use
--m threads_no
to change the number of threads, you can also set it in the config file (default/threads_no
) - More info coming
- Running
psytester show
will print results table based results files in current directory - By default results are sorted by file name, you can also sort based on time by changing config option
default/sorting
todate
- There are config options to enable/disable showing errors/bests/uniques
- If you want to remove some old results file the easiest way is to just move/delete them
- You can use
--groups ...
to add additional columns that will show the score per group; Similarly you can use--filters ...
. Both of those options require adding metadata by adding[DATA] variable = value
to your output files. For more info check grouping and filtering - More info coming
- Running
psytester find [--data results_file] [--var VAR] [--order {+|-}] [--limit LIMIT]
sorts the results fromresults_file
byVAR
(ascending / descending) and prints them (either all or up toLIMIT
). You can useLATEST
as aresults_file
in order to use the latest results file. For example, you can runpsytester find --data LATEST --var time --order - --limit 10
to print 10 tests from the latest run that had the longest execution time. - You can combine it with
--filters ...
options - When running tests, you can use
--tests test_file
to run tests on a specific subset of seeds. This allows you to easily rerun a solution on a specific subset of tests:psytester find ... > test_subset && psytester --tests test_subset ...
Script generation is experimental and was broken so many times that it's been temporarily disabled.
- I know it's the "killer feature" of the psytester, but more info is incoming, I promise!
- More info coming
- Do not expect the same execution speed when running concurrently with multiple threads.
- More info coming
- Currently psytester is not backward compatible with old config files, you'll have to manually update the config file to a new version if you update psytester while working on the same problem. This should change in the future versions.
- There's a tiny glitch where on some machines sometimes progress is double printed on the same line.
- More issues coming ;)