OptaPlanner + Drools - transport scheduling

27 views
Skip to first unread message

Christopher Smith

unread,
Oct 28, 2024, 10:04:47 AM10/28/24
to OptaPlanner development

Hi there,

We have got a problem that we are going to try and solve using OptaPlanner as a CSP solver + Drools as the rules engine.

Problem:

  • There are multiple transport legs (train, bus, ferry etc) in a travel day
  • Each transport leg has a limited set of departure/arrival times, some with many departures per day, and others with very few
  • We need to allocate departure times for each transport leg, whilst also making sure these times meet lots of business rules
  • Some are hard constraints (e.g. no departures before 7am, or at least X minutes for transfers) and others are soft constraints (e.g. favour an arrival time as close to Xpm if there are Y trains in the travel day)

We have a long list of constraints, however here are a few examples:

  • First leg’s departure: after 09:00, closer to 10:30 the better
  • Last leg’s arrival:
    • favour on or before 18:00
    • if no times available in above range, favour departures as early as 08:00 to prevent late arrival
    • if no times available in above range, favour later arrival up to 21:00
  • If operator is XYZ, ensure arrival time of any preceding leg is at least 90 minutes before departure
  • If same station change:
    • and subsequent leg’s duration is less than X hours, add Y minutes to the earliest allowed departure time of the subsequent leg
    • and subsequent leg’s duration is X+ hours, add Z minutes to the earliest allowed departure time of the subsequent leg
  • If subsequent leg departs from a different station to that which the preceeding leg arrives, add X minutes to the earliest allowed departure time of the subsequent leg
  • If preceding leg is overnight, add X minutes to the earliest allowed departure time of the subsequent leg

The rules would be handled by the tech team initially, so editing a DRL file is fine, rather than setting up a nice rules editor interface for business users.

How would you recommend using OptaPlanner and Drools to solve this problem? Are there are any specific design patterns or implementations you would use e.g. the chained through time pattern?

Our team haven’t used this tech before and so we’re looking for a way to kickstart the project using advice from people who are experienced with this sort of problem. We’d be happy to pay for a day of someone’s time, if anyone has a lot of experience in this, can show us the best way to start the project, and express our constraints in a way that will yield the desired results.

Thanks!

Reply all
Reply to author
Forward
0 new messages