Chapter 11. OptaPlanner on Red Hat build of Quarkus: an employee scheduler quick start guide


The employee scheduler quick start application assigns employees to shifts on various positions in an organization. For example, you can use the application to distribute shifts in a hospital between nurses, guard duty shifts across a number of locations, or shifts on an assembly line between workers.

Optimal employee scheduling must take a number of variables into account. For example, different skills can be required for shifts in different positions. Also, some employees might be unavailable for some time slots or might prefer a particular time slot. Moreover, an employee can have a contract that limits the number of hours that the employee can work in a single time period.

The OptaPlanner rules for this starter application use both hard and soft constraints. During an optimization, the Planner engine may not violate hard constraints, for example, if an employee is unavailable (out sick), or that an employee cannot work two spots in a single shift. The Planner engine tries to adhere to soft constraints, such as an employee’s preference to not work a specific shift, but can violate them if the optimal solution requires it.

Prerequisites

  • OpenJDK 11 or later is installed. Red Hat build of Open JDK is available from the Software Downloads page in the Red Hat Customer Portal (login required).
  • Apache Maven 3.8 or higher is installed. Maven is available from the Apache Maven Project website.
  • An IDE, such as IntelliJ IDEA, VSCode, Eclipse, or NetBeans is available.

Download the OptaPlanner employee scheduler quick start archive, start it in Quarkus development mode, and view the application in a browser. Quarkus development mode enables you to make changes and update your application while it is running.

Procedure

  1. Navigate to the Software Downloads page in the Red Hat Customer Portal (login required), and select the product and version from the drop-down options:

    • Product: Red Hat Build of OptaPlanner
    • Version: 8.29
  2. Download Red Hat Build of OptaPlanner 8.29 Quick Starts.
  3. Extract the rhbop-8.29.0-red_hat_build_of_optaplanner-quickstarts-sources.zip file.
  4. Navigate to the org.red_hat_build_of_optaplanner-red_hat_build_of_optaplanner-quickstarts-8.29.0.Final-redhat-00009/use-cases/employee-scheduling directory.
  5. Enter the following command to start the OptaPlanner employee scheduler in development mode:

    $ mvn quarkus:dev
    Copy to Clipboard Toggle word wrap
  6. To view the OptaPlanner employee scheduler, enter the following URL in a web browser.

    http://localhost:8080/
    Copy to Clipboard Toggle word wrap
  7. To run the OptaPlanner employee scheduler, click Solve.
  8. Make changes to the source code then press the F5 key to refresh your browser. Notice that the changes that you made are now available.

When you have completed development work on the OptaPlanner employee scheduler in quarkus:dev mode, run the application as a conventional jar file.

Prerequisites

  • You have downloaded the OptaPlanner employee scheduling quick start.

Procedure

  1. Navigate to the /use-cases/vaccination-scheduling directory.
  2. To compile the OptaPlanner employee scheduler, enter the following command:

    $ mvn package
    Copy to Clipboard Toggle word wrap
  3. To run the compiled OptaPlanner employee scheduler, enter the following command:

    $ java -jar ./target/quarkus-app/quarkus-run.jar
    Copy to Clipboard Toggle word wrap
    Note

    To run the application on port 8081, add -Dquarkus.http.port=8081 to the preceding command.

  4. To start the OptaPlanner employee scheduler, enter the following URL in a web browser.

    http://localhost:8080/
    Copy to Clipboard Toggle word wrap
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat