Skip to content
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

Safety margin can be shown wrong with fixed time limits #151

Open
thorehusfeldt opened this issue Nov 19, 2019 · 3 comments
Open

Safety margin can be shown wrong with fixed time limits #151

thorehusfeldt opened this issue Nov 19, 2019 · 3 comments

Comments

@thorehusfeldt
Copy link
Contributor

thorehusfeldt commented Nov 19, 2019

timelim_margin may be a float (because safety_margin can be set to, say, 1.2 in problem.yaml), it is not rounded to int in this case:

timelim_margin = timelim * safety_margin

When the new time limit is announced to the user a few lines below, this is (implicitly) rounded downwards because the string expression'%d' % 2.4' apparently gives '2' (while '{:d}.format(2.4)' would have crashed).

Should just be timelim_margin = int(timelim * safety_margin) or maybe timelim_margin = round(timelim * safety_margin) or timelim_margin = int(.5 + timelim * safety_margin).

I’ll fix this (as part of a larger cleanup).

@austrin
Copy link
Contributor

austrin commented Dec 4, 2019

Sounds good, FTR rounding it to nearest integer sounds like the correct thing.

@RagnarGrootKoerkamp
Copy link
Contributor

I think I've just been hit by this:

   Slowest AC runtime: 0.492, setting timelim to 1 secs, safety margin to 2 secs
...
WARNING in submissions: TLE submission mees-exclude-random-quadrangles.py (Python 3 w/Pypy) sensitive to time limit: limit of 1 secs -> TLE, limit of 2 secs -> AC
   TLE submission mees-exclude-random-quadrangles.py (Python 3 w/Pypy) OK: TLE [test case: test case secret/wide, CPU: 2.43s @ test case secret/random-max-7]

The safety margin is reported to be 2s, but a TLE submission with runtime of 2.43s still give a warning.

@thorehusfeldt
Copy link
Contributor Author

By the way, no fix from my side is imminent, and the “larger cleanup” has stalled. I am still stumped by various definitions of “what a grade/judgement/verdict/score is” and can’t become constructive.

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

No branches or pull requests

3 participants