-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bed allocation quickstart (#307)
- Loading branch information
Showing
25 changed files
with
2,968 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
= Bed Allocation Scheduling (Java, Quarkus, Maven) | ||
|
||
Assign beds to patient stays to produce a better schedule for hospitals. | ||
|
||
image::./quarkus-bed-scheduling-screenshot.png[] | ||
|
||
* <<run,Run the application>> | ||
* <<package,Run the packaged application>> | ||
* <<container,Run the application in a container>> | ||
* <<native,Run it native>> | ||
[[run]] | ||
== Run the application | ||
|
||
. Git clone the timefold-quickstarts repo and navigate to this directory: | ||
+ | ||
[source, shell] | ||
---- | ||
$ git clone https://github.com/TimefoldAI/timefold-quickstarts.git | ||
... | ||
$ cd timefold-quickstarts/use-cases/bed-allocation | ||
---- | ||
|
||
. Start the application with Maven: | ||
+ | ||
[source, shell] | ||
---- | ||
$ mvn quarkus:dev | ||
---- | ||
|
||
|
||
. Visit http://localhost:8080 in your browser. | ||
|
||
. Click on the *Solve* button. | ||
|
||
Then try _live coding_: | ||
|
||
. Make some changes in the source code. | ||
. Refresh your browser (F5). | ||
|
||
Notice that those changes are immediately in effect. | ||
|
||
|
||
[[package]] | ||
== Run the packaged application | ||
|
||
When you're done iterating in `quarkus:dev` mode, | ||
package the application to run as a conventional jar file. | ||
|
||
. Build it with Maven: | ||
+ | ||
[source, shell] | ||
---- | ||
$ mvn package | ||
---- | ||
. Run the Maven output: | ||
+ | ||
[source, shell] | ||
---- | ||
$ java -jar ./target/quarkus-app/quarkus-run.jar | ||
---- | ||
+ | ||
[NOTE] | ||
==== | ||
To run it on port 8081 instead, add `-Dquarkus.http.port=8081`. | ||
==== | ||
|
||
. Visit http://localhost:8080 in your browser. | ||
|
||
. Click on the *Solve* button. | ||
|
||
[[container]] | ||
== Run the application in a container | ||
|
||
. Build a container image: | ||
+ | ||
[source, shell] | ||
---- | ||
$ mvn package -Dcontainer | ||
---- | ||
The container image name | ||
. Run a container: | ||
+ | ||
[source, shell] | ||
---- | ||
$ docker run -p 8080:8080 --rm $USER/timefold-solver-quarkus-bed-allocation-quickstart:1.0-SNAPSHOT | ||
---- | ||
|
||
[[native]] | ||
== Run it native | ||
|
||
To increase startup performance for serverless deployments, | ||
build the application as a native executable: | ||
|
||
. https://quarkus.io/guides/building-native-image#configuring-graalvm[Install GraalVM and gu install the native-image tool] | ||
|
||
. Compile it natively. This takes a few minutes: | ||
+ | ||
[source, shell] | ||
---- | ||
$ mvn package -Dnative | ||
---- | ||
|
||
. Run the native executable: | ||
+ | ||
[source, shell] | ||
---- | ||
$ ./target/*-runner | ||
---- | ||
|
||
. Visit http://localhost:8080 in your browser. | ||
|
||
. Click on the *Solve* button. | ||
|
||
== More information | ||
|
||
Visit https://timefold.ai[timefold.ai]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.acme</groupId> | ||
<artifactId>timefold-solver-quarkus-bed-allocation-quickstart</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<maven.compiler.release>17</maven.compiler.release> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
|
||
<version.io.quarkus>3.8.0</version.io.quarkus> | ||
<version.ai.timefold.solver>999-SNAPSHOT</version.ai.timefold.solver> | ||
|
||
<version.compiler.plugin>3.12.1</version.compiler.plugin> | ||
<version.resources.plugin>3.3.1</version.resources.plugin> | ||
<version.surefire.plugin>3.2.5</version.surefire.plugin> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-bom</artifactId> | ||
<version>${version.io.quarkus}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>ai.timefold.solver</groupId> | ||
<artifactId>timefold-solver-bom</artifactId> | ||
<version>${version.ai.timefold.solver}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy-jackson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-smallrye-openapi</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>ai.timefold.solver</groupId> | ||
<artifactId>timefold-solver-quarkus</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>ai.timefold.solver</groupId> | ||
<artifactId>timefold-solver-quarkus-jackson</artifactId> | ||
</dependency> | ||
|
||
<!-- Testing --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>ai.timefold.solver</groupId> | ||
<artifactId>timefold-solver-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.awaitility</groupId> | ||
<artifactId>awaitility</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>3.25.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- UI --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-webjars-locator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>ai.timefold.solver</groupId> | ||
<artifactId>timefold-solver-webui</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.webjars</groupId> | ||
<artifactId>bootstrap</artifactId> | ||
<version>5.2.3</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.webjars</groupId> | ||
<artifactId>jquery</artifactId> | ||
<version>3.6.4</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.webjars</groupId> | ||
<artifactId>font-awesome</artifactId> | ||
<version>5.15.1</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.webjars.npm</groupId> | ||
<artifactId>js-joda</artifactId> | ||
<version>1.11.0</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.webjars.npm</groupId> | ||
<artifactId>js-joda__locale_en-us</artifactId> | ||
<version>3.1.0</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>${version.resources.plugin}</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${version.compiler.plugin}</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<version>${version.io.quarkus}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${version.surefire.plugin}</version> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>native</id> | ||
<activation> | ||
<property> | ||
<name>native</name> | ||
</property> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${version.surefire.plugin}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<native.image.path> | ||
${project.build.directory}/${project.build.finalName}-runner | ||
</native.image.path> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<properties> | ||
<quarkus.package.type>native</quarkus.package.type> | ||
<!-- To allow application.properties to avoid using the in-memory database for native builds. --> | ||
<quarkus.profile>native</quarkus.profile> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>container</id> | ||
<activation> | ||
<property> | ||
<name>container</name> | ||
</property> | ||
</activation> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-container-image-jib</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<properties> | ||
<quarkus.container-image.build>true</quarkus.container-image.build> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.