Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Getting Started - Quarkus Integration: School Timetabling (Kotlin, Quarkus, Maven)

Note: This project is the result of following the Quarkus getting started guide. For a more complete School Timetabling example, see the school-timetabling quickstart.

Assign lessons to timeslots and rooms to produce a better schedule for teachers and students.

School Timetabling Screenshot

Constraints

Name Level Description
Room conflict Hard Two lessons cannot be scheduled in the same room at the same time.
Teacher conflict Hard A teacher cannot teach two lessons at the same time.
Student group conflict Hard A student group cannot attend two lessons at the same time.
Teacher room stability Soft A teacher should teach all their lessons in the same room.
Teacher time efficiency Soft A teacher should have consecutive lessons to minimize gaps in their schedule.
Student group subject variety Soft A student group should not have the same subject in consecutive timeslots.

Prerequisites

  1. Install JDK, Maven and Kotlin, for example with Sdkman:

    $ sdk install java
    $ sdk install maven
    $ sdk install kotlin

Run the application

  1. Git clone the timefold-quickstarts repo and navigate to this directory:

    $ git clone https://github.com/TimefoldAI/timefold-quickstarts.git
    ...
    $ cd timefold-quickstarts/getting-started/quarkus-integration-kotlin
  2. (Optional) If you want to run a licensed edition (Plus / Enterprise), set up your license key first. See the Timefold license tool for instructions.

  3. Start the application with Maven:

    1. Community Edition

      $ mvn quarkus:dev
    2. Plus / Enterprise Edition: The profile sets up the correct Maven artifacts to run the licensed version. See the pom.xml for the implementation details.

      $ mvn quarkus:dev -Denterprise
  4. Visit http://localhost:8080 in your browser.

  5. 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.

Run the packaged application

When you're done iterating in quarkus:dev mode, package the application to run as a conventional jar file.

  1. Compile it with Maven:

    $ mvn package
  2. Run it:

    $ java -jar ./target/quarkus-app/quarkus-run.jar

    Note Even though it's written in Kotlin, it can run with the java command.

    Note To run it on port 8081 instead, add -Dquarkus.http.port=8081.

  3. Visit http://localhost:8080 in your browser.

  4. Click on the Solve button.

Run the application in a container

  1. Build a container image:

    $ mvn package -Dcontainer
  2. Run a container:

    $ docker run -p 8080:8080 --rm $USER/kotlin-school-timetabling:1.0-SNAPSHOT

Run it native

To increase startup performance for serverless deployments, build the application as a native executable:

  1. Install GraalVM and gu install the native-image tool.

  2. Compile it natively. This takes a few minutes:

    $ mvn package -Dnative -DskipTests
  3. Run the native executable:

    $ ./target/*-runner
  4. Visit http://localhost:8080 in your browser.

  5. Click on the Solve button.

More information

Visit timefold.ai.