SlideShare ist ein Scribd-Unternehmen logo
1 von 83
Business resource optimization
             with
       Drools Planner
         Geoffrey De Smet
Demo
Travelling Salesman Problem
       Vehicle Routing




                              2
Every organization has planning problems.




                                            3
What is a planning problem?

             Complete goals
             With limited resources
             Under constraints




                                       4
Hospital employee rostering

                                                      Assign each
                                                       ●   Shift
                                                      To
                                                       ●   Employee
                                                      Constraints
                                                       ●   Employment contract
http://www.flickr.com/photos/glenpooh/709704564/       ●   Free time preferences
                                                       ●   Skills




                                                                                   5
Demo
Employee rostering




                     6
Other planning problems

Course scheduling                                     Hospital bed planning




                                                           http://www.flickr.com/photos/markhillary/2227726759/
   http://www.flickr.com/photos/phelyan/2281095105/



 Many more: port planning, airline routing, train composition,
        task assignment, assembly line planning,
      satellite bandwidth planning, stock cutting, ...
                                                                                                                  7
Bin packing in the cloud

                                                       Assign each
                                                        ●   Process
                                                       To
                                                        ●   Server
                                                       Constraints
                                                        ●   Hardware requirements
                                                        ●   Minimize server cost
http://www.flickr.com/photos/torkildr/3462607995/




                                                                                    8
Bin packing in the cloud

                                                       Assign each
                                                        ●   Process
                                                       To
                                                        ●   Server
                                                       Constraints
                                                        ●   Hardware requirements
                                                        ●   Minimize server cost
http://www.flickr.com/photos/torkildr/3462607995/




                                                                                    9
Which processes do we assign
to this server?




                               10
How did we find that solution?




                                 11
First fit by decreasing size




                               12
First fit by decreasing size




                               13
First fit by decreasing size




                               14
First fit by decreasing size




                               15
Another case




               16
Try FFD again




                17
Try FFD again




                18
Try FFD again




                19
Try FFD again




                20
FFD failure




              21
NP complete




              22
NP complete

                                                                  No silver bullet known
                                                                   ●   Holy grail of computer
                                                                       science
                                                                        ●   P == NP
                                                                   ●   Probably does not exist
                                                                        ●   P != NP
                                                                  Root problem of
                                                                   all planning problems

http://www.flickr.com/photos/annguyenphotography/3267723713/




                                                                                                 23
Multiple servers...




                      24
Multiple servers...




                      25
Multiple servers...




                      26
Multiple servers...




                      27
Multiple constraints...




                          28
Multiple constraints...




                          29
Multiple constraints...




                          30
Multiple constraints...




                          31
Organizations rarely optimize
    planning problems.




                                32
Given 2 solutions, which one is better?




                                          33
Each Solution has 1 Score




                            34
Each Solution has 1 Score




                            35
Better score => better solution




                                  36
Better score => better solution




                                  37
Best score => best solution




                              38
Best score => best solution




                              39
Reuse optimization algorithms?




                                 40
   Open source (ASL 2.0)
   Regular releases
   Reference manual
   Examples



                            41
Demo
CloudBalance example




                       42
Domain model
Server




         44
Server

public class Server {


    private int cpuPower;
    private int memory;
    private int networkBandwidth;


    private int cost;


    // getters
}




                                    45
Process




          46
Process




          47
Process is a planning entity

@PlanningEntity
public class Process {


    private int requiredCpuPower;
    private int requiredMemory;
    private int requiredNetworkBandwidth;
    private Server server;


    @PlanningVariable @ValueRange(... = "serverList")
    public Server getServer() {...}


    // getters, setters, clone, equals, hashcode
}

                                                        48
CloudBalance




               49
Solution class CloudBalance

public class CloudBalance
      implements Solution<HardAndSoftScore> {


    private List<Server> serverList;
    private List<Process> processList;
    private HardAndSoftScore score;


    @PlanningEntityCollectionProperty
    public List<Process> getProcessList() {...}


    // getters, setters, clone, getProblemFacts()


}

                                                    50
Score constraints
Score calculation

   Simple Java
   Incremental Java
   Drools




                                 52
Simple Java score calculation

   Easy to implement
   Bridge to an existing scoring system
   Slow
public class ...
        implements SimpleScoreCalculator<CloudBalance> {


    public Score calculateScore(CloudBalance cb) {
        ...
    }


}


                                                           53
Incremental Java
                score calculation
   Fast
    ●   Solution changes => only score delta is recalculated
   Hard to implement
    ●   Much boilerplate code




                                                               54
Drools score calculation

   Also incremental => fast
    ●   but no boilerplate code
   Integration opportunities
    ●   Guvnor repository
    ●   DSL: natural language constraints
    ●   Decision tables




                                            55
DRL soft constraint:
              server cost
rule "serverCost"
  when
      // there is a server
      $s : Server($c : cost)
      // there is a processes on that server
      exists Process(server == $s)
  then
      // lower soft score by $c
end




                                               56
DRL hard constraint:
                CPU power
rule "requiredCpuPowerTotal"
  when
      // there is a server
      $s : Server($cpu : cpuPower)
      // with too little CPU for its processes
      $total : Number(intValue > $cpu) from accumulate(
          Process(server == $s,
              $requiredCpu : requiredCpuPower),
          sum($requiredCpu)
      )
  then
      // lower hard score by ($total - $cpu)
end

                                                          57
Solving it
Solver configuration by XML

<solver>
  <solutionClass>...CloudBalance</solutionClass>
  <planningEntityClass>...Process</>


  <scoreDirectorFactory>
    <scoreDefinitionType>HARD_AND_SOFT</>
    <scoreDrl>...ScoreRules.drl</scoreDrl>
  </scoreDirectorFactory>


  <!-- optimization algorithms -->
</solver>




                                                   59
Solving

XmlSolverFactory factory = new XmlSolverFactory(
    "...SolverConfig.xml");
Solver solver = factory.buildSolver();


solver.setPlanningProblem(cloudBalance);
solver.solve();
cloudBalance = (CloudBalance) solver.getBestSolution();




                                                          60
Optimization algorithms
Brute Force




              62
Brute Force config

<solver>
  ...


  <bruteForce />
</solver>




                                 63
Brute force scalability

                         12 processes = 17 minutes




                                       * 680




           9 processes = 1.5 seconds


  6 processes = 15 ms     * 100

                                                     64
Plan 1200 processes
with brute force?




                      65
First Fit




            66
First Fit config

<solver>
  ...


  <constructionHeuristic>
    <constructionHeuristicType>FIRST_FIT</>
  </constructionHeuristic>
</solver>




                                              67
First Fit Decreasing




                       68
First Fit Decreasing config

<solver>
    ...


    <constructionHeuristic>
      <constructionHeuristicType>FIRST_FIT_DECREASING</>
    </constructionHeuristic>
</solver>



@PlanningEntity(difficultyComparatorClass
      = ProcessDifficultyComparator.class)
public class Process   {
    ...
}
                                                           69
First Fit scalability




                        70
Local Search comes after
Construction Heuristics




                           71
Local Search comes after
            Construction Heuristics
<solver>
  ...


  <constructionHeuristic>
    <constructionHeuristicType>FIRST_FIT_DECREASING</>
  </constructionHeuristic>
  <localSearch>
    ...
  <localSearch>
</solver>




                                                         72
Local Search




               73
Local Search Algorithms

   (Hill climbing)
   Tabu Search
   Simulated Annealing
   Late Acceptance




    Details explained Friday 4:15 PM


                                       74
Local Search results




                       75
Cost ($) reduction

              Compared to First Fit
               ●   First Fit Decreasing
                    ●   49 480 $ = 4 %
               ●   Tabu Search
                    ●   160 860 $ = 14 %
               ●   Simulated annealing
                    ●   128 950 $ = 11 %
              Few constraints
               ●   => low ROI



                                           76
Benchmarker toolkit




                      77
Organizations rarely optimize
    planning problems.




                                78
http://www.flickr.com/photos/techbirmingham/345897594/




Organizations waste resources.

                                                                 79
Summary
Summary

   Drools Planner optimizes business resources
   Adding constraints is easy and scalable
   Switching/combining algorithms is easy




                                                  81
Try an example!




                  82
