OptaPlanner logo
  • Download
  • Learn
    • Documentation
    • Videos

    • Use cases
    • Compatibility
    • Testimonials and case studies
  • Get help
  • Blog
  • Source
  • Team
  • Services
  • Star
  • T
  • L
  • F
  • YT
Fork me on GitHub

Let’s OptaPlan your jBPM tasks (part 2) - BPM Task assigning in the cloud

Mon 26 July 2021
Avatar Walter Medvedeo
Walter Medvedeo

GitHub

Senior Software Engineer

In the following paragraphs we will show that by combining the Kogito business processes with OptaPlanner optimization, it is possible to automatically assign tasks to users. Furthermore, we can optimize those assignments, for example, to ensure that every user has the right skills for executing a task, a fair workload between users is produced, tasks are assigned according priorities, and other criteria. Finally, all this will take place in the cloud.

But, wait! Isn’t this task assigning problem already solved in Let’s OptaPlan your jBPM tasks (part 1)?

Yes…, but this time we challenged OptaPlanner to solve it by coordinating independent business processes that execute as cloud-native services, and this last definitely means Kogito!

Not yet familiar with Kogito?

To summarize, Kogito is the cloud-native business automation ecosystem for building modern applications.

Essentially, when you use Kogito you are building a cloud-native application as a set of independent domain-specific services. These services can be constructed by using business processes, business rules, decisions and constraints solving, as well as other Kogito supporting services.

As a user, you simply focus on creating your business processes, rules, etc. and Kogito will take care of the most difficult part of the job: to make these assets work as cloud-native services.

Finally, by using any of the OptaPlanner Quarkus or SpringBoot extensions, your optimization problems can be easily solved in your cloud-application.

The new context

To make comparison with the previous results easy, we’ll use the same "Credit Dispute" process presented in: Let’s OptaPlan your jBPM tasks (part 1).

But let’s take a look at how things look like when we move to Kogito:

Business Processes with Kogito

  1. When your Kogito project is built, several processings are realized and finally a cloud-native Kogito application is automatically generated for you.

  2. For assets like the business processes, different services are generated, and proper REST endpoints are automatically provided for executing and interacting with the process instances and human tasks of that process.

  3. Granularity is determined by the user, i.e., you decide how many business processes to include in your project, and thus it’s very easy to move to a microservices approach too. For example, you could decide to group the processes related with the Hiring Procedure of your company in one project, and the processes related with the Support Procedure in another. By doing this, two different cloud-native applications with the corresponding business processes services will be generated. In this way, two different logical units will be present along the CI/CD pipeline, for example, the Hiring Procedure related processes will execute at the same OpenShift/Kubernetes Pod, etc.

  4. Additionally, by combining different Kogito building blocks, called add-ons, you can make your services to be automatically plugged with persistence, additional administration endpoints, kafka based cloud events generation, and many more.

In the following image we can see a simplified diagram of the generated Kogito Application for the task-assigning-demo project, which contains the CreditDispute.bpmn process and includes the kogito-addons-quarkus-events-smallrye to connect with Kafka.

KogitoProject2Built

OptaPlanner with Kogito

On the other hand, when the OptaPlanner Quarkus or SpringBoot extension is included in your application, the following actions take place:

  1. When your project is built, OptaPlanner definitions like the Solver configuration file, the PlanningSolution, the PlanningEntities, etc., are processed and proper ready for cloud runtime components are automatically generated.

  2. Your application can simply use these components when needed, typically by using CDI and OptaPlanner standard APIs. All the rest is managed by OptaPlanner runtime.

In the following image we show a simplified diagram of the task-assigning-service project, which contains the taskAssigningDefaultSolverConfig.xml (Solver configuration), the TaskAssigningSolution (PlanningSolution), the TaskAssignment and User (PlanningEntities) and includes the optaplanner-quarkus extension.

See how these elements can be used in your code:

TaskAssigningServiceApplication

The Task Assigning Service

Finally, we can see all the building blocks working together:


TaskAssigningServiceArchitecture

When the CreditDispute process is executed the following actions takes place:

  1. A process instance is created by using the corresponding endpoints.

  2. When the human tasks are created/completed/etc. Cloud Events are produced and delivered to Kafka thanks to the inclusion of the kogito-addons-quarkus-events-smallrye.

  3. Different Kogito supporting services like the Data Index Service or the Task Assigning Service receives these events.

  4. At the Task Assigning Service, OptaPlanner takes immediate control on these events, and the new task assignments plan is calculated and optimized.

  5. Finally, by using the generated process endpoints the necessary assignments are produced.

This cycle is repeated over and over.

For more information see: Task Assigning Service

