Skip to content

Python module to solve transportation problem.

License

Notifications You must be signed in to change notification settings

fi-do/transportation_problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

transportation_problem

Python module to solve transportation problems.

Table of Contents

About the Project

There are many great algorithm out there to solve a transportation problem. However, i started to write my own module to find a potential solution and get a better understanding in implementing algorithms in code. I tried to orient myself to the content of Wolfgang Domschke.

Getting Started

My goal is to release a simple python module to calculate potential and optimal solutions. So clone the tp.py to your python library folder and get started.

Requirements

  • Python > 3.6
  • numpy library

Installation

Clone module in your python path.

Usage

Import the module. Create an object with demand, supply and cost informations and call one method to find a solution. At the moment you can only call the column minma(=cm_rule) rule or north west corner rule(=nwc_rule) to get an transport matrix and total costs.

Example

import tp
import np

supply_vector = np.array([20, 40, 30])
demand_vector = np.array([20, 20, 20, 15, 15])
cost_matrix = np.array([[10, 15, 9, 13, 12],
                        [11, 30, 4, 13, 12],
                        [12, 13, 4, 1, 122]])
                        
problem = tp.Solver(supply_vector, demand_vector, cost_matrix)

matrix, costs = problem.nwc_rule()

print(matrix)
print(costs)
print(surplus)

Contact

Dominik

About

Python module to solve transportation problem.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages