简体   繁体   English

在OptaPlanner中更改周末定义

[英]Changing the weekend definition in OptaPlanner

I'm building a roster planner application based on the NurseRostering example for OptaPlanner 7.5.0 Final. 我正在基于OptaPlanner 7.5.0 Final的NurseRostering示例构建花名册计划程序应用程序。

The rostering demands for holidays such as Christmas or Easter are identical to regular weekends (same shift type & amount), therefore I want to change the default weekend definition to include predefined holidays. 圣诞节或复活节等假期的花名要求与正常周末相同(轮班类型和金额相同),因此我想更改默认的周末定义以包括预定义的假期。

I tried changing the WeekendDefinition class in the NurseRostering example (src\\main\\java\\org\\optaplanner\\examples\\nurserostering\\domain\\WeekendDefinition.java), but is has no effect on the weekend definition used by the planner. 我尝试更改NurseRostering示例(src \\ main \\ java \\ org \\ optaplanner \\ examples \\ nurserostering \\ domain \\ WeekendDefinition.java)中的WeekendDefinition类,但对计划者使用的周末定义没有影响。
How do I change the weekend definition used by OptaPlanner? 如何更改OptaPlanner使用的周末定义?

Start from ShiftAssignment.isWeekend() : https://github.com/kiegroup/optaplanner/blob/master/optaplanner-examples/src/main/java/org/optaplanner/examples/nurserostering/domain/ShiftAssignment.java#L94 ShiftAssignment.isWeekend()开始: https : //github.com/kiegroup/optaplanner/blob/master/optaplanner-examples/src/main/java/org/optaplanner/examples/nurserostering/domain/ShiftAssignment.java#L94

    public boolean isWeekend() {
        if (employee == null) {
            return false;
        }
        WeekendDefinition weekendDefinition = employee.getContract().getWeekendDefinition();
        DayOfWeek dayOfWeek = shift.getShiftDate().getDayOfWeek();
        return weekendDefinition.isWeekend(dayOfWeek); // Add or shiftDate is 25-DEC
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM