Your SlideShare is downloading. ×
0
Jboss Drools & Drools Planner 21 janvier 2010
 
<ul><li>Editeur de logiciels exclusivement dédiés aux enseignes du Retail
Création en 1986
35 M€ de CA en 2008 (+20 %/an en moyenne depuis 5 ans)
34 % à l’International
5 sites en France dont le siège à Roubaix. (Paris, Belfort, Antibes, Vannes) </li></ul><ul><li>5 filiales hors hexagone : ...
Effectifs  : 430 collaborateurs dans le monde, 360 en France,  300 r essources basées à Roubaix
Storeland pilote l’ensemble de votre supply chain étendue
Cylande a accompagné l’équipe de France de Judo à Pékin Le judo véhicule des valeurs CYLANDE partenaire de la FFJ
Lauréat du  Prix PME France CHINE ACFCI / CCIFC   Une croissance résolument tournée vers l’international
Mark's slides here
Q&A
Automated planning with Drools Planner Geoffrey De Smet Drools Planner lead &quot;Do more with less.&quot;
Agenda <ul><li>Use cases of automated planning </li><ul><li>N queens
Bin packaging
Employee shift rostering
Examination timetabling </li></ul><li>Find the best solution </li><ul><li>With Drools Planner </li></ul><li>Calculate the ...
Agenda <ul><li>Use cases of automated planning </li><ul><li>N queens
Bin packaging
Employee shift rostering
Examination timetabling </li></ul><li>Find the best solution </li><ul><li>With Drools Planner </li></ul><li>Calculate the ...
N Queens: use case <ul><li>Place n queens on a n-sized chess board
No 2 queens can attack each other </li></ul>
N queens: partially solved <ul><li>Score -1 for every 2 queens that can attack each other </li></ul>Score = -2
N queens: an optimal solution Score = 0
N queens: demo <ul><li>Not optimized! </li><ul><li>Hello world example </li></ul><li>Not a real planning problem </li><ul>...
 
NP complete <ul><li>Yellow item goes in first (or last) </li><ul><li>Why?
Not the largest size
Not the largest side
So why? </li></ul><li>NP complete </li><ul><li>A given solution can be verified fast
No efficient way to find a solution </li><ul><li>Is there even a solution? </li></ul></ul></ul>
Real world bin packaging <ul><li>Not just 5 items </li><ul><li>1000+ items </li></ul><li>Not just 1 container </li><ul><li...
Different container types </li></ul><li>More constraints... </li><ul><li>Distribute weight evenly
Not all fireworks in the same container
... </li></ul></ul>
 
Hard constraints <ul><li>Hard constraints must be fulfilled
For example: </li><ul><li>Ensure continuous service </li><ul><li>At least 1 emergency nurse at any given time </li></ul><l...
Every 7 days: at least 35 hours rest </li></ul><li>No shifts during approved vacation </li></ul></ul>
Soft constraints <ul><li>Soft constraints should be fulfilled as much as possible </li><ul><li>Only after the hard constra...
For example: </li><ul><li>Fair night work assignment: weight 5
Forward rotation: weight 10
Nurse preferences: weight 1 </li><ul><li>Ann dislikes Saturday night shifts
Beth dislikes Wednesday afternoon shifts  </li></ul></ul></ul>
Hard and soft score <ul><li>Solution A B C
Hard constraints </li><ul><li>11 hours rest 1 0 0 </li></ul><li>Soft constraints </li><ul><li>Fair night work assignment 0...
C  is the best solution </li></ul></ul>
 
Hard constraints <ul><li>Exam conflict: 2 exams that share students should not occur in the same period.
Room capacity: A room's seating capacity should suffice at all times.
Period duration: A period's duration should suffice for all of its exams.
Period related hard constraints should be fulfilled: </li><ul><li>Coincidence: 2 exams should use the same period (but pos...
Exclusion: 2 exams should not use the same period.
After: 1 exam should occur in a period after another exam's period. </li></ul><li>Room related hard constraints should be ...
Soft constraints <ul><li>2 exams in a row.
2 exams in a day.
Period spread: 2 exams that share students should be a number of periods apart.
Mixed durations: 2 exams that share a room should not have different durations.
Front load: Large exams should be scheduled earlier in the schedule.
Period penalty: Some periods have a penalty when used.
Room penalty: Some rooms have a penalty when used. </li></ul>
Examination demo <ul><li>International timetabling competition 2007 </li><ul><li>Finished 4 th  (back then) </li></ul><li>...
14 constraints </li><ul><li>7 hard constraints
7 soft constraints </li></ul></ul>
Other use cases <ul><li>Vehicle routing </li><ul><li>Freight routing </li></ul><li>Scheduling </li><ul><li>Course, meeting...
Appointment and resource scheduling
Sport scheduling </li></ul><li>Storage organizing
Upcoming SlideShare
Loading in...5
×

Drools Planner Chtijug 2010

704

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
704
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Transcript of "Drools Planner Chtijug 2010"

    1. 1. Jboss Drools & Drools Planner 21 janvier 2010
    2. 3. <ul><li>Editeur de logiciels exclusivement dédiés aux enseignes du Retail
    3. 4. Création en 1986
    4. 5. 35 M€ de CA en 2008 (+20 %/an en moyenne depuis 5 ans)
    5. 6. 34 % à l’International
    6. 7. 5 sites en France dont le siège à Roubaix. (Paris, Belfort, Antibes, Vannes) </li></ul><ul><li>5 filiales hors hexagone : Shanghai, Portugal, Espagne, Tunisie, Pologne en cours </li></ul><ul><li>Une expérience éprouvée dans 60 pays </li></ul>
    7. 8. Effectifs : 430 collaborateurs dans le monde, 360 en France, 300 r essources basées à Roubaix
    8. 9. Storeland pilote l’ensemble de votre supply chain étendue
    9. 10. Cylande a accompagné l’équipe de France de Judo à Pékin Le judo véhicule des valeurs CYLANDE partenaire de la FFJ
    10. 11. Lauréat du Prix PME France CHINE ACFCI / CCIFC Une croissance résolument tournée vers l’international
    11. 12. Mark's slides here
    12. 13. Q&A
    13. 14. Automated planning with Drools Planner Geoffrey De Smet Drools Planner lead &quot;Do more with less.&quot;
    14. 15. Agenda <ul><li>Use cases of automated planning </li><ul><li>N queens
    15. 16. Bin packaging
    16. 17. Employee shift rostering
    17. 18. Examination timetabling </li></ul><li>Find the best solution </li><ul><li>With Drools Planner </li></ul><li>Calculate the score of a solution </li><ul><li>With Drools </li></ul></ul>
    18. 19. Agenda <ul><li>Use cases of automated planning </li><ul><li>N queens
    19. 20. Bin packaging
    20. 21. Employee shift rostering
    21. 22. Examination timetabling </li></ul><li>Find the best solution </li><ul><li>With Drools Planner </li></ul><li>Calculate the score of a solution </li><ul><li>With Drools </li></ul></ul>
    22. 23. N Queens: use case <ul><li>Place n queens on a n-sized chess board
    23. 24. No 2 queens can attack each other </li></ul>
    24. 25. N queens: partially solved <ul><li>Score -1 for every 2 queens that can attack each other </li></ul>Score = -2
    25. 26. N queens: an optimal solution Score = 0
    26. 27. N queens: demo <ul><li>Not optimized! </li><ul><li>Hello world example </li></ul><li>Not a real planning problem </li><ul><li>I can make an optimal solution for any n queens without a computer </li><ul><li>See Wikipedia </li></ul></ul></ul>
    27. 29. NP complete <ul><li>Yellow item goes in first (or last) </li><ul><li>Why?
    28. 30. Not the largest size
    29. 31. Not the largest side
    30. 32. So why? </li></ul><li>NP complete </li><ul><li>A given solution can be verified fast
    31. 33. No efficient way to find a solution </li><ul><li>Is there even a solution? </li></ul></ul></ul>
    32. 34. Real world bin packaging <ul><li>Not just 5 items </li><ul><li>1000+ items </li></ul><li>Not just 1 container </li><ul><li>100+ containers
    33. 35. Different container types </li></ul><li>More constraints... </li><ul><li>Distribute weight evenly
    34. 36. Not all fireworks in the same container
    35. 37. ... </li></ul></ul>
    36. 39. Hard constraints <ul><li>Hard constraints must be fulfilled
    37. 40. For example: </li><ul><li>Ensure continuous service </li><ul><li>At least 1 emergency nurse at any given time </li></ul><li>Labor laws </li><ul><li>Every 24 hours: at least 11 hours rest
    38. 41. Every 7 days: at least 35 hours rest </li></ul><li>No shifts during approved vacation </li></ul></ul>
    39. 42. Soft constraints <ul><li>Soft constraints should be fulfilled as much as possible </li><ul><li>Only after the hard constraints are fulfilled </li></ul><li>Each soft constraint is weighted
    40. 43. For example: </li><ul><li>Fair night work assignment: weight 5
    41. 44. Forward rotation: weight 10
    42. 45. Nurse preferences: weight 1 </li><ul><li>Ann dislikes Saturday night shifts
    43. 46. Beth dislikes Wednesday afternoon shifts </li></ul></ul></ul>
    44. 47. Hard and soft score <ul><li>Solution A B C
    45. 48. Hard constraints </li><ul><li>11 hours rest 1 0 0 </li></ul><li>Soft constraints </li><ul><li>Fair night work assignment 0 1000 1 </li><ul><li>Weight 5 </li></ul><li>Nurse preferences 0 0 4000 </li><ul><li>Weight 1 </li></ul></ul><li>Total score -1H/0S 0H/-5000S 0H/-4005S </li><ul><li>A < B < C
    46. 49. C is the best solution </li></ul></ul>
    47. 51. Hard constraints <ul><li>Exam conflict: 2 exams that share students should not occur in the same period.
    48. 52. Room capacity: A room's seating capacity should suffice at all times.
    49. 53. Period duration: A period's duration should suffice for all of its exams.
    50. 54. Period related hard constraints should be fulfilled: </li><ul><li>Coincidence: 2 exams should use the same period (but possibly another room).
    51. 55. Exclusion: 2 exams should not use the same period.
    52. 56. After: 1 exam should occur in a period after another exam's period. </li></ul><li>Room related hard constraints should be fulfilled: </li><ul><li>Exclusive: 1 exam should not have to share its room with any other exam. </li></ul></ul>
    53. 57. Soft constraints <ul><li>2 exams in a row.
    54. 58. 2 exams in a day.
    55. 59. Period spread: 2 exams that share students should be a number of periods apart.
    56. 60. Mixed durations: 2 exams that share a room should not have different durations.
    57. 61. Front load: Large exams should be scheduled earlier in the schedule.
    58. 62. Period penalty: Some periods have a penalty when used.
    59. 63. Room penalty: Some rooms have a penalty when used. </li></ul>
    60. 64. Examination demo <ul><li>International timetabling competition 2007 </li><ul><li>Finished 4 th (back then) </li></ul><li>7 minutes </li><ul><li>CPU depended </li></ul><li>Real word test data
    61. 65. 14 constraints </li><ul><li>7 hard constraints
    62. 66. 7 soft constraints </li></ul></ul>
    63. 67. Other use cases <ul><li>Vehicle routing </li><ul><li>Freight routing </li></ul><li>Scheduling </li><ul><li>Course, meeting, conference scheduling
    64. 68. Appointment and resource scheduling
    65. 69. Sport scheduling </li></ul><li>Storage organizing
    66. 70. Machine queue planning
    67. 71. ... </li></ul>
    68. 72. Why use Drools Planner? <ul><li>Open source </li><ul><li>ASL (business-friendly) </li></ul><li>Maven-ready (JBoss repository)
    69. 73. Documentation </li><ul><li>Reference manual
    70. 74. Examples </li></ul><li>JBoss Drools community support </li><ul><li>User mailing list, issue tracking, …
    71. 75. Blog & twitter (#droolsplanner) </li></ul></ul>
    72. 76. Agenda <ul><li>Use cases of automated planning </li><ul><li>N queens
    73. 77. Bin packaging
    74. 78. Employee shift rostering
    75. 79. Examination timetabling </li></ul><li>Find the best solution </li><ul><li>With Drools Planner </li></ul><li>Calculate the score of a solution </li><ul><li>With Drools </li></ul></ul>
    76. 80. Brute force for (periodOfExam1 : periodList) { exam1 .setPeriod(periodOfExam1); for (roomOfExam1 : roomList) { exam1 .setRoom(roomOfExam1); for (periodOfExam2 : periodList) { exam2 .setPeriod(periodOfExam2); for (roomOfExam2 : roomList) { exam2 .setRoom(roomOfExam2); ... for (periodOfExamN : periodList) { examN .setPeriod(periodOfExamN); for (roomOfExamN : roomList) { examN .setRoom(roomOfExamN); Score score = calculateScore(solution); cloneIfScoreIsBetter(solution, score); } } } }…} }
    77. 81. Needle in a haystack <ul><li>How many possible solutions? </li><ul><li>1096 exams
    78. 82. 80 periods
    79. 83. 28 rooms </li></ul><li>> habitants in Lille per km²? </li><ul><li>6 483 hab./km² </li></ul></ul>Source: wikipedia
    80. 84. Needle in a haystack <ul><li>How many possible solutions? </li><ul><li>1096 exams
    81. 85. 80 periods
    82. 86. 28 rooms </li></ul><li>> humans? </li><ul><li>7.000.000.000 humans </li></ul></ul>Source: NASA (wikipedia)
    83. 87. Needle in a haystack <ul><li>How many possible solutions? </li><ul><li>1096 exams
    84. 88. 80 periods
    85. 89. 28 rooms </li></ul><li>> minimum atoms in the observable universe? </li><ul><li>10^80 atoms </li></ul></ul>Source: NASA and ESA (wikipedia)
    86. 90. Needle in a haystack <ul><li>How many possible solutions? </li><ul><li>1096 exams
    87. 91. 80 periods
    88. 92. 28 rooms </li></ul><li>> atoms in the universe if every atom is a universe of atoms? </li><ul><li>(10^80)^80 = 10^6400 </li></ul></ul>Source: NASA and ESA (wikipedia)
    89. 93. Do the math <ul><li>1 exam </li><ul><li>80 periods and 28 rooms
    90. 94. 80 * 28 = 2240 ways to schedule 1 exam </li></ul><li>2 exams </li><ul><li>2240 * 2240 = 5.017.600 </li></ul><li>3 exams </li><ul><li>2240 * 2240 * 2240 = 11.239.424.000 </li></ul><li>1096 exams </li><ul><li>2240 * 2240 * … * 2240
    91. 95. 2240^1096 = a little over 10^3671 </li></ul></ul>
    92. 96. A little over 10^3671 <ul><li>74443724674464882011383315953154621497427697455114051316288269134692843108344990310502102147434076562448130852404428098553211787226818492436455899991484967631419697684165817985739661390634926254859096857258977301840109249945418286726701389433250396830489437134122748296147216955996361597777271017137683780046154870127217758740223489170130893779085381647394360334935333289368078384002213161233225755719910067066354676237665251240673552315376749902467736827879981604429943150088424040897721698276067946148250230917492054728443158872165054373936157659332956136774730870081258025518405492389480888615900164269035398348299000380567467552410280857265893710574057117390411923324486282853392817922617168734507604739703552080299261320457186755798353796720329958815466662988845983738466048902038122152381226870228697167564520947170314014038670253281783219898668392349799158354071694433128608374231159613003286648446078922185727592075724811 </li></ul>
    93. 97. A little over 10^3671 <ul><li>6048135772412471854625105630495358121952017974176215221261550607694499282872000580072957918546796819172012885232741311107156500439895658139217642528073069419950416303276042981944782604076520149545429082567515199635531168668927010363569188258631683061394017239747010858770816458215631819437872729831119114113689168267734458648249288525981253268712682909721892541332433788104618254995718184937280503163787574781545179918774455713682720486085676323080374894817073654077307783490409626446740500738118392110173307114879831341215304834099815901166729699407017252645417836852601401021510814954906747082633216854492531462935276329826288243709434523924561625262847747165433198090950514642269855008208195099600705166755800356942782663732953126879621138033542807009649872210605061596144967082523007946872878429586274134471258439206305573503782097081716925686154420223798946020972887359043006100852387795351482973307623581925846555002793841 </li></ul>
    94. 98. A little over 10^3671 <ul><li>412819475399046707554915331636124476210270759983783881007403725028189106738399600287059413396296063538199837169373556801830583664641156130483672354172652266198330743819868438588044621805009480956563538464893798379308830824383808936545111608312964868056598674131595193654957707706822143338172833633019666638035983430262037019665125647894212392790462389810030266845803079031515302062019379538886948677023472435462645765005804746816166402399340231002187005109182016211164762492991719240503935116392473986075551679379460553477047460526845933176425584932086637889540004159744719173226633548555732700361980207696413126618655189183160162357390484834785168386038147341617149224158994590819150108545695234158875676738936645877760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 </li></ul>
    95. 99. A little over 10^3671 <ul><li>00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 </li></ul>
    96. 100. A little over 10^3671 <ul><li>0000000000000000000000000000000000000000000000000000000000000000000000000000 </li></ul><ul><li>The search space is big! </li><ul><li>Compare with WWW size </li><ul><li>22 020 000 000 pages </li></ul></ul><li>Each possible solution </li><ul><li>1096+ exams scheduled into </li><ul><li>80 periods
    97. 101. 28 rooms </li></ul><li>Still need to calculate the score </li></ul></ul>
    98. 102. Throw hardware at it? <ul><li>If 10^9 scores calculated per ms </li><ul><li>Not possible today!
    99. 103. 31.579.200.000 ms in 1 year </li><ul><li>< 10^11 ms in 1 year </li></ul><li>10^9 * 10^11 scores per year </li><ul><li>= 10^20 scores per year </li></ul></ul><li>How many years? 10^3671 / 10^20 </li><ul><li>= 10^3651 years </li></ul><li>CPU 1000 times faster </li><ul><li>It becomes 10^3648 years </li></ul></ul>
    100. 104. A dose of reality <ul><li>Find the optimal solution? </li><ul><li>Of a real world planning problem? </li></ul><li>Not in our lifetimes!
    101. 105. Who cares? </li><ul><li>Beat the human planner(s) (=easy) </li><ul><li>Spend less resources </li><ul><li>Save more money
    102. 106. Save the environment </li></ul><li>Make more people happy </li></ul><li>Never ending competition </li></ul></ul>
    103. 107. Smarter brute force? <ul><li>Eliminate subtrees </li><ul><li>Branch and bound
    104. 108. Still too many for loops
    105. 109. Still takes forever </li></ul></ul>for (periodOfExam2 : periodList) { exam2 .setPeriod(periodOfExam2); if ( exam1 .shareStudentWith( exam2 ) && periodOfExam1.equals(periodOfExam2)) { c ontinue ; // bug: best solution might break a hard constraint } ...
    106. 110. Imperfect algorithms (mimic a human) <ul><li>Deterministic </li><ul><li>First in, first assigned, never changed
    107. 111. Easy to implement </li><ul><li>Drools Planner score support </li></ul><li>Fixed time (for example 18 seconds) </li></ul><li>Metaheuristic </li><ul><li>Move things around </li><ul><li>Start from result of deterministic algorithm </li></ul><li>Drools Planner implementations
    108. 112. More time = better score </li></ul></ul>
    109. 113. Deterministic: N queens <ul><li>Demo
    110. 114. Not feasible </li><ul><li>Not optimal </li></ul><li>Good initialization </li><ul><li>Jump 10 meter into the pool </li></ul></ul>
    111. 115. Deterministic: examination List<Exam> sortedExamList = sortExamsOnDifficulty(examList); for (exam : sortedExamList) { // Determine best remaining spot Score bestScoreOfExam = - INFINITY; for (period : periodList) { exam .setPeriod(period); for (room : roomList) { exam .setRoom(room); Score score = calculateScore(solution); if (score > bestScoreOfExam) { bestScoreOfExam = score; ... store bestPeriod, bestRoom } } } … assign exam to bestPeriod, bestRoom }
    112. 116. Metaheuristic algorithms <ul><li>Local search: 1 st , 2 nd , 3 rd and 4 th in ITC 2007 </li><ul><li>Simple local search ( Hill climbing)
    113. 117. Tabu search </li><ul><li>Local search ++ </li></ul><li>Simulated annealing
    114. 118. Great deluge
    115. 119. ... </li></ul><li>Genetic algorithms: 5 th in ITC 2007
    116. 120. Ant colony optimization
    117. 121. ... </li></ul>
    118. 122. Move things around <ul><li>Move = from solution A to solution B </li><ul><li>Change the row of 1 queen
    119. 123. Give 2 queens each others rows
    120. 124. ... </li></ul></ul>
    121. 125. All moves from one solution <ul><li>Number of moves < number of solutions </li><ul><li>N queens </li><ul><li>n*n < n^n </li></ul><li>4 queens </li><ul><li>16 < 256 </li></ul><li>8 queens </li><ul><li>64 < 16777216 </li></ul><li>64 queens </li><ul><li>4096 < 10^116 </li></ul></ul></ul>
    122. 126. Metaheuristic: local search
    123. 128. Local optima <ul><li>1) Deterministic StartingSolutionInitializer
    124. 129. 2) Simple local search
    125. 130. 3) Stuck in local optimum! </li></ul>Source: Wikipedia
    126. 131. Tabu search = local search++ <ul><li>Solution tabu (high tabu size) </li><ul><li>Been there, no need to go there again </li></ul><li>Move tabu (low tabu size) </li><ul><li>Done that recently, no need to do that again </li></ul><li>Property tabu (low tabu size) </li><ul><li>Changed that recently, no need to change that again </li></ul></ul>
    127. 132. Drool planner configuration <selector> <selector> <moveFactoryClass>...PeriodChangeMoveFactory</...> <relativeSelection>0.002</relativeSelection> </selector> ... <selector> <moveFactoryClass>...ExamSwitchMoveFactory</...> <relativeSelection>0.002</relativeSelection> </selector> </selector> <accepter> <completeSolutionTabuSize>1000</completeSolutionTabuSize> <completeMoveTabuSize>7</completeMoveTabuSize> </accepter> <forager> <foragerType>MAX_SCORE_OF_ALL</foragerType> </forager>
    128. 133. Termination <ul><li>Synchronous (configured) </li><ul><li>Max timeMillis/seconds/minutes/hours spend
    129. 134. Score attained
    130. 135. Max step count
    131. 136. Max unimproved step count </li></ul><li>Asynchronous (from another thread) </li><ul><li>planner.terminateEarly(); </li></ul></ul>
    132. 137. Double time !=> double score Soft score Time (hours:minutes) Examination test data 7
    133. 138. Benchmarker utility <ul><li>Battle of different planner configurations </li><ul><li>Different algorithms (tabu search, ...)
    134. 139. Different moves
    135. 140. Different settings </li></ul><li>On multiple datasets
    136. 141. Results are ranked: </li><ul><li>Best one wins </li></ul><li>Coming soon: </li><ul><li>Graph: best score over time </li></ul></ul>
    137. 142. Agenda <ul><li>Use cases of automated planning </li><ul><li>N queens
    138. 143. Bin packaging
    139. 144. Employee shift rostering
    140. 145. Examination timetabling </li></ul><li>Find the best solution </li><ul><li>With Drools Planner </li></ul><li>Calculate the score of a solution </li><ul><li>With Drools </li></ul></ul>
    141. 146. JAVA vs SQL vs DRL for ( q1 : queenList) { for ( q2 : queenList) { if ( q1 .getId() < q2 .getId() && q1.getY() == q2.getY() ) { ... } } } select * from Queen q1 , Queen q2 where q1 .id < q2 .id and q1.y = q2.y ; rule &quot;multipleQueensHorizontal&quot; when $q1 : Queen($id : id, $y : y ); $q2 : Queen(id > $id, y == $y );
    142. 147. N queens: score rule rule &quot;multipleQueensHorizontal&quot; when $q1 : Queen($id : id, $y : y); $q2 : Queen(id > $id, y == $y); then insertLogical( new IntConstraintOccurrence( &quot;multipleQueensHorizontal&quot; , ConstraintType.NEGATIVE_HARD, 1 , $q1 , $q2 )); end
    143. 148. Score rule isolation rule &quot;multipleQueensHorizontal&quot; when $q1 : Queen($id : id, $y : y); $q2 : Queen(id > $id, y == $y ); then ... end rule &quot;multipleQueensAscendingDiagonal&quot; when $q1 : Queen($id : id, $ascendingD : ascendingD); $q2 : Queen(id > $id, ascendingD == $ascendingD ); then ... end rule &quot;multipleQueensDescendingDiagonal&quot; when $q1 : Queen($id : id, $descendingD : descendingD); $q2 : Queen(id > $id, descendingD == $descendingD ); then ... end
    144. 150. Examination: period spread <ul><li>2 exams that share students should be a number of periods apart </li></ul>rule &quot;periodSpread&quot; when $iw : InstitutionalWeighting(periodSpreadPenality != 0); // For any 2 conflicting exams in the same period ... $topicConflict : TopicConflict($leftT : leftTopic, $rightT : rightTopic); $leftExam : Exam(topic == $leftT, $leftPeriod : period); $rightExam : Exam(topic == $rightT, $rightPeriod : period); // … which are in within the periodSpread eval ( Math.abs($leftPeriod.getPeriodIndex() - $rightPeriod.getPeriodIndex()) < ($iw.getPeriodSpreadLength() + 1) ); then insertLogical(new IntConstraintOccurrence(... NEGATIVE_SOFT, $topicConflict.getStudentSize() * $iw.getPeriodSpreadPenality() , $leftExam, $rightExam)); end
    145. 151. Summary <ul><li>Drools Planner solves planning problems
    146. 152. Adding constraints is easy and scalable
    147. 153. Switching/combining algorithms is easy </li></ul>
    148. 154. Q&A <ul><li>Home page </li><ul><li>http://www.jboss.org/drools/drools-planner.html </li></ul><li>Reference manual </li><ul><li>http://www.jboss.org/drools/documentation.html </li></ul><li>Blog </li><ul><li>http://blog.athico.com/search/label/planner </li></ul><li>Twitter </li><ul><li>#droolsplanner </li></ul></ul>
    149. 155. Thanks for your attention! <ul><li>Home page </li><ul><li>http://www.jboss.org/drools/drools-planner.html </li></ul><li>Reference manual </li><ul><li>http://www.jboss.org/drools/documentation.html </li></ul><li>Blog </li><ul><li>http://blog.athico.com/search/label/planner </li></ul><li>Twitter </li><ul><li>#droolsplanner </li></ul></ul>
    150. 156. Licence <ul><li>Les photos et logos appartiennent à leurs auteurs respectifs
    151. 157. Le contenu de la présentation est sous licence Creative Commons 2.0 France </li><ul><li>Contrat Paternité
    152. 158. Pas d'Utilisation Commerciale
    153. 159. Partage des Conditions Initiales à l'Identique </li></ul><li>http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ </li></ul>
    154. 160. Cocktail <ul><li>Merci pour votre attention
    155. 161. Merci à Cylande pour son sponsoring </li></ul>
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×