Q&A

   Drools Planner homepage:
    ●  http://www.jboss.org/drools/drools-planner
   Reference manual:
     ● http://www.jboss.org/drools/documentation

   Download this presentation:
    ● http://www.jboss.org/drools/presentations




   Twitter: @geoffreydesmet
   Google+: Geoffrey De Smet

                                                    83

Weitere ähnliche Inhalte

Andere mochten auch

What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev Conference
What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev ConferenceWhat is Drools, Guvnor and Planner? 2012 02-17 Brno Dev Conference
What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev Conference
Geoffrey De Smet
 
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011
Geoffrey De Smet
 

Andere mochten auch (6)

Drools Planner webinar (2011-06-15): Drools Planner optimizes automated planning
Drools Planner webinar (2011-06-15): Drools Planner optimizes automated planningDrools Planner webinar (2011-06-15): Drools Planner optimizes automated planning
Drools Planner webinar (2011-06-15): Drools Planner optimizes automated planning
 
What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev Conference
What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev ConferenceWhat is Drools, Guvnor and Planner? 2012 02-17 Brno Dev Conference
What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev Conference
 
2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)
2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)
2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)
 
JBoss World 2011 - Drools
JBoss World 2011 - DroolsJBoss World 2011 - Drools
JBoss World 2011 - Drools
 
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011
 
JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE
JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTEJBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE
JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE
 

Ähnlich wie Drools planner - 2012-10-23 IntelliFest 2012

cloud scheduling
cloud schedulingcloud scheduling
cloud scheduling
Mudit Verma
 
Benchmarks, performance, scalability, and capacity what's behind the numbers
Benchmarks, performance, scalability, and capacity what's behind the numbersBenchmarks, performance, scalability, and capacity what's behind the numbers
Benchmarks, performance, scalability, and capacity what's behind the numbers
Justin Dorfman
 
2012 02-04fosdem2012-droolsplanner-120207031949-phpapp01
2012 02-04fosdem2012-droolsplanner-120207031949-phpapp012012 02-04fosdem2012-droolsplanner-120207031949-phpapp01
2012 02-04fosdem2012-droolsplanner-120207031949-phpapp01
Xinhua Zhu
 
UKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningUKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL Tuning
FromDual GmbH
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet system
rkhatibi
 
blueMarine Sailing with NetBeans Platform
blueMarine Sailing with NetBeans PlatformblueMarine Sailing with NetBeans Platform
blueMarine Sailing with NetBeans Platform
Fabrizio Giudici
 

Ähnlich wie Drools planner - 2012-10-23 IntelliFest 2012 (20)

Matchmaking in glideinWMS in CMS
Matchmaking in glideinWMS in CMSMatchmaking in glideinWMS in CMS
Matchmaking in glideinWMS in CMS
 
cloud scheduling
cloud schedulingcloud scheduling
cloud scheduling
 
Monitoring and troubleshooting a glideinWMS-based HTCondor pool
Monitoring and troubleshooting a glideinWMS-based HTCondor poolMonitoring and troubleshooting a glideinWMS-based HTCondor pool
Monitoring and troubleshooting a glideinWMS-based HTCondor pool
 
Cloud accounting software uk
Cloud accounting software ukCloud accounting software uk
Cloud accounting software uk
 
Android app to the challenge
Android   app to the challengeAndroid   app to the challenge
Android app to the challenge
 
Benchmarks, performance, scalability, and capacity what's behind the numbers
Benchmarks, performance, scalability, and capacity what's behind the numbersBenchmarks, performance, scalability, and capacity what's behind the numbers
Benchmarks, performance, scalability, and capacity what's behind the numbers
 
Benchmarks, performance, scalability, and capacity what s behind the numbers...
Benchmarks, performance, scalability, and capacity  what s behind the numbers...Benchmarks, performance, scalability, and capacity  what s behind the numbers...
Benchmarks, performance, scalability, and capacity what s behind the numbers...
 
Sensible scaling
Sensible scalingSensible scaling
Sensible scaling
 
2012 02-04fosdem2012-droolsplanner-120207031949-phpapp01
2012 02-04fosdem2012-droolsplanner-120207031949-phpapp012012 02-04fosdem2012-droolsplanner-120207031949-phpapp01
2012 02-04fosdem2012-droolsplanner-120207031949-phpapp01
 
