OptaPlanner for booking system availabilities API

24 views
Skip to first unread message

Fabio Napoleoni

unread,
Jun 21, 2021, 6:46:40 AM6/21/21
to OptaPlanner development
I saw this question on other threads and I still not understand if this use case is a good fit for OptaPlanner.

Some threads with a similar question:


I'm trying to solve the same exact issue described in SO question i.e. is it possible to use optaplanner to get a list of availabilities? 

I can see from other answers that OptaPlanner wouldn't be suited to book a single appointment and I understand why, but in both those questions what is trying to get achieved is a list of possible booking, not to check if a single one can be fulfilled.

I understand that checking if a single booking is available is not a job for OP, but on the contrary if I want to plan all possible bookings under a set of constraints seems to be a good case.

I'm thinking to something like this model but I'm not able to see the whole picture and if I'm on the right way

@PlanningSolution
public class SlotAssignment {

@ValueRangeProvider(id = "timeGrainRange")
@ProblemFactCollectionProperty
private List<TimeGrain> timeGrainList = Collections.emptyList();

@ValueRangeProvider(id = "employeeRange")
@ProblemFactCollectionProperty
private List<Employee> employees = Collections.emptyList();

@ValueRangeProvider(id = "slotRequests")
@PlanningEntityCollectionProperty
private List<Slot> slotAssignments = new ArrayList<>();

@PlanningScore
private HardSoftScore score;
}

@PlanningEntity
public class Slot {
// Assigned by OP
@PlanningVariable(valueRangeProviderRefs = "employeeRange")
Employee employee;

// Starting time of slot chain
@AnchorShadowVariable(sourceVariableName = "previousSlot")
TimeGrain startingTimeGrain;

// This will be moved by engine
@PlanningVariable(valueRangeProviderRefs = "slotRequests", graphType = PlanningVariableGraphType.CHAINED)
private Slot previousSlot;

// This will updated accordingly to previous slot
@InverseRelationShadowVariable(sourceVariableName = "previousSlot")
private Slot nextSlot;

// Service assigned to this slot, problem Fact, never null
Service service;
}

Is this model achievable with OP? Given a set of TimeGrains, a set of Employes, a set of requested services, can optaplanner produce a list of Slots in which every slot has 
  • a starting TimeGrain (at the beginning of chain)
  • an employee (possibly pinned)
  • a service to perform (initialized by problem submitter?)
  • full chain of other slots each with a service and an employee assigned by OP (possibly pinned)
Or I'm completely wrong? Or maybe chaining is not needed at all.

If this is possibile I think that it will be a good use case to implement in optaplanner-examples since I wasn't able to find anything similar on the web.

Thanks.



Osamu Kuniyasu

unread,
Jun 22, 2021, 1:02:48 AM6/22/21
to OptaPlanner development

I've experienced a slightly similar use case.

A service provider sales want to put a visit order to setup the equipments for for a customer.
Such setup visit can be 1 slot in AM and 2 slots in PM.
It is an optimization problem how to improve effectiveness of technician dispatching (routing).

After designing the system, we proposed an optimization system for the routing problem.
That routing optimization is run every night in a batch job.
From that routing solution, the post-processing system determines the free slots available to receive new visit orders.
Sales then sets up new visit orders for the next business day, and that night, the optimization system improves the routing.... it is cyclic process.

The above design has the advantage of loosely coupling the order-acceptance system with the operation system behind it, thereby narrowing the scope of influence of each.

Best Regards,
Osamu Kuniyasu


2021年6月21日月曜日 19:46:40 UTC+9 f.nap...@gmail.com:
Reply all
Reply to author
Forward
0 new messages