Chapter 6. Using OptaWeb Vehicle Routing

In the OptaWeb Vehicle Routing application, you can mark a number of locations on the map. The first location is assumed to be the depot. Vehicles must deliver goods from this depot to every other location that you marked.

You can set the number of vehicles and the carrying capacity of every vehicle. However, the route is not guaranteed to use all vehicles. The application uses as many vehicles as required for an optimal route.

The current version has certain limitations:

  • Every delivery to a location is supposed to take one point of vehicle capacity. For example, a vehicle with a capacity of 10 can visit up to 10 locations before returning to the depot.
  • Setting custom names of vehicles and locations is not supported.

6.1. Creating a route

To create an optimal route, use the Demo tab of the OptaWeb Vehicle Routing user interface.

Prerequisites

  • OptaWeb Vehicle Routing is running and you have access to the user interface.

Procedure

  1. In OptaWeb Vehicle Routing, click Demo to open the Demo tab.
  2. Use the blue minus and plus buttons above the map to set the number of vehicles. Each vehicle has a default capacity of 10.
  3. Use the plus button in a square on the map to zoom in as required.

    Note

    Do not double-click to zoom in. A double click also creates a location.

  4. Click a location for the depot.
  5. Click other locations on the map for delivery points.
  6. If you want to delete a location:

    1. Hover the mouse cursor over the location to see the location name.
    2. Find the location name in the list in the left part of the screen.
    3. Click the X icon next to the name.

Every time you add or remove a location or change the number of vehicles, the application creates and displays a new optimal route. If the solution uses several vehicles, the application shows the route for every vehicle in a different color.

6.2. Viewing and setting other details

You can use other tabs in OptaWeb Vehicle Routing user interface to view and set additional details.

Prerequisites

  • OptaWeb Vehicle Routing is running and you have access to the user interface.

Procedure

  • Click the Vehicles tab to view, add, and remove vehicles, and also set the capacity for every vehicle.
  • Click the Visits tab to view and remove locations.
  • Click the Route tab to select each vehicle and view the route for the selected vehicle.

6.3. Creating custom data sets with OptaWeb Vehicle Routing

There is a built-in demo data set consisting of a several large Belgian cities. If you want to have more demos available in the Load demo menu, you can prepare your own data sets.

Procedure

To do that, follow these steps:

  1. In OptaWeb Vehicle Routing, add a depot and a number of visits by clicking on the map or using geosearch.
  2. Click Export and save the file in the data set_directory.

    Note

    The data set directory is the directory specified in the app.demo.data-set-dir property.

    If the application is running through the runLocally.sh script, the data set directory is set to $HOME/{VRP-DATA-DIR}/dataset.

    Otherwise, the property is from application.properties and defaults to optaweb-vehicle-routing-distribution-7.39.0.Final-redhat-00001/sources/optaweb-vehicle-routing-standalone/target/local/dataset.

    You can edit the app.demo.data-set-dir property to specify a diffent data directory.

  3. Edit the YAML file and choose a unique name for the data set.
  4. Restart the back end.

After you restart the back end, files in the data set directory appear in the Load demo menu.

6.4. Troubleshooting OptaWeb Vehicle Routing

If the OptaWeb Vehicle Routing behaves unexpectedly, follow this procedure to trouble-shoot.

Prerequisites

  • OptaWeb Vehicle Routing is running and behaving unexpectedly.

Procedure

  1. To identify issues, review the back end terminal output log.
  2. To resolve issues, remove the back end database:

    1. Stop the back end by pressing kbd:[Ctrl+C] in the back end terminal window.
    2. Remove the directory optaweb-vehicle-routing/optaweb-vehicle-routing-backend/local/db.
    3. Restart OptaWeb Vehicle Routing.