0

I am a beginner of OptaPlanner I have to execute the example but our requirement is different as below.

In our case assigning lesson as a different time slot, for example in std-10 have a total of 4 hours and its time slot is 1 hour per lecture and subjects are fixed, and same 4 hours in std-7 have 5 lecture and also its subjects are fixed and its time slot is 45 minutes so how I can manage it using constraint? Is there any example to refer it to get some idea? Please help!

Thanks in advance!

Keyur Bhanderi
  • 1,524
  • 1
  • 11
  • 17

1 Answers1

1

There's basically two approaches:

  1. Like the conference scheduling example in optaplanner-examples (zip download): create 2 LessonTypes and create separate timeslots for each LessonType. Then add a hard constraint - or even a @ValueRangeProvider on entity like that example does - to never put a Lesson of LessonType "Lab (2 hours)" in a timeslot of LessonType "conf talk (1 hour)". It does a similar approach for rooms. This works well if your room+timeslot combinations are assigned to a LessonType (not a lesson) in advance (before solving), otherwise it doesn't. For conference scheduling, that is always the case.

  2. Like the maintenance scheduling quickstart (optaplanner-quickstarts on github) use a timegrain pattern (explained in docs) for maximum flexibility, but at a higher complexity cost.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
  • As per your solution, I have created 2 lesson types and passed separate time slots to both, But now I am stuck. how I can set hard and soft constraints. – Keyur Bhanderi Feb 04 '22 at 13:24