Skip to content

Redesign to support other scoring methods #2525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eldering opened this issue May 2, 2024 · 3 comments
Open

Redesign to support other scoring methods #2525

eldering opened this issue May 2, 2024 · 3 comments

Comments

@eldering
Copy link
Member

eldering commented May 2, 2024

In the past there have been various requests to support other scoring methods than pass/fail with penalty time, some have been listed in scoring

Before we try to support any of these, we should consider what a common (internal) interface/data structures would look like to generically support these. This would include making a trade-off where the more weird scoring methods we'd support, the broader and less well-defined this interface would become. This ticket is to discuss that interface.

We should then also refactor our code so that all scoring related code is hidden behind implementations of this interface. Currently there is plenty of code scattered around the code base.

@eldering
Copy link
Member Author

eldering commented May 2, 2024

Some comments/questions for this:

  1. I think we should not allow a scoring method to take arbitrary data from the system to determine the score (like: the current CPU load on the server, to name something silly). So what should be the set of allowed input to a score for a single submission? For team team on a problem? For a team in the whole contest?
  2. Related, what is the data format for the score for a submission, problem, etc? A float, or can it be any more complex structure like, {"points": 123, "time": 6534.061, "penalty": 20, "foobar": [1, 2, 3]}?

@meisterT
Copy link
Member

meisterT commented May 3, 2024

Some thoughts here:

  • We probably want to try to implement the current score in seconds and runtime as a tie breaker using whatever new mechanism we design as a litmus test.
  • We need to check what the implications on score cache and rank cache are.
  • Partial scoring seems to be then the easiest to add.
  • As data format I'm thinking of a list of (named) floats, it should be doable to represent any scoring function with that. Then this list of floats can be used for sorting/ranking teams (that implies it's maximized and you need to negate one of the floats if you want to minimize). In addition, we probably want to add a text representation (e.g. for the scoreboard).
  • How do the new scoring methods affect the event feed?

@MathisHammel
Copy link

Hi!
I would be interested in financially supporting the development of such a feature, mainly to include optimization problems in the small contests we run. Let me know if we can make this happen, contact details are on my GitHub profile if needed.

meisterT added a commit to meisterT/domjudge that referenced this issue Mar 2, 2025
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 2, 2025
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 2, 2025
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 2, 2025
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 2, 2025
github-merge-queue bot pushed a commit that referenced this issue Mar 2, 2025
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 9, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 14, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 14, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 14, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 14, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 14, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 14, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 14, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 15, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 15, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 15, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 15, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 15, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 15, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 15, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 15, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 15, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 16, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 16, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex) with encoding enough information in the rank
cache.

The information is encoded in a sort key that can be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple is using 9 decimals
and left padded with `0`s, so it's sortable via normal DB query
operations. If sorted ascending (e.g. penalty time), then we subtract
from a very large number.

For example, with ICPC scoring, the top 2 teams from NWERC 2024 gets
these sort keys:
```
00000000000000000000013.000000000,999999999999999999998725.000000000,999999999999999999999711.000000000
00000000000000000000011.000000000,999999999999999999998918.000000000,999999999999999999999701.000000000
```

With this mechanism, we should be able to implement other planned
scoring methods (in particular partial scoring, optimization problems)
without too much complication on the business logic side.

We do use `bcmath` with fixed precision to not run into numerical
precision issues with sequencing floating point operations. This is not
important today, but will become important once we deall with
non-integers (e.g. for optimization problems).

It also caches some computation and makes scoreboard computation more
efficient today.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 16, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex when we introduce more scoring options such as
optimization problems) by encoding sufficient information within the
existing rank cache.

The information is encoded into a sort key that is designed to be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple uses 9 decimals and is
left padded with `0`s, enabling sorting via standard database query
operations. For ascendingly sorted tuple entries (e.g. penalty time),
values are subtracted from a very large constant - this ensures that
that the key can be sorted as a whole.

For example, with ICPC scoring, the top 3 teams from NWERC 2024 receive
these sort keys:
```
00000000000000000000013.000000000,99999999999999999998725.000000000,99999999999999999999711.000000000
00000000000000000000011.000000000,99999999999999999998918.000000000,99999999999999999999701.000000000
00000000000000000000011.000000000,99999999999999999998916.000000000,99999999999999999999706.000000000
```

This mechanism should facilitate the implementation of other planned
scoring methods, particularly partial scoring and optimization problems,
with reasonable complexity in the business logic.

We do use `bcmath` with fixed precision to avoid numerical precision
issues caused by the order of floating point operations.  While not
critical currently, this will be essential when handling non-integers,
such as those in optimization problems.

The new mechanism also caches some computations and thus improves
scoreboard computation efficiency.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 16, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex when we introduce more scoring options such as
optimization problems) by encoding sufficient information within the
existing rank cache.

The information is encoded into a sort key that is designed to be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple uses 9 decimals and is
left padded with `0`s, enabling sorting via standard database query
operations. For ascendingly sorted tuple entries (e.g. penalty time),
values are subtracted from a very large constant - this ensures that
that the key can be sorted as a whole.

For example, with ICPC scoring, the top 3 teams from NWERC 2024 receive
these sort keys:
```
00000000000000000000013.000000000,99999999999999999998725.000000000,99999999999999999999711.000000000
00000000000000000000011.000000000,99999999999999999998918.000000000,99999999999999999999701.000000000
00000000000000000000011.000000000,99999999999999999998916.000000000,99999999999999999999706.000000000
```

This mechanism should facilitate the implementation of other planned
scoring methods, particularly partial scoring and optimization problems,
with reasonable complexity in the business logic.

We do use `bcmath` with fixed precision to avoid numerical precision
issues caused by the order of floating point operations.  While not
critical currently, this will be essential when handling non-integers,
such as those in optimization problems.

The new mechanism also caches some computations and thus improves
scoreboard computation efficiency.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 22, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex when we introduce more scoring options such as
optimization problems) by encoding sufficient information within the
existing rank cache.

The information is encoded into a sort key that is designed to be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple uses 9 decimals and is
left padded with `0`s, enabling sorting via standard database query
operations. For ascendingly sorted tuple entries (e.g. penalty time),
values are subtracted from a very large constant - this ensures that
that the key can be sorted as a whole.

For example, with ICPC scoring, the top 3 teams from NWERC 2024 receive
these sort keys:
```
00000000000000000000013.000000000,99999999999999999998725.000000000,99999999999999999999711.000000000
00000000000000000000011.000000000,99999999999999999998918.000000000,99999999999999999999701.000000000
00000000000000000000011.000000000,99999999999999999998916.000000000,99999999999999999999706.000000000
```

This mechanism should facilitate the implementation of other planned
scoring methods, particularly partial scoring and optimization problems,
with reasonable complexity in the business logic.

We do use `bcmath` with fixed precision to avoid numerical precision
issues caused by the order of floating point operations.  While not
critical currently, this will be essential when handling non-integers,
such as those in optimization problems.

The new mechanism also caches some computations and thus improves
scoreboard computation efficiency.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 22, 2025
Progress towards DOMjudge#2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex when we introduce more scoring options such as
optimization problems) by encoding sufficient information within the
existing rank cache.

The information is encoded into a sort key that is designed to be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple uses 9 decimals and is
left padded with `0`s, enabling sorting via standard database query
operations. For ascendingly sorted tuple entries (e.g. penalty time),
values are subtracted from a very large constant - this ensures that
that the key can be sorted as a whole.

For example, with ICPC scoring, the top 3 teams from NWERC 2024 receive
these sort keys:
```
00000000000000000000013.000000000,99999999999999999998725.000000000,99999999999999999999711.000000000
00000000000000000000011.000000000,99999999999999999998918.000000000,99999999999999999999701.000000000
00000000000000000000011.000000000,99999999999999999998916.000000000,99999999999999999999706.000000000
```

This mechanism should facilitate the implementation of other planned
scoring methods, particularly partial scoring and optimization problems,
with reasonable complexity in the business logic.

We do use `bcmath` with fixed precision to avoid numerical precision
issues caused by the order of floating point operations.  While not
critical currently, this will be essential when handling non-integers,
such as those in optimization problems.

The new mechanism also caches some computations and thus improves
scoreboard computation efficiency.
github-merge-queue bot pushed a commit that referenced this issue Mar 23, 2025
Progress towards #2525.

The basic idea is to replace a lot of scattered scoring logic (which
might become more complex when we introduce more scoring options such as
optimization problems) by encoding sufficient information within the
existing rank cache.

The information is encoded into a sort key that is designed to be sorted
descendingly. The sort key is a tuple (serialized as string into the
database) of fixed precision decimals. Each tuple uses 9 decimals and is
left padded with `0`s, enabling sorting via standard database query
operations. For ascendingly sorted tuple entries (e.g. penalty time),
values are subtracted from a very large constant - this ensures that
that the key can be sorted as a whole.

For example, with ICPC scoring, the top 3 teams from NWERC 2024 receive
these sort keys:
```
00000000000000000000013.000000000,99999999999999999998725.000000000,99999999999999999999711.000000000
00000000000000000000011.000000000,99999999999999999998918.000000000,99999999999999999999701.000000000
00000000000000000000011.000000000,99999999999999999998916.000000000,99999999999999999999706.000000000
```

This mechanism should facilitate the implementation of other planned
scoring methods, particularly partial scoring and optimization problems,
with reasonable complexity in the business logic.

We do use `bcmath` with fixed precision to avoid numerical precision
issues caused by the order of floating point operations.  While not
critical currently, this will be essential when handling non-integers,
such as those in optimization problems.

The new mechanism also caches some computations and thus improves
scoreboard computation efficiency.
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 29, 2025
While you can select the new types, they won't function yet.

Part of DOMjudge#2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 29, 2025
While you can select the new types, they won't function yet.

Part of DOMjudge#2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 29, 2025
While you can select the new types, they won't function yet.

Part of DOMjudge#2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 29, 2025
While you can select the new types, they won't function yet.

Part of DOMjudge#2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 29, 2025
While you can select the new types, they won't function yet.

Part of DOMjudge#2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 30, 2025
While you can select the new types, they won't function yet.

Part of DOMjudge#2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 30, 2025
While you can select the new types, they won't function yet.

Part of DOMjudge#2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 30, 2025
While you can select the new types, they won't function yet.

Part of DOMjudge#2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
meisterT added a commit to meisterT/domjudge that referenced this issue Mar 30, 2025
While you can select the new types, they won't function yet.

Part of DOMjudge#2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
meisterT added a commit to meisterT/domjudge that referenced this issue Apr 5, 2025
While you can select the new types, they won't function yet.

Part of DOMjudge#2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
meisterT added a commit to meisterT/domjudge that referenced this issue Apr 6, 2025
While you can select the new types, they won't function yet.

Part of DOMjudge#2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
github-merge-queue bot pushed a commit that referenced this issue Apr 6, 2025
While you can select the new types, they won't function yet.

Part of #2525

Problem types are defined here: https://icpc.io/problem-package-format/spec/2023-07-draft.html#type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants