optaplannertimefold

How to optimize task allocation with time constraints using Timefold solver?


I'm new to Timefold and would appreciate any guidance on how to model and choose the right solver pattern for the following allocation problem:

  1. We have tasks of different types and duration.
  2. Tasks have time constraints (e.g., must start after a specific date or must finish before another date).
  3. We have workers who can execute the tasks.
  4. Each worker can only execute certain types of tasks.
  5. Each worker is available periodically, but only for a variable amount of time.

The goal is to allocate all tasks by feeding each worker's available slot with as much of tasks as possible (and, of course, respecting the tasks constraints)

I managed to use the solver to assign tasks to workers' available time slots, but I can only assign one task per slot, which results in inefficient use of workers' available time (with unused time).

What solver pattern should I use to improve this, so that workers can execute multiple tasks within their available time slots without wasting resources? Any tips or examples would be highly appreciated!


Solution

  • There are a few different patterns available when working with time. You seem to currently be using Timeslots but this indeed limits tasks and leads to some wasted time (since a task always has to take up the full timeslot).

    On this page, you can read about 2 alternative approaches: Timegrain and Chained Through Time.

    The task allocation quickstart on GitHub uses Chained Through Time. It seems to match most of your requirements.