/pdp_utils

Provides utilities for the meta heuristics project of UiB course INF273

Primary LanguagePython

UiB INF273-Meta-Heuristikkar Pickup and Delivery Problem utils

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

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
  • 'travel_time': for each vehicle the travel time from one node to another
  • 'first_travel_time': for each vehicle the travel time from starting point to each node
  • 'vessel_capacity': the capacity of each vehicle
  • 'loading_time': for each vehicle the loading time of pickup of each call (-1 indicates not allowed)
  • 'unloading_time': for each vehicle the un-loading time of pickup of each call (-1 indicates not allowed)
  • 'vessel_cargo': the list of allowed calls for each vehicle
  • 'travel_cost': for each vehicle the travel cost from one node to another
  • 'first_travel_cost': for each vehicle the travel cost from starting point to each node
  • 'port_cost': 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)