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

The calculation of constraint at least 10 hours between two shifts #25

Open
AybukeAk opened this issue Feb 15, 2023 · 1 comment
Open

Comments

@AybukeAk
Copy link

Hello!

Could there be an error when calculating the constraint that we specified should not be less than 10 hours between two shifts? Although 10 hours are calculated in seconds, why do we divide by 60 again after the total_seconds() method in line 68, where we get the difference between the 2nd shift and the 1st shift? Could you please explain that part to me?

Thanks in advance!

(TEN_HOURS_IN_SECONDS - (second_shift.start - first_shift.end).total_seconds()) // 60)

@Christopher-Chianelli
Copy link
Collaborator

That line is in the penalty, and thus controls how much each violation penalizes by. In this case, we penalize by how many minutes are between the current break end and the 10 hour minimum. The reason we do it in minutes is to match the penalty of the corresponding OptaPlanner quickstart, which uses minutes: https://github.com/kiegroup/optaplanner-quickstarts/blob/b1f4adbde452f93c7d23a8822527c7b7fad66717/use-cases/employee-scheduling/src/main/java/org/acme/employeescheduling/solver/EmployeeSchedulingConstraintProvider.java#L68-L69

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

2 participants