Process execution

Let’s now execute the Credit Dispute process in the Kogito ecosystem.

CreditDisputeProcessDiagramWithTaskInputs


The following image shows how a new process instance is created by using the Kogito generated endpoints:

Start CreditDispute 1111 MASTER Spanish

Analogous the previous use case (see: Let’s OptaPlan your jBPM tasks (part 1)), this information combined with the user’s configuration is used to establish which of the available users are best suited for each task.

This time, the following user’s configuration is used:

User Belongs the group Has skills in

katy

CreditAnalyst

CITI and MASTER cards.

emily

CreditAnalyst

VISA and AMERICAN_EXPRESS cards.

bob

ClientRelations

Spanish and English languages.

frank

ClientRelations

Chinese language.

So, when the process is started a new instance of the ResolveDispute task is created and automatically assigned:

ResovleDispute 1111 MASTER Spanish katy

The task requires "a CreditAnalyst user with skills in the MASTER credit card". This is why it was automatically assigned to katy.

As soon this task is completed, a new instance of the NotifyCustomer task is created.

The following image shows the new instance information:

NotifyCustomer 1111 MASTER Spanish bob

The task requires "a ClientRelations user with skills in the Spanish language", and this is why this new task is assigned to bob.

Again, the example above is quite linear, a few users are defined, and the possible assignments are direct. This was done intentionally to show how the assignment decisions are made accordingly with the configured users, the tasks configurations and also the related business data. The real power of this solution can be seen when we move to real environments, where many tasks are in progress and many users are available for selection. In those cases, OptaPlanner can really make his job and produce the optimized assignments.

Conclusions

We started by formulating an already solved problem, but using a completely different underlying ecosystem. This time, our business processes are cloud-native services. All this is facilitated by Kogito .

To integrate OptaPlanner in your cloud application is straightforward: you instruct OptaPlanner with the model, and the Solver configuration to use, and that’s all ;), OptaPlanner Quarkus or SpringBoot extensions will manage all the complexity of the Solver instantiation and management. This has represented a very important simplification for building the Task Assigning Service.

Lastly, former conclusions still apply, that is: by integrating OptaPlanner the responsibility of the task assignments and decision-making is transferred from humans to optimization algorithms.


Permalink
 tagged as feature task assignment cloud

Comments

Visit our forum to comment
AtomNews feed
Don’t want to miss a single blog post?
Follow us on
  • T
  • L
  • F
Blog archive
Latest release
  • 9.44.0.Final released
    Wed 6 September 2023
Upcoming events
    Add event / Archive
Latest blog posts
  • Scaling Up Vehicle Routing Problem with planning list variable and Nearby Selector
    Thu 27 April 2023
    Anna Dupliak
  • OptaPlanner 9 has been released
    Mon 24 April 2023
    Radovan Synek
  • OptaPlanner 9 is coming
    Tue 21 February 2023
    Lukáš Petrovický
  • Farewell - a new lead
    Tue 15 November 2022
    Geoffrey De Smet
  • Run OptaPlanner workloads on OpenShift, part II
    Wed 9 November 2022
    Radovan Synek
  • Bavet - A faster score engine for OptaPlanner
    Tue 6 September 2022
    Geoffrey De Smet
  • Run OptaPlanner workloads on OpenShift, part I.
    Thu 9 June 2022
    Radovan Synek
  • Blog archive
Latest videos
  • The Vehicle Routing Problem
    Fri 23 September 2022
    Geoffrey De Smet
  • Introduction to OptaPlanner AI constraint solver
    Thu 25 August 2022
    Anna Dupliak
  • On schedule: Artificial Intelligence plans that meet expectations
    Sat 23 July 2022
    Geoffrey De Smet
  • Host your OptaPlanner app on OpenShift (Kubernetes)
    Mon 7 February 2022
    Geoffrey De Smet
  • OptaPlanner - A fast, easy-to-use, open source AI constraint solver for software developers
    Mon 31 January 2022
  • Order picking planning with OptaPlanner
    Fri 31 December 2021
    Anna Dupliak
  • AI lesson scheduling on Quarkus with OptaPlanner
    Thu 18 November 2021
    Geoffrey De Smet
  • Video archive

OptaPlanner is open. All dependencies of this project are available under the Apache Software License 2.0 or a compatible license. OptaPlanner is trademarked.

This website was built with JBake and is open source.

Community

  • Blog
  • Get Help
  • Team
  • Governance
  • Academic research

Code

  • Build from source
  • Issue tracker
  • Release notes
  • Upgrade recipes
  • Logo and branding
CC by 3.0 | Privacy Policy
Sponsored by Red Hat