I am using scipy.optimize.linprog. When I use method=”simplex”, I get incorrect answers for larger datasets (it simply gives a result of 0). When I use method=”interior point” for the same datasets and with the same args apart from the method, I get the correct answers.
Why does this happen?
(Unfortunately I am doing an assignment that requires results for both the simplex and interior point methods).
Verified correctness by solving dual problem. Tried setting autoscale to true.
For the sake of the assignment, you can try
method='revised simplex'
. But all of these methods are deprecated, and they will be removed from new releases of SciPy soon, so they should no longer be relied on. Prefermethod='highs'
for new code. There are separate'highs-simplex'
and'highs-ipm'
methods for simplex and interior-point methods, but they will both give you a basic solution because'highs-ipm'
does crossover at the end by default. As for why it happens:method='simplex'
is a very straightforward implementation. It takes a lot more to get a robust LP solver.