♻️ Maximize shift exchanges between pools of student requests
This is a service used to calculate the maximum possible shift exchanges in the Swap platform.
The following software is required to be installed on your system:
The Maven Wrapper is an easy way to ensure a user of your Maven build has everything necessary to run your Maven build. The wrapper should work on various operating systems including:
- Linux (numerous versions, tested on Ubuntu and CentOS) [
bin/mvnw
] - OSX / macOS [
bin/mvnw
] - Windows (various newer versions) [
bin/mvnw.cmd
] - Solaris (10 and 11) [
bin/mvnw
]
Clone the repository.
git clone https://github.com/cesium/swap-solver
cd swap-solver
Open the project in your favourite IDE. This is a Maven project. If your IDE does not support building Maven projects by default, please refer to the official guides.
Start the server on http://localhost:4567.
mvn compile exec:java
Run the project tests.
mvn test
Format the code accordingly to common guide lines.
mvn spotless:apply
Lint your code with checkstyle.
mvn checkstyle:check
Build the docker images.
docker build -t swap-solver .
Run the image.
docker run -d -p 4567:4567 swap-solver mvn exec:java
The service is hosted by default on http://localhost:4567. The accepted request is a POST method and its body should follow this structure:
{
"exchange_requests": [
{
"id": "a1",
"from_shift_id": "TP1",
"to_shift_id": "TP5",
"created_at": 1
},
{
"id": "a2",
"from_shift_id": "TP5",
"to_shift_id": "TP1",
"created_at": 1
},
{
"id": "a3",
"from_shift_id": "TP2",
"to_shift_id": "TP4",
"created_at": 2
}
]
}
The return is a JSON as the following:
{
"solved_exchanges": ["a1", "a2"]
}