Skip to content

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

@thorehusfeldt

Description

@thorehusfeldt

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions