Case Management Task Assignment Using Optaplanner
Total Page:16
File Type:pdf, Size:1020Kb
Masaryk University Faculty of Informatics Case Management Task Assignment Using OptaPlanner Master’s Thesis Bc. Marián Macik Brno, Fall 2016 Replace this page with a copy of the official signed thesis assignment anda copy of the Statement of an Author. Declaration Hereby I declare that this paper is my original authorial work, which I have worked out on my own. All sources, references, and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. Bc. Marián Macik Advisor: Mgr. Marek Grác, Ph.D. i Acknowledgement Here I would like to thank my family, friends and colleagues for their support during the work on this thesis. Moreover, I thank my consul- tant, Mgr. Ivo Bek, for guiding me during my work and for helping me overcome issues experienced when writing this thesis. I would also like to thank my advisor, Mgr. Marek Grác, Ph.D., for his help regarding the text of the thesis and for his advice in initial stages of the work. Finally, I would especially like to thank Maciej Swiderski for his help with the configuration of jBPM engine and Geoffrey De Smet for his help with OptaPlanner. ii Abstract The aim of the thesis is to analyse, design and implement a module for automated task assignment by integrating jBPM engine and Op- taPlanner. The thesis describes case management, its difference from business process management and their notations. After that, jBPM engine together with OptaPlanner are explained. In the second half of the thesis, the actual implementation and prototype application are presented, including the performance tests in different OptaPlanner configurations and scenarios. iii Keywords jBPM, OptaPlanner, Case Management, Task Assigning, Planning iv Contents 1 Introduction1 2 Resource and Case Management3 2.1 What is Resource and Case Management? ..........3 2.2 Case Management vs. Business Process Management ....4 2.3 Notations ...........................6 2.3.1 CMMN........................6 2.3.2 BPMN........................ 14 2.4 Focus on Case Management Task Assignment ........ 18 3 jBPM Engine 21 3.1 Introduction .......................... 21 3.2 Implementation of Case Management in jBPM Engine ... 22 3.3 Task Assignment inside Case Management ......... 23 3.4 Task Lifecycle ......................... 24 3.5 Alternatives .......................... 24 3.5.1 IBM.......................... 24 3.5.2 Oracle........................ 25 3.5.3 Camunda...................... 26 4 OptaPlanner 27 4.1 Introduction .......................... 27 4.2 Constraints and Score Calculation .............. 28 4.2.1 Constraints..................... 28 4.2.2 Score Calculation.................. 29 4.3 Solver Lifecycle ........................ 31 4.3.1 Solver Phase..................... 31 4.3.2 Steps and Moves.................. 32 4.4 Construction Heuristic .................... 34 4.5 Local Search .......................... 35 4.5.1 Hill Climbing (Simple Local Search)....... 36 4.5.2 Tabu Search..................... 37 4.5.3 Simulated Annealing................ 38 4.5.4 Late Acceptance................... 38 4.6 Alternatives .......................... 38 4.6.1 LocalSolver..................... 39 v 4.6.2 IBM ILOG CPLEX Optimization Studio..... 40 4.6.3 Google Optimization Tools............ 41 5 Resource Management Module 42 5.1 Analysis ............................ 42 5.1.1 Users......................... 42 5.1.2 Tasks......................... 42 5.2 Configuration of jBPM Engine and its Domain ....... 43 5.2.1 Persistence and Persistence entities........ 43 5.2.2 Inserting and Retrieving Users to/from DB... 45 5.2.3 Listener for Pushing Tasks from jBPM Engine. 46 5.3 Configuration of OptaPlanner and its Domain ........ 47 5.3.1 Planning Entities, Planning Values and their Re- lationships...................... 47 5.3.2 TaskAssigningSolution............... 50 5.3.3 Score rules...................... 51 6 Prototype Application 54 6.1 Purpose and Used Technologies ................ 54 6.2 Implementation ........................ 54 6.2.1 RootLayout and SolutionController....... 54 6.2.2 CaseOverview and CaseController........ 55 6.2.3 Dialogs and Dialog Controllers.......... 55 6.3 Scenarios ........................... 55 6.3.1 Small Scenario................... 56 6.3.2 Medium Scenario.................. 56 6.3.3 Large Scenario................... 56 6.4 User Guide .......................... 57 7 Benchmarks 60 7.1 OptaPlanner Benchmark ................... 60 7.2 Construction Heuristics Benchmark ............. 61 7.3 Metaheuristics Benchmark .................. 61 8 Issues Experienced and Further Improvements 64 8.1 Issues Experienced during Implementation ......... 64 8.2 Further Improvements .................... 64 vi 9 Conclusion 66 A Zip Archive 67 Bibliography 68 vii List of Tables 5.1 TaskPlanningEntity attributes 50 6.1 Small scenario tasks 56 6.2 Medium scenario tasks 57 6.3 Large scenario tasks 57 viii List of Figures 2.1 Design-time Phase and Runtime Phase Source: CMMN Specification [3] 8 2.2 Case File Item Shape Source: CMMN Specification [3] 8 2.3 Collapsed Stage and Expanded Stage Shapes Source: CMMN Specification [3] 9 2.4 Task Shape Source: CMMN Specification [3] 10 2.5 Timer Event and User Event Listener Shape Source: CMMN Specification [3] 12 2.6 Entry and Exit Criterion Shape Source: CMMN Specification [3] 13 2.7 Connector between two Tasks Source: CMMN Specification [3] 13 2.8 An Example of CMMN Notation Source: CMMN Presentation [15] 14 2.9 Gateway Shape Source: BPMN Specification [12] 17 2.10 Sequence Flow Source: BPMN Specification [12] 18 2.11 An Example of BPMN Notation Source: Author 19 4.1 Scope Overview Source: OptaPlanner Documentation [30] 32 4.2 An Example of OptaPlanner Phase Sequence Source: OptaPlanner Documentation [30] 33 4.3 Move Source: OptaPlanner Documentation [30] 34 4.4 Steps Source: OptaPlanner Documentation [30] 35 4.5 Hill Climbing Source: OptaPlanner Documentation [30] 36 4.6 Tabu Search Source: OptaPlanner Documentation [30] 37 4.7 Simulated Annealing Source: OptaPlanner Documentation [30] 39 4.8 Late Acceptance Source: OptaPlanner Documentation [30] 40 5.1 Persistence Entities Source: Author 44 5.2 Users JSON Source: Author 45 5.3 OptaPlanner Relationships Source: Author 48 ix 5.4 Examples of Chains Source: OptaPlanner Documentation [30] 49 5.5 Role Requirements Score Rule Source: Author 51 5.6 High Priority Score Rule Source: Author 52 5.7 Minimize Makespan Score Rule Source: Author 52 6.1 Prototype Application Source: Author 59 7.1 Results of Construction Heuristic Benchmarks Source: Author 62 7.2 Results of Metaheuristics Benchmarks Source: Author 62 7.3 Score Progress During Time Source: Author 63 x 1 Introduction Our contemporary society is constantly improving and developing. Work is being more and more automated and its amount is rapidly increasing too. Bigger amount of work necessarily needs better man- agement and organization, better and faster planning and very quick and efficient handling of unexpected situations. In the past, usually only a small number of employees from high management managed and planned the work for all employees in the organization. However, with the amounts of work nowadays, it is very difficult to manage, organize and plan this work by a couple of persons. This often means that these planning decisions need to be made by everybody, which takes a lot of time and, therefore, it is inefficient. Because of that, effi- cient planning and organization which lead to the maximal utilization of employee’s potential is becoming more and more valued. And with the help of communication and information technologies, this efficient planning is becoming very powerful, cost-efficient and easier to be handled. Therefore, this thesis tries to find such a solution and tries to inte- grate system which is daily used in practice with the system which is designed to optimize not only issues mentioned but other issues as well. The aim of this thesis is to analyze, design and implement a module for automated task assignment using resource planning tool OptaPlan- ner. This implementation then should be visualized by a prototype application so a user may easily see differences between different heuristics and strategies. Once done, a performance comparison in different scenarios should be made. This thesis acts like a research with focus on possibilities of in- tegrating case management in jBPM engine [1] and OptaPlanner [2] since there is a high probability these two tools will be integrated offi- cially by the community. Therefore, this thesis may serve as a starting point, which might be enhanced, extended and then widely used. An initial analysis is done in the second chapter. Since case manage- ment is still quite new (initial specification is from 2014 [3], it compares case management and business process management, lists the main differences and provides a quick view at their particular notations. 1 1. Introduction At last, it explains the reason why case management was primarily chosen for the thesis. Third chapter presents jBPM engine, explains why it was chosen and explains some of its specifics, e.g. task lifecycle. In the end, the engine is compared with alternative software suites which address same issues. OptaPlanner is explained in the fourth chapter. It explains which mechanisms OptaPlanner uses and what problems it may be used for. As in the third chapter, alternatives are presented too. Fifth chapter consists of analysis, design and implementation of the resource management module. Module’s