问题
When creating a schedule you have to abide by the law (hard requirement) that stipulates
that as an employee you are only allowed to work a certain amount of hours per each given Sevenday period and you must . The reason that it does not say calendar week is to provide some wiggle room for the employer when creating the schedule (usually for 4-16 weeks ahead). Once your startdate
for this planning period is set it cannot change until you want to do a complete replanning but then you need to inform your employees.
So it can be seen as a variable until you have accepted the schedule then it becomes a constant. It is individual for each employee of course. This startdate
would be implicitly set by your first assigned shift's start date ofc but it usually not enough to finetune the schedule. Also, this startdate
is set all the way down to hours and minutes of a certain day. For the general scheduling, this is indeed a business constraint but can be an additional optimization when creating a summer vacation schedule.During the summer period, it is often not the same Shifts as during the regular business weeks.
My question is how I declare this StartDate variable in the Employee model? It is a pure planning variable within the planning variable as you can see below in the models.
How do I declare the valuerange
as {20200101 - 20203030}? It can be down to hours and minutes but not seconds and milliseconds
I read up on the Chained Variables but my Entities (Shift Assignments) itself are not chained or dependent on each other like in the TSP problem.
public Employee {
String name
Date startDate <-- PlanningVariable? how to declare the valuerange?
}
public Shift {
Date start
Date end
}
@PlanningEntity
public ShiftAssignment {
Shift shift
@PlanningVariable(valueRangeProviderRefs = {"employeeRange"}) <--Employee is a planningvariable here
Employee employee
}
@PlanningSolution
public ShiftRooster {
@ProblemFactCollectionProperty
private List<Employee> employees
@PlanningEntityCollectionProperty
private List<ShiftAssignment> shiftAssignments
}
Do I need to wrap the startDate
in Employee in a Class to able to annotate it?
来源:https://stackoverflow.com/questions/64968605/employee-schedule-with-individual-and-vairiable-startdate-for-each-employee