Skip to content

Commit 0144163

Browse files
committed
Add minimal developer documentation on we implement scoring.
1 parent 1400212 commit 0144163

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

doc/manual/develop.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,9 @@ To debug failing Unit tests the fixtures can be loaded with:
180180

181181
.. _CCS Contest API specification: https://ccs-specs.icpc.io/2021-11/contest_api
182182
.. _OpenAPI Specification ver. 3: https://swagger.io/specification/
183+
184+
185+
Additional developer documentation
186+
----------------------------------
187+
188+
- :ref:`Scoring <scoring>`

doc/manual/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ Appendices
2727
shadow
2828
configuration-reference
2929
install-language
30+
scoring

doc/manual/scoring.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.. _scoring:
2+
3+
Scoring and scoreboard caching implementation
4+
=============================================
5+
6+
Currently, DOMjudge only supports ICPC-style 'pass-fail' problems, where a problem is either accepted or rejected.
7+
In this mode, we try to follow this specification, but have some additional configuration options:
8+
https://ccs-specs.icpc.io/draft/ccs_system_requirements#scoring
9+
10+
Key points:
11+
12+
- Teams are sorted by their sortorder first; this is frequently used to group teams into actual participants and other
13+
groups (e.g. company teams, non-eligible teams, staff, etc.).
14+
- Then teams are sorted ascending by the sum of their problem points. Each correctly solved problems scores a
15+
pre-defined number of points (integer, by default 1).
16+
- Then teams are sorted descending by either their penalty time (or runtime, can be configured at contest level). The
17+
penalty time per problem is rounded down to the nearest minute by default, but can be configured to use second
18+
granularity instead.
19+
- If two teams have the same score, they are sorted by the time of their last accepted submission.
20+
21+
The scoreboard is updated in real-time, which can be a performance bottleneck when there are many teams and problems, so
22+
we employ some caching techniques to speed it up. The scoreboard cache is implemented in two tables, `scorecache` and
23+
`rankcache`.
24+
25+
The ``scorecache`` table is used to store individual scoreboard cells, i.e. information about a single team's score for
26+
a particular problem. Whenever a submission has completed judging, the scorecache is updated for that team and problem.
27+
The table holds all relevant information for the team/problem combination, both for the public and restricted audience
28+
(i.e. jury) who has full information during the freeze.
29+
30+
The ``scorecache`` table is then used to compute the ``rankcache`` table, which holds the aggregated information for each
31+
team in order to quickly compute the rank of each team. For this, we do first compute the teams that are definitely
32+
better than the current team based on problem points and time (either penalty time or runtime). Then for all teams that
33+
are tied with the current team, we apply the tie breaker (time of last accepted submission).

0 commit comments

Comments
 (0)