Kubernetes Workload Rebalancing
Kubernetes Workload RebalancingKubernetes Workload Rebalancing
Kubernetes Workload Rebalancing
 
Extreme Programming
Extreme ProgrammingExtreme Programming
Extreme Programming
 
The benefits of running Spark on your own Docker
The benefits of running Spark on your own DockerThe benefits of running Spark on your own Docker
The benefits of running Spark on your own Docker
 
UKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningUKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL Tuning
 
The Return of the Dull Stack Engineer
The Return of the Dull Stack EngineerThe Return of the Dull Stack Engineer
The Return of the Dull Stack Engineer
 
Introduction to glideinWMS
Introduction to glideinWMSIntroduction to glideinWMS
Introduction to glideinWMS
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet system
 
Creating a Mature Puppet System
Creating a Mature Puppet SystemCreating a Mature Puppet System
Creating a Mature Puppet System
 
Automating MySQL operations with Puppet
Automating MySQL operations with PuppetAutomating MySQL operations with Puppet
Automating MySQL operations with Puppet
 
blueMarine Sailing with NetBeans Platform
blueMarine Sailing with NetBeans PlatformblueMarine Sailing with NetBeans Platform
blueMarine Sailing with NetBeans Platform
 
An argument for moving the requirements out of user hands - The CMS Experience
An argument for moving the requirements out of user hands - The CMS ExperienceAn argument for moving the requirements out of user hands - The CMS Experience
An argument for moving the requirements out of user hands - The CMS Experience
 

Mehr von Geoffrey De Smet

Drools New York City workshop 2011
Drools New York City workshop 2011Drools New York City workshop 2011
Drools New York City workshop 2011
Geoffrey De Smet
 
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)
Geoffrey De Smet
 
Open source and business rules
Open source and business rulesOpen source and business rules
Open source and business rules
Geoffrey De Smet
 
st - demystifying complext event processing
st - demystifying complext event processingst - demystifying complext event processing
st - demystifying complext event processing
Geoffrey De Smet
 
Towards unified knowledge management platform (rulefest 2010)
Towards unified knowledge management platform (rulefest 2010)Towards unified knowledge management platform (rulefest 2010)
Towards unified knowledge management platform (rulefest 2010)
Geoffrey De Smet
 

Mehr von Geoffrey De Smet (11)

JUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by exampleJUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by example
 
Drools New York City workshop 2011
Drools New York City workshop 2011Drools New York City workshop 2011
Drools New York City workshop 2011
 
2011-03-29 London - Decision tables in depth (Michael Anstis)
2011-03-29 London - Decision tables in depth (Michael Anstis)2011-03-29 London - Decision tables in depth (Michael Anstis)
2011-03-29 London - Decision tables in depth (Michael Anstis)
 
2011-03-29 London - Why do I need the guvnor BRMS?
2011-03-29 London - Why do I need the guvnor BRMS?2011-03-29 London - Why do I need the guvnor BRMS?
2011-03-29 London - Why do I need the guvnor BRMS?
 
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)
 
Open source and business rules
Open source and business rulesOpen source and business rules
Open source and business rules
 
st - demystifying complext event processing
st - demystifying complext event processingst - demystifying complext event processing
st - demystifying complext event processing
 
jBPM 5 (JUDCon 2010-10-08)
jBPM 5 (JUDCon 2010-10-08)jBPM 5 (JUDCon 2010-10-08)
jBPM 5 (JUDCon 2010-10-08)
 
Applying complex event processing (2010-10-11)
Applying complex event processing (2010-10-11)Applying complex event processing (2010-10-11)
Applying complex event processing (2010-10-11)
 
Towards unified knowledge management platform (rulefest 2010)
Towards unified knowledge management platform (rulefest 2010)Towards unified knowledge management platform (rulefest 2010)
Towards unified knowledge management platform (rulefest 2010)
 
Drools BeJUG 2010
Drools BeJUG 2010Drools BeJUG 2010
Drools BeJUG 2010
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Drools planner - 2012-10-23 IntelliFest 2012