Skip to content

Implement optimization problems #2998

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
wants to merge 18 commits into
base: 8.3
Choose a base branch
from

Conversation

as6325400
Copy link
Contributor

@as6325400 as6325400 commented May 21, 2025

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.

截圖 2025-05-21 晚上9 24 44
截圖 2025-05-21 晚上9 30 26

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:

  • Larger is best
  • Smaller is best

You can then configure whether a higher or lower score is considered better for optimization problems.

截圖 2025-05-21 晚上9 22 30
截圖 2025-05-21 晚上9 23 00

Note: It is asserted that Runtime as score tiebreaker cannot be used at the same time as Opt score as score tiebreaker.
截圖 2025-05-21 晚上9 45 46

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.
截圖 2025-05-21 晚上9 35 57

Regardless of whether the tiebreaker setting is enabled, jury members will always be able to see the optscore for each submission.
截圖 2025-05-21 晚上9 39 05

Standard problems (without optimization scores) are unaffected by this feature.
截圖 2025-05-21 晚上9 39 45

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant