Upgrade to Pro — share decks privately, control downloads, hide ads and more …

KieLive#15: OptaPlanner domain models and desig...

KieLive#15: OptaPlanner domain models and design patterns

In this live session, we'll learn how to properly choose your @PlanningVariable

Link to the presentation: http://red.ht/KieLive15

KieLive#15: OptaPlanner domain models and design patterns

Picking the right model for your first optimization problem is notoriously hard. Luckily it gets a lot easier the more practice you have. In this session, I’ll walk you through a number of OptaPlanner models and explain the motivation for the design of each model.

About the invited speaker:
Geoffrey De Smet is the founder and lead of OptaPlanner, the open source AI constraint solver in Java that is used across the globe for all kinds of planning and scheduling operations.

KIE Community

January 20, 2021
Tweet

More Decks by KIE Community

Other Decks in Technology

Transcript

  1. Announcements Announcements OptaPlanner Quick Starts repository Quick Starts Showcase DEMO

    github.com/kiegroup/optaplanner-quickstarts (https://github.com/kiegroup/optaplanner- quickstarts)
  2. Given a text like this... School timetabling School timetabling Optimize

    a school timetable of lessons to assign teachers and students in the best room at the best time.
  3. Given a text like this... School timetabling School timetabling Optimize

    a school timetable of lessons to assign teachers and students in the best room at the best time. Come up with a model like this...
  4. Let's take it step by step... School timetabling School timetabling

    Optimize a school timetable of lessons to assign teachers and students in the best room at the best time.
  5. What changes during planning? What changes during planning? The assigned

    timeslot of each lesson The assigned room of each lesson
  6. What are the constraints? What are the constraints? 1. Which

    hard constraints are build-in in our model?
  7. What are the constraints? What are the constraints? 1. Which

    hard constraints are build-in in our model? 2. Which constraints affect our planning variables?
  8. Constraints inventory Constraints inventory Each lesson must have one timeslot

    Each lesson must have one room No lessons in the same room together No teacher with lessons at the same time Students must be able to attend all lessons Use each teacher's time ef ciently Give students variety in subjects
  9. Constraints inventory Constraints inventory Each lesson must have one timeslot

    (hard) Each lesson must have one room No lessons in the same room together No teacher with lessons at the same time Students must be able to attend all lessons Use each teacher's time ef ciently Give students variety in subjects
  10. Constraints inventory Constraints inventory Each lesson must have one timeslot

    (hard) Each lesson must have one room (hard) No lessons in the same room together No teacher with lessons at the same time Students must be able to attend all lessons Use each teacher's time ef ciently Give students variety in subjects
  11. Constraints inventory Constraints inventory Each lesson must have one timeslot

    (hard) Each lesson must have one room (hard) No lessons in the same room together (hard) No teacher with lessons at the same time Students must be able to attend all lessons Use each teacher's time ef ciently Give students variety in subjects
  12. Constraints inventory Constraints inventory Each lesson must have one timeslot

    (hard) Each lesson must have one room (hard) No lessons in the same room together (hard) No teacher with lessons at the same time (hard) Students must be able to attend all lessons Use each teacher's time ef ciently Give students variety in subjects
  13. Constraints inventory Constraints inventory Each lesson must have one timeslot

    (hard) Each lesson must have one room (hard) No lessons in the same room together (hard) No teacher with lessons at the same time (hard) Students must be able to attend all lessons (hard) Use each teacher's time ef ciently Give students variety in subjects
  14. Constraints inventory Constraints inventory Each lesson must have one timeslot

    (hard) Each lesson must have one room (hard) No lessons in the same room together (hard) No teacher with lessons at the same time (hard) Students must be able to attend all lessons (hard) Use each teacher's time ef ciently (soft) Give students variety in subjects
  15. Constraints inventory Constraints inventory Each lesson must have one timeslot

    (hard) Each lesson must have one room (hard) No lessons in the same room together (hard) No teacher with lessons at the same time (hard) Students must be able to attend all lessons (hard) Use each teacher's time ef ciently (soft) Give students variety in subjects (soft)
  16. Which hard constraints are build-in Which hard constraints are build-in

    in our model? in our model? Each lesson must have one timeslot (build-in hard)
  17. Which hard constraints are build-in Which hard constraints are build-in

    in our model? in our model? Each lesson must have one timeslot (build-in hard) Each lesson must have one room (build-in hard)
  18. Hard constraints (not build-in) Hard constraints (not build-in) Room con

    ict: No 2 lessons in the same room at the same time Teacher con ict: No 2 lessons for the same teacher at the same time Student con ict: No 2 lessons for the same student group at the same time
  19. Hard constraints (not build-in) Hard constraints (not build-in) Room con

    ict: No 2 lessons in the same room at the same time Teacher con ict: No 2 lessons for the same teacher at the same time Student con ict: No 2 lessons for the same student group at the same time Formalize your constraints.
  20. Soft constraints Soft constraints Teacher time ef ciently: No gap

    between teacher lessons Subject variety: No sequential lessons on the same subject
  21. Some constraints affect the Some constraints affect the planning variables.

    planning variables. Most don't. Learn to tell them apart: Do these planning variables hinder any of the constraints?
  22. Constraints that Constraints that don't affect the model don't affect

    the model Skill requirements and af nity Availability and unavailability Fairness and load balancing Time windows, ... (many more)
  23. Constraints that Constraints that don't affect the model don't affect

    the model Skill requirements and af nity Availability and unavailability Fairness and load balancing Time windows, ... (many more) Most constraints do not affect the model!
  24. Quick starts Quick starts github.com/kiegroup/optaplanner-quickstarts (https://github.com/kiegroup/optaplanner- quickstarts) $ git clone

    [email protected]:kiegroup/optaplanner-quickstarts.git ... $ cd optaplanner-quickstarts $ cd quarkus-school-timetabling $ mvn quarkus:dev ...
  25. @GeoffreyDeSmet Q & A Q & A Homepage Slides User

    guide Feedback www.optaplanner.org (https://www.optapl www.optaplanner.org/learn/slides.html (https://www.optaplanner.org/learn/slides www.optaplanner.org/learn/documentatio (https://www.optaplanner.org/learn/docum @GeoffreyDeSmet (https://twitter.com/GeoffreyDeSmet)