Search code examples
springspring-bootschedulingoptaplannertimetable

Plan a schedule in optaplanner that takes in account that the lesson takes 2 hours or 3 hours


I have made a timetable that needs to be populated with lessons, each lesson has a subject a studentGroup and two planning variables which are timeslot which indicates the day and the beginning and the end of the lesson and also the room. My problem is that i want to fix for each lesson the time they should be taken for exampe math would tak 2 hours, Chemistery would take 3 hours.

Is their a way to do that in optaplanner (adding some special function or constraints) to achieve this because i didn't see that in the documentation.

Any help is appreciated and thanks in advance.


Solution

  • Read the docs chapter "Design patterns", the section about "Assigning to time".

    That leaves you with several options:

    • The conference scheduling example caters for talks of different talk types that have different lengths. It can however still use the timeslot pattern, because the rooms and the timeslots have a required talk type, so there is never the choice if a timeslot of 2 hours is used by 1 lab (2 hours) or 2 conf talks (1 hour each). If that choice were there, the timeslot pattern wouldn't fit.

    • The timegrain pattern is the most flexible, but it also scales the worst (but I doubt that's issue for a typical school timetabling dataset). That one will fit here.