Este contenido no está disponible en el idioma seleccionado.

Chapter 12. Red Hat Build of OptaPlanner on the Red Hat build of Quarkus platform: 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 Red Hat Build of 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, or Eclipse is available.

12.1. Downloading and running the OptaPlanner employee scheduler

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.33
  2. Download Red Hat Build of OptaPlanner 8.33 Quick Starts.
  3. Extract the rhbop-8.33.0-optaplanner-quickstarts-sources.zip file.
  4. Navigate to the org.optaplanner.optaplanner-quickstarts-8.33.0.Final-redhat-00004/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.

12.2. Package and run the OptaPlanner employee scheduler

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
Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2025 Red Hat