Skip to content

Commit 777dd24

Browse files
author
Michael Marte
committed
Result files are now available from the minizinc.github.io repo
1 parent dae3630 commit 777dd24

17 files changed

Lines changed: 11 additions & 144092 deletions

.gitignore

Lines changed: 1 addition & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
env/
12-
build/
13-
develop-eggs/
14-
dist/
15-
downloads/
16-
eggs/
17-
.eggs/
18-
lib/
19-
lib64/
20-
parts/
21-
sdist/
22-
var/
23-
*.egg-info/
24-
.installed.cfg
25-
*.egg
26-
27-
# PyInstaller
28-
# Usually these files are written by a python script from a template
29-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30-
*.manifest
31-
*.spec
32-
33-
# Installer logs
34-
pip-log.txt
35-
pip-delete-this-directory.txt
36-
37-
# Unit test / coverage reports
38-
htmlcov/
39-
.tox/
40-
.coverage
41-
.coverage.*
42-
.cache
43-
nosetests.xml
44-
coverage.xml
45-
*,cover
46-
.hypothesis/
47-
48-
# Translations
49-
*.mo
50-
*.pot
51-
52-
# Django stuff:
53-
*.log
54-
local_settings.py
55-
56-
# Flask stuff:
57-
instance/
58-
.webassets-cache
59-
60-
# Scrapy stuff:
61-
.scrapy
62-
63-
# Sphinx documentation
64-
docs/_build/
65-
66-
# PyBuilder
67-
target/
68-
69-
# IPython Notebook
70-
.ipynb_checkpoints
71-
72-
# pyenv
73-
.python-version
74-
75-
# celery beat schedule file
76-
celerybeat-schedule
77-
78-
# dotenv
79-
.env
80-
81-
# virtualenv
82-
venv/
83-
ENV/
84-
85-
# Spyder project settings
86-
.spyderproject
87-
88-
# Rope project settings
89-
.ropeproject
1+
results.db

README.md

Lines changed: 2 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,9 @@
11
# minizinc-challenge-results
2-
Tools to build and query a database of MiniZinc challenge results
32

43
The aim of this project is to provide tools to investigate the results of the [MiniZinc challenges](http://www.minizinc.org/challenge.html).
54

65
Currently there are two Python scripts:
76

8-
* `create-results-db.py` creates an Sqlite database of results from MiniZinc challenges (`results.db`). To import results, call the script with a list of JSON result files (see below) on the command line. When the database already exists, the given results will be added unless they are already in the database.
7+
* `import-results.py` creates an Sqlite database of results from MiniZinc challenges (`results.db`). To import results, call the script with the year and the JSON result file on the command line. (Result files are available from https://github.com/MiniZinc/minizinc.github.io/tree/main/public/challenge). When the database already exists, the given results will be added unless they are already in the database.
98

10-
* `compare-solvers.py` compares the performance of given solvers in a given challenge by looking at the objective values the competitors achieved. (Runtime and proof of optimality do not play a role here.) For each solver and each instance, the script computes a penalty; the worse a result in comparison to the best result, the higher the penalty. (Please see the script for the details of penalization.) In the end, the script prints the penalties in terms of their mean, standard deviation, and median.
11-
12-
The `results` folder contains the MiniZinc challenge results from 2011 to 2024; for each year, there is a JSON file. (This data was extracted from the JavaScript files used by the MiniZinc web site.) The files contain all the data except for the scores.
13-
14-
To generate a JSON file for import into the database, proceed as follows:
15-
16-
* Download the results from the MiniZinc web site (e.g. http://www.minizinc.org/challenge2016/results.js) or from the web site's repo (https://github.com/MiniZinc/minizinc.github.io/tree/main/public/challenge).
17-
* Append this snippet:
18-
19-
```
20-
function writeJson(results) {
21-
var fs = require('fs');
22-
fs.writeFile(
23-
"results.json",
24-
JSON.stringify(results, null, 2),
25-
function(err, result) {
26-
if(err) console.log('error', err);
27-
});
28-
}
29-
30-
var year = 2024
31-
32-
if (year < 2021) {
33-
writeJson({
34-
"year": year,
35-
"solvers": solvers,
36-
"fd_solvers": fd_solvers,
37-
"free_solvers": free_solvers,
38-
"par_solvers": par_solvers,
39-
"open_solvers": open_solvers,
40-
"problems": problems,
41-
"kind": kind,
42-
"instances": instances,
43-
"benchmarks": benchmarks,
44-
"results": results,
45-
"times": times,
46-
"objectives": objectives
47-
});
48-
} else {
49-
with (json.results) writeJson({
50-
"year": year,
51-
"solvers": solvers,
52-
"fd_solvers": fd_solvers,
53-
"free_solvers": free_solvers,
54-
"par_solvers": par_solvers,
55-
"open_solvers": open_solvers,
56-
"problems": problems,
57-
"kind": kind,
58-
"instances": instances,
59-
"benchmarks": benchmarks,
60-
"results": results,
61-
"times": times,
62-
"objectives": objectives
63-
});
64-
}
65-
```
66-
67-
* Update the year.
68-
* Run the resulting script with `nodejs`.
9+
* `eval-solvers.py` evaluates the performance of given solvers in a given challenge by looking at the objective values the competitors achieved. (Runtime and proof of optimality do not play a role here.) For each solver and each instance, the script computes a penalty; the worse a result in comparison to the best result, the higher the penalty. (Please see the script for the details of penalization.) In the end, the script prints the penalties in terms of their mean, standard deviation, and median.
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#! /usr/bin/python3
22

33
# This script creates a database of results from MiniZinc challenges (results.db).
4-
# To import results, call the script with a list of JSON result files on the command line.
4+
# To import results, call the script with the year and the JSON result file on the command line.
55
# When the database already exists, the given results will be added unless they are
66
# already in the database.
77

@@ -43,9 +43,8 @@ def fixedSolverName(solver):
4343
'INC': (False, False)
4444
}
4545

46-
def importResults(file, cursor):
47-
results = json.load(file)
48-
year = results['year']
46+
def importResults(year, file, cursor):
47+
results = json.load(file)['results']
4948
solvers = list(map(fixedSolverName, results['solvers']))
5049
problems = results['problems']
5150
benchmarks = results['benchmarks']
@@ -70,15 +69,15 @@ def importResults(file, cursor):
7069

7170
def main():
7271
parser = argparse.ArgumentParser(description = 'Puts MiniZinc challenge results into database')
73-
parser.add_argument('filenames', metavar = 'json-result-file', nargs = '+')
72+
parser.add_argument('year', metavar = 'year')
73+
parser.add_argument('filename', metavar = 'json-result-file')
7474
args = parser.parse_args()
7575
with sqlite3.connect("results.db") as conn:
7676
cursor = conn.cursor()
7777
createDb(cursor)
7878
cursor.execute('PRAGMA foreign_keys = ON');
79-
for filename in args.filenames:
80-
with open(filename) as file:
81-
importResults(file, cursor)
82-
conn.commit()
79+
with open(args.filename) as file:
80+
importResults(args.year, file, cursor)
81+
conn.commit()
8382

8483
main()

0 commit comments

Comments
 (0)