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.

  • $\begingroup$ I’m having the same question now.... which algorithms did you end up using? $\endgroup$
    – ElLl
    Commented Jan 15, 2021 at 14:56
  • $\begingroup$ There are several efficient algorithms to solve besides simplex. Could you provide more details about the kind of constraints you have and the size of your problem? $\endgroup$
    – mohit-mhjn
    Commented Sep 2, 2021 at 19:39
  • $\begingroup$ I'd expect OptaPy (open source) to work well on the Transportation Problem too, but I haven't tried it yet. $\endgroup$ Commented Sep 14, 2022 at 13:17

3 Answers 3


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:



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

  • $\begingroup$ 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 $\endgroup$
    – Sune
    Commented Sep 10, 2022 at 8:39

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

  • 1
    $\begingroup$ 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. $\endgroup$
    – Community Bot
    Commented Sep 9, 2022 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.