5

The Transportation Problem can be solved with a simplex algorithm, but it's time-consuming.

I'm wondering if there exists a specific Python-implemented algorithm with low complexity.

RobPratt
  • 32,006
  • 1
  • 44
  • 84
dgamboz
  • 135
  • 6

3 Answers3

9

You could try to solve it as a min cost flow problem.

NetworkX is a package for graph algorithms and has algorithms for this implemented. It can easily be installed via pip install networkx.

An minimal working example is given at the bottom of this link:

https://networkx.github.io/documentation/networkx-2.4/reference/algorithms/generated/networkx.algorithms.flow.min_cost_flow.html#networkx.algorithms.flow.min_cost_flow

user3680510
  • 3,655
  • 6
  • 26
2

You can try CBC which uses Dual Simplex (the same algorithm CPLEX & GUROBI use). The easiest way to use that through Python is Pyomo.

Nikos Kazazakis
  • 12,121
  • 17
  • 59
  • It might be even easier to do it through PuLP. By installing PuLP you get the installation of CBC "for free". I prefer to model using Pyomo though – Sune Sep 10 '22 at 08:39
-1

I personally use networkx some example of transportation modelling from networkx is available in my article here.

sutan
  • 107
  • 1
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Community Sep 09 '22 at 16:50