Plan single assignment

17 views
Skip to first unread message

Julian Ma

unread,
Sep 29, 2022, 1:08:04 PMSep 29
to OptaPlanner development
Hi everyone, 

i am trying to build a tool to assign resources and a timeslot to an appointment. I have a hard constraint to prevent overlaps of the same resource and a soft constraint to plan early (penalize by begin grain). Now i am facing the following problem: 
I have two rooms A and B and two already booked and fixed appointments, s.t. room A is booked from 0-3 and room B is booked from 4-7. When i plan a third appointment of length 3, the construction heuristic assigns room A first (and thus at grain 3) and then i assume the solver does not have an incentive to switch to room B because of lowering the score, and instead of the optimal solution to plan it in B at 0, it is planned in A at 3. 
First of all, my question is, whether this use-case makes sense. 
Second of all, in case the above question is a yes, how do i prevent it? I was thinking of cartesianproductmoves but didnt implement it yet as im not that far with getting familiar yet.

Kind regards, 

Julian

Julian Ma

unread,
Sep 30, 2022, 5:41:08 AMSep 30
to OptaPlanner development
Some more background on my design, since i came up with a potential solution. I have two planning entities with a shadow variable because the resource begin can be deduced from appointment with an offset that must not be violated.
@PlanningEntity
Appointment{
@PlanningVariable
beginGrain
}
@PlanningEntity
ResourceAssignment{
@PlanningVariable
resource
@CustomShadowVariable(source: assignment.begin)
begin
}

what fixed it for me was changing the order of the entity classes in the solver configuration .withEntityClasses() to put appointment first so that the CH picks the begin first, instead of the other way round
Reply all
Reply to author
Forward
0 new messages