Chapter 10. Downloading Red Hat build of OptaPlanner examples
You can download the Red Hat build of OptaPlanner examples as a part of the {PRODUCTPAM} add-ons package available on the Red Hat Customer Portal.
Procedure
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: Process Automation Manager
- Version: 7.13.5
- Download Red Hat Process Automation Manager 7.13 Add Ons.
-
Extract the
rhpam-7.13.5-add-ons.zip
file. The extractedadd-ons
folder contains therhpam-7.13.5-planner-engine.zip
file. -
Extract the
rhpam-7.13.5-planner-engine.zip
file.
Result
The extracted rhpam-7.13.5-planner-engine
directory contains example source code under the following subdirectories:
-
examples/sources/src/main/java/org/optaplanner/examples
-
examples/sources/src/main/resources/org/optaplanner/examples
10.1. Running OptaPlanner examples
Red Hat build of OptaPlanner includes several examples that demonstrate a variety of planning use cases. Download and use the examples to explore different types of planning solutions.
Prerequisites
- You have downloaded and extracted the examples as described in Chapter 10, Downloading Red Hat build of OptaPlanner examples.
Procedure
To run the examples, in the
rhpam-7.13.5-planner-engine/examples
directory enter one of the following commands:Linux or Mac:
$ ./runExamples.sh
Windows:
$ runExamples.bat
The OptaPlanner Examples window opens.
- Select an example to run that example.
Red Hat build of OptaPlanner has no GUI dependencies. It runs just as well on a server or a mobile JVM as it does on the desktop.
10.2. Running the Red Hat build of OptaPlanner examples in an IDE (IntelliJ, Eclipse, or Netbeans)
If you use an integrated development environment (IDE), such as IntelliJ, Eclipse, or Netbeans, you can run your downloaded OptaPlanner examples within your development environment.
Prerequisites
- You have downloaded and extracted the OptaPlanner examples as described in Chapter 10, Downloading Red Hat build of OptaPlanner examples.
Procedure
Open the OptaPlanner examples as a new project:
-
For IntelliJ or Netbeans, open
examples/sources/pom.xml
as the new project. The Maven integration guides you through the rest of the installation. Skip the rest of the steps in this procedure. -
For Eclipse, open a new project for the
/examples/binaries
directory, located under therhpam-7.13.5-planner-engine
directory.
-
For IntelliJ or Netbeans, open
-
Add all the JAR files that are in the
binaries
directory to the classpath, except for theexamples/binaries/optaplanner-examples-7.67.0.Final-redhat-00024.jar
file. -
Add the Java source directory
src/main/java
and the Java resources directorysrc/main/resources
, located under therhpam-7.13.5-planner-engine/examples/sources/
directory. Create a run configuration:
-
Main class:
org.optaplanner.examples.app.OptaPlannerExamplesApp
-
VM parameters (optional):
-Xmx512M -server -Dorg.optaplanner.examples.dataDir=examples/sources/data
-
Working directory:
examples/sources
-
Main class:
- Run the run configuration.