I am using Timefold to model a relay-task planning system. I had modeled out my problem when using a single @PlanningVariable
. The high level workflow is I get tasking, and it runs through a couple services to provide times a possible relay can happen. Giving me a collection of TimeSlots of when a relay can occur. So my @PlanningEntity
is the Task. The Task has a @ValueRangeProvider
of getPossibleTimeSlots()
which is the getter for the collection of possible TimeSlots
I received in a request. Then I use an over constrained design to weight these possible TimeSlots against each other to get a selectedTimeSlot
which is my @PlanningVariable
on the task entity.
Now I am looking at changing to a @PlanningListVariable
,for reasons that it might take too long to explain here! I have been struggling though because my @ValueRangeProvider
is on my @PlanningEntity
because the range that the @PlanningListVariable
should be able to select from is unique to the task, a different task should never access another tasks getPossibleTimeSlots()
. According to the Timefold's documentation a @ValueRangeProvider
on a @PlanningEntity
is not supported when using a @PlanningListVariable
.
So I tried making a new @ValueRangeProvider
method in my @PlanningSolution
class that looked like the following.
@ValueRangeProvider(id = "timeSlotRange")
public List<TimeSlot> getTimeSlots(Task task) {
return task.getPossibleTimeSlots();
}
This did not work as I get Failed to generate member accessor for the method....
Im assuming that the @ValueRangeProvider(id = "timeSlotRange")
does not know what to do with the parameter.
With all this being said I am wondering what the correct way would be to handle this issue of having a per @PlanningEntity
unique value range, while using the @PlanningListVariable
. I looked at possibly storing all the TimeSlots
in a common collection in my @PlanningSolution
class, and looking at a variable listener for the possible timeslots for an induvial task, but I was not sure if this would be the way to go, or how to do it in the most efficient way. Any input helps Thanks!
At the moment, Timefold Solver does not support value ranges on entities. We recognize that this is a major limitation for the list variable, and we want to address it at some point.
The only workaround that I can think of is to implement filtered move selection.