Skip to content

Web application for solving the Vehicle Routing Problem using OptaPlanner

Notifications You must be signed in to change notification settings

bsig-gh-bot/optaweb-vehicle-routing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OptaWeb Vehicle Routing

Build Status Ask question on Stack Overflow Join Zulip Chat

Quality Gate Status Reliability Rating Security Rating Maintainability Rating Lines of Code Coverage

Web application for solving the Vehicle Routing Problem using OptaPlanner.

Run the application using a Bash script

If you’re on Linux or macOS, you can use runLocally.sh to start the application on your computer.

  • Use runLocally.sh with no arguments to run with the defaults. This will download an OSM file needed to work with the built-in data set.

  • Use runLocally.sh -i for the interactive mode. In this mode you can choose from downloaded OSM files or download more OSM files.

  • Use runLocally.sh <REGION> to run with the selected region.

See the documentation to learn more about the runLocally.sh script.

Run the application in development mode

First, clone this repository and cd into it.

Frontend and backend are built and run independently. Open two terminal windows. Start the backend first, and then, when the backend is ready, start the frontend.

Running the backend

JDK 8 is the only system prerequisite for the backend. To install OpenJDK 8 on Fedora, run:

sudo dnf install java-1.8.0-openjdk-devel
  1. Download OpenStreetMap data for a region. For demonstration purposes, we use data for Belgium from Geofabrik:

    1. Open http://download.geofabrik.de/europe/belgium.html.

    2. Download the OSM file belgium-latest.osm.pbf.

    3. Save it to optaweb-vehicle-routing/optaweb-vehicle-routing-backend/local/openstreetmap/belgium-latest.osm.pbf.

  2. Build backend:

    cd optaweb-vehicle-routing-backend
    ./mvnw install
  3. Run backend:

    java -jar target/optaweb-vehicle-routing-backend-*.jar

When you start the backend for the first time, it will need several minutes to process the geographical information. Monitoring the terminal output, wait until the processing is complete, then start the frontend.

See Backend Development Guide to learn how to run backend during development.

Configuring the working region

If you want to try a different region than Belgium, download an OSM file from Geofabrik and select it with app.routing.osm-file property when starting the backend.

Don’t forget to use app.region.country-codes property to override geosearch results constraint.

There is currently only one out-of-the-box data set for Belgium so the Load demo button won’t work with other regions.

java -jar target/optaweb-vehicle-routing-backend-*.jar \
--app.routing.osm-file=massachusetts-latest.osm.pbf \
--app.region.country-codes=US
Caution
Using large OSM files

For best user experience, use smaller regions like individual European or US states. Using OSM files larger than 1 GB will require significant RAM size and take a lot of time (up to several hours) for the initial processing.

Running the frontend

  1. Install npm. If you’re on Fedora, you can do this by running:

    sudo dnf install npm
  2. Install dependencies:

    cd optaweb-vehicle-routing-frontend
    npm install
  3. Run frontend:

    npm start
  4. Open http://localhost:3000/ in a web browser. By default, the npm start command attempts to open this URL in your default browser.

Tip
Prevent npm start from launching your default browser

If you don’t want npm start to open a new browser tab each time you run it, export an environment variable BROWSER=none.

You can use .env.local file to make this preference permanent. To do that, run

echo BROWSER=none >> .env.local

About

Web application for solving the Vehicle Routing Problem using OptaPlanner

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 72.0%
  • TypeScript 23.2%
  • Shell 3.3%
  • JavaScript 0.6%
  • CSS 0.4%
  • Dockerfile 0.3%
  • HTML 0.2%