The Challenge

This project is related to the operation of delivery vehicles within a geographical area. Delivery vehicles with specific characteristics such as capacity and speed are stationed at various base stations. The vehicles transport materials from retail stores to customers’ locations. Orders coming from upstream need to be batched and assigned to a vehicle. These orders can have constraints like the maximum time they can be in transit and what temperature they can be stored at. Correct scheduling of orders and optimal assignment of vehicles is crucial for timely delivery and efficient use of the fleet.

The primary purpose of the simulation model in this project was to develop and collect information from the simulation that will be sent to an external algorithm that is responsible for optimizing the orders assignment to the vehicles.

The Solution

A simulation model was built using AnyLogic. GIS maps environment was used for locating stations, stores, etc. as well as existing routes. Moreover, the Process Modeling library in AnyLogic in combination with state charts was used to handle the orders generation and movement process of vehicles.

For high flexibility the input parameters are defined by the user using an excel configuration. These parameters included:

  • Geolocations of stations, stores, and customers
  • Vehicles capacity, speed, and material types that can be transported by the vehicle
  • Orders rate of arrival at different times of the day
  • Orders types which includes details about the size of the order, criticality, etc.

In AnyLogic, at the beginning of the model, all vehicles are located in the base stations. Orders are generated based on the specified rates. If the pickup location of an order is not specified, the pickup location is chosen and set in the AnyLogic model as the closest facility, based on accessible routes, that the ordered item can be picked up from. This also takes into consideration the type of order, which must be consistent with the type of pickup facility. All the characteristics of the orders generated, as well as the locations, properties, and the statuses of the vehicles are given as input to the external algorithm. This is done using HTTP to connect to a python server by following the steps below:

  • we set up an HTTP client
  • we convert the data to be sent to the server into a JSON string
  • we create a POST Request
  • we send the request
  • the algorithm solves the optimization problem and sends back a response having a specified format to the AnyLogic model. This response includes the assignment of the orders to vehicles.

Back in AnyLogic, all the information received from the algorithm is used to execute the movement of the vehicles. Any time a new order or set of simultaneous orders are generated in AnyLogic, a new request with a new set of input will be sent to the algorithm for re-optimization. This means that the assigned routes for the vehicles change as new orders arrive. When new orders are generated, the position of the vehicles that are sent to the solver are updated as their current locations (latitude/longitude) for moving vehicles and the station location for vehicles not in use. All this info as well as new orders characteristics are sent to the algorithm for an updated solution. Naturally, orders that have already been delivered are not included in the new solution.

The user was given the ability to export data from the simulation model when needed using a button. The exported data included:

  • all completed and active orders characteristics, assigned vehicles, and statuses
  • request time and response time of the server for each round since the client was interested in knowing the speed of execution of the algorithm
  • information related to all vehicles activities such as time of pickup and drop-off of orders

Results

In addition to providing the information to the external algorithm that allowed the client to conduct the vehicles assignment optimization, the simulation model provided the client with valuable data to analyze certain metrics such as delivery durations, vehicles utilization, and the percentage of orders that were rejected due to vehicles unavailability or constraints related to the characteristics of the orders.