Metadata-Version: 2.1
Name: pace2024-verifier
Version: 0.3.0
Summary: 
Author: fabian
Author-email: fmklute@gmail.com
Requires-Python: >=3.9,<3.13
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: click (>=8.1.7,<9.0.0)
Requires-Dist: networkx (>=3.2.1,<4.0.0)
Requires-Dist: numpy (>=1.26.1,<2.0.0)
Requires-Dist: pytest (>=7.4.3,<8.0.0)
Requires-Dist: segment-tree (>=0.3.2,<0.4.0)
Description-Content-Type: text/markdown

# PACE 2024 Verifier

This package can be used to verify a given solution against a set of crossing counting algorithms. For more information check the pace [website](https://pacechallenge.org/2024/).

## Installation

Install the verifier from pip:

```console
$ pip install pace2024verifier
```

## Usage

### Verifier
To verify a solution use the following command:

```console
$ pace2024verify <path/to/graph.gr> <path/to/solution.sol>
```

The verifiery has three different methods for verification usable via the switches:
* --segtree = Use a segment tree to count the crossings. `[default]`
* --interleave = Count the crossings by checking for each pair of edges if they interleave.
* --stacklike = Count the crossings by checking how many pairs are out of order in a one-sided book embedding.

There is also the option to only print the number of crossings via `-c/--only-crossings`.

### Tester
To test a solver against a set of tests use:

```console
$ pace2024tester <solver>
```

where `<solver>` has to be an executable. So if for example you run your solver via a shell-script `solver.sh` run the command `$ pace2024tester solver.sh`. The solver will then be run using the [tiny test set](https://pacechallenge.org/2024/tiny_test_set-overview.pdf). The instances and solutions of this set are included with the verifier. To add your own tests create a folder `mytests` containing a subfolder `instances` and a subfolder `<solutions>`. You can then run 

```console
$ pace2024tester --test <path/to/mytests> <solver>
```

and the tester will check the solver against this test set. You can also suppply multiple test sets via

```console
$ pace2024tester --test <path/to/mytests1> --test <path/to/mytests2> <solver>
```

For each instance in an `instances` folder we match it to the same-named file in the solutions folder. The provided solver is then executed on each instance and the `pace2024verifier` is used to check the results. If you do not want to use the tiny test set you can switch it off using:

```console
$ pace2024tester --no-tiny --test <path/to/mytests1> --test <path/to/mytests2> <solver>
```

By default the tester assumes that the solver uses files for input and output and calls it as:

```console
$ <solver> path/to/input path/to/output
```

If you prefer using `stdin` or `stdout` use the following switches:
* --instanceas file/stdin = provide the input file as a path to the `file` or on `stdin`
* --solutionas file/stdin = expect the output to be written to a `file` or on `stdout`

For solution files the tester creates temporary file using the `tempdir` library of `python`. All created files are deleted by this library after execution.

Finally, for easier parsable output you can use the flag:
* --only-compare/-c which prints only the line `Testing now <instancename>...` followed by the string `<crossingssolver>,<crossingssolution>`.
