Implement optimization problems #2998
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As part of a feature I needed for my class, I went ahead and implemented it myself. I'm not sure if this is something the DOMjudge team would be interested in adopting, but I thought I'd share it in case it can serve as a useful reference.
Issue: #2519
To use this feature, simply have the compare script output to stderr a line starting with
OPT_SCORE=
. Currently, I'm storing the value as a float, so both integers and decimals are supported.On the judgehost side, the score for each testcase is recorded in the judging_run table and then propagated to scorecache and rankcache.
To enable using the optscore as a contest tiebreaker, go to the contest settings and set
"Opt score as score tiebreaker"
to yes. This will reveal two options:You can then configure whether a higher or lower score is considered better for optimization problems.
Note: It is asserted that Runtime as score tiebreaker cannot be used at the same time as Opt score as score tiebreaker.

In the team interface, if Opt score as score tiebreaker is enabled, the optscore will be shown in the submission list for each submission. For problems that do not report an optscore, a value of 0 will be shown on the scoreboard and - in the submission list.

Regardless of whether the tiebreaker setting is enabled, jury members will always be able to see the optscore for each submission.

Standard problems (without optimization scores) are unaffected by this feature.

This implementation is essentially a minimum viable product (MVP). I’m not sure if outputting OPT_SCORE= directly in the compare script is the best long-term approach, but it works well for now.
Since my class is actively using this judge system, I’ve implemented the changes on version 8.3.1. If this feature is of interest, I can port the code to the main branch.
I’ve also set up a live demo judge at: https://domjudge.as6325400.org/
problem: https://domjudge.as6325400.org/public/problems/4/statement
If you’d like to try it out, feel free to message me on Slack for a login account.