UiB INF273-Meta-Heuristikkar Pickup and Delivery Problem utils

This Repo is dedicated to the function utils needed for the course project semester spring 2021.

Requirement

  • numpy

Usage

1) You can install the library by typing the following in terminal:

python setup.py install

2) You can load the problem instance using the following line

from pdp_utils import load_problem

prob = load_problem(*PROBLEM_FILE_ADDRESS*)

The function returns dictionary that includes the following information about each problem instance:

  • 'n_nodes': number of nodes
  • 'n_vehicles': number of vehicles
  • 'n_calls': number of calls
  • 'Cargo': information about each call
  • 'TravelTime': for each vehicle the travel time from one node to another
  • 'FirstTravelTime': for each vehicle the travel time from starting point to each node
  • 'VesselCapacity': the capacity of each vehicle
  • 'LoadingTime': for each vehicle the loading time of pickup of each call (-1 indicates not allowed)
  • 'UnloadingTime': for each vehicle the un-loading time of pickup of each call (-1 indicates not allowed)
  • 'VesselCargo': the list of allowed calls for each vehicle
  • 'TravelCost': for each vehicle the travel cost from one node to another
  • 'FirstTravelCost': for each vehicle the travel cost from starting point to each node
  • 'PortCost': the cost of answering a call for each vehicle (-2 indicates not allowed)

3) You can check the feasiblity of your asnwer like below:

from pdp_utils import feasibility_check

feasible, log = feasibility_check(SOL, prob)

print(log)

4) You can check the cost function of a sulotion as below:

from pdp_utils import cost_function

cost = cost_function(SOL, prob)