Slide 1

Slide 1 text

Shadow variables Shadow variables for VRP for VRP and task assignment and task assignment by Geoffrey De Smet OptaPlanner lead

Slide 2

Slide 2 text

What is a shadow variable? What is a shadow variable? (Genuine) planning variable Integer a with a value range of 1-10

Slide 3

Slide 3 text

What is a shadow variable? What is a shadow variable? (Genuine) planning variable Integer a with a value range of 1-10 Shadow variable Integer b = a + 100

Slide 4

Slide 4 text

What is a shadow variable? What is a shadow variable? (Genuine) planning variable Integer a with a value range of 1-10 Shadow variable Integer b = a + 100 Behavior: If a = 1 then b = 101

Slide 5

Slide 5 text

What is a shadow variable? What is a shadow variable? (Genuine) planning variable Integer a with a value range of 1-10 Shadow variable Integer b = a + 100 Behavior: If a = 1 then b = 101 If a = 2 then b = 102

Slide 6

Slide 6 text

What is a shadow variable? What is a shadow variable? (Genuine) planning variable Integer a with a value range of 1-10 Shadow variable Integer b = a + 100 Behavior: If a = 1 then b = 101 If a = 2 then b = 102 If a = 7 then b = 107

Slide 7

Slide 7 text

Why are shadow variables useful? Why are shadow variables useful? int a; int getA() { return a; } // This is NOT a shadow variable, it's non-simple getter int getB() { return a + 100; }

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Build-in shadow variables Build-in shadow variables

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Add Room.lessonList demo

Slide 17

Slide 17 text

Build-in shadow variables Build-in shadow variables @InverseRelationShadowVariable @AnchorShadowVariable Coming soon... @IndexInChainShadowVariable (name undecided)

Slide 18

Slide 18 text

Custom shadow variable Custom shadow variable DEMO DEMO

Slide 19

Slide 19 text

Don't overuse shadow variables Don't overuse shadow variables Shadow vars are de-normalization information duplication

Slide 20

Slide 20 text

Don't overuse shadow variables Don't overuse shadow variables Shadow vars are de-normalization information duplication Shadow vars work incrementally Shadow variable corruption is possible!

Slide 21

Slide 21 text

Don't overuse shadow variables Don't overuse shadow variables Shadow vars are de-normalization information duplication Shadow vars work incrementally Shadow variable corruption is possible! Shadow var Room.getLessonCount() is probably not worth it.

Slide 22

Slide 22 text

Vehicle Routing Problem (VRP) Vehicle Routing Problem (VRP)

Slide 23

Slide 23 text

Vehicle Routing Problem with Time Vehicle Routing Problem with Time Windows (VRPTW) Windows (VRPTW) Swing demo!

Slide 24

Slide 24 text

VRPTW Customer visit properties VRPTW Customer visit properties Input: readyTime: Time window start dueTime: Time window end serviceTime Change during planning:

Slide 25

Slide 25 text

VRPTW Customer visit properties VRPTW Customer visit properties Input: readyTime: Time window start dueTime: Time window end serviceTime Change during planning: arrivalTime = previousDepartureTime + travelTim

Slide 26

Slide 26 text

VRPTW Customer visit properties VRPTW Customer visit properties Input: readyTime: Time window start dueTime: Time window end serviceTime Change during planning: arrivalTime = previousDepartureTime + travelTim startTime = max(readyTime, arrivalTime

Slide 27

Slide 27 text

VRPTW Customer visit properties VRPTW Customer visit properties Input: readyTime: Time window start dueTime: Time window end serviceTime Change during planning: arrivalTime = previousDepartureTime + travelTim startTime = max(readyTime, arrivalTime departureTime = startTime + serviceTim

Slide 28

Slide 28 text

VRPTW Customer visit properties VRPTW Customer visit properties Input: readyTime: Time window start dueTime: Time window end serviceTime Change during planning: arrivalTime = previousDepartureTime + travelTim startTime = max(readyTime, arrivalTime departureTime = startTime + serviceTim Hard constraint: departureTime <= dueTime

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

VRPTW with lunches VRPTW with lunches Original: arrivalTime = previousDepartureTime + travelTim startTime = max(readyTime, arrivalTime

Slide 36

Slide 36 text

VRPTW with lunches VRPTW with lunches Original: arrivalTime = previousDepartureTime + travelTim startTime = max(readyTime, arrivalTime Extra logic to allow for lunch: If travelTime contains 12:00, add 1 hour to transitTime for lunch. Else serviceTime contains 12:00, add 1 hour to serviceTime for lunch.

Slide 37

Slide 37 text

VRPTW with lunches VRPTW with lunches Original: arrivalTime = previousDepartureTime + travelTim startTime = max(readyTime, arrivalTime Extra logic to allow for lunch: If travelTime contains 12:00, add 1 hour to transitTime for lunch. Else serviceTime contains 12:00, add 1 hour to serviceTime for lunch. All this logic ends up in the VariableListener.

Slide 38

Slide 38 text

Task assignment Task assignment

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

Task assignment Task assignment DEMO DEMO

Slide 46

Slide 46 text

Advanced design patterns Advanced design patterns

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

Getting started Getting started

Slide 63

Slide 63 text

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 ...

Slide 64

Slide 64 text

@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)