Real-time constraint solving (with OptaPlanner) by Geoffrey De Smet - - PowerPoint PPT Presentation

real time constraint solving with optaplanner
SMART_READER_LITE
LIVE PREVIEW

Real-time constraint solving (with OptaPlanner) by Geoffrey De Smet - - PowerPoint PPT Presentation

Real-time constraint solving (with OptaPlanner) by Geoffrey De Smet OptaPlanner lead A dierent kind of decisions? Find optimal solution and scale out for an NP-complete problem? Is P = NP? Unresolved since 1971 1 000 000 $ reward since


slide-1
SLIDE 1

Real-time constraint solving (with OptaPlanner)

by Geoffrey De Smet OptaPlanner lead

slide-2
SLIDE 2

A dierent kind of decisions?

slide-3
SLIDE 3
slide-4
SLIDE 4
slide-5
SLIDE 5
slide-6
SLIDE 6
slide-7
SLIDE 7

Find optimal solution and scale out for an NP-complete problem?

⇔ Is P = NP? Unresolved since 1971 1 000 000 $ reward since 2000 One of the 7 Most believe P ≠ NP ⇔ Impossible to nd optimal solution and scale out 3000+ known NP-complete problems ( ) Millennium Problems (http://www.claymath.org/millennium-problems) wikipedia (http://en.wikipedia.org/wiki/List_of_NP-complete_problems)

slide-8
SLIDE 8
slide-9
SLIDE 9

Use the right tool for the job.

Insurance rate calculation: decision table License plate recognition: neural net Employee shift rostering: constraint solver Don't use a hammer on a screw.

slide-10
SLIDE 10

Constraint solver use cases...

Agenda scheduling: doctor appointments, court hearings, maintenance jobs, TV advertisements, ... Educational timetabling: lectures, exams, conference presentations, ... Task assignment: afnity/skill matchmaking for tax audits, wage calc, ... Employee shift rostering: nurses, repairmen, help desk, remen, ... Vehicle routing: route trucks, buses, trains, boats, airplanes, ... Bin packing: ll containers, trucks, ships, storage warehouses, cloud computers nodes, prisons, hospitals, ... Job shop scheduling: assembly lines for cars, furniture, books, ... Cutting stock: minimize waste while cutting paper, steel, carpet, ... Sport scheduling: football/baseball league, tennis court utilization, ... Financial optimization: investment portfolio balance, risk spreading, ...

slide-11
SLIDE 11

Employee shift rostering

slide-12
SLIDE 12
slide-13
SLIDE 13

What is constraint solving?

slide-14
SLIDE 14

Implementation

  • 1. Dene domain
  • 2. Dene constraints
  • 3. Solve
slide-15
SLIDE 15
slide-16
SLIDE 16

Dene domain

slide-17
SLIDE 17
slide-18
SLIDE 18
slide-19
SLIDE 19

Score calculation

Easy Java (slow) Incremental Java (painful) Drools DRL (also incremental)

slide-20
SLIDE 20
slide-21
SLIDE 21

Required skill constraint (easy Java)

public class MyScoreCalculator implements EasyScoreCalculator<Roster> { public Score calculateScore(Roster roster) { int hardScore = 0; for (Shift shift : roster.getShiftList()) { Skill requiredSkill = shift.getSpot().getRequiredSkill(); if (shift.getEmployee() != null // Employee lacks required skill && !shift.getEmployee().hasSkill(requiredSkill)) { // Lower hard score hardScore--; } } ... return HardSoftScore.valueOf(hardScore, softScore); }

slide-22
SLIDE 22
slide-23
SLIDE 23

Required skill constraint (Drools DRL)

rule "Required skill" when Shift( getEmployee() != null, // Employee lacks required skill !getEmployee().hasSkill(getSpot().getRequiredSkill())) then // Lower hard score scoreHolder.addHardConstraintMatch(kcontext, -1); end

slide-24
SLIDE 24
slide-25
SLIDE 25

When do we solve?

Publish schedule weeks in advance Affects family/social lives Ad hoc changes Sick employees Shift changes

slide-26
SLIDE 26
slide-27
SLIDE 27
slide-28
SLIDE 28

Vehicle Routing Problem

slide-29
SLIDE 29

Real-time planning

Warm starts to solve in milliseconds

slide-30
SLIDE 30
slide-31
SLIDE 31

Vehicle Routing Problem

slide-32
SLIDE 32

@GeoffreyDeSmet

Q & A

OptaPlanner Feedback www.optaplanner.org (https://www.optaplanner.org) @GeoffreyDeSmet (https://twitter.com/GeoffreyDeSmet)