LINPROG DIFFERENCES MATLAB AND PYTHON
Please, note that you compare different implementations of the same idea, but not the same method in different environments, so results may be different.
In general, the optimal solution is not stable, even for simple linear problems. If methods are slightly different or data are slightly different, solutions may vary a lot.
If I understand correctly modern Matlab interior-point uses a crossover process (after interior-point it locates the closest basis solution), so it is much different from the classical interior-point which scipy implementation is closer to. But even if you try interior-point-legacy in Matlab it probably still will be different from the opensource interior-point used in scipy.
But the optimal objective value is stable. So, look at the objective value. If it is closer than your tolerance (1e-6) then you just got numerically different solutions.
If the objective value diverges then it may be the result of slightly different data. If you generate data in Matlab write down to file and then read it in Python you may lose accuracy.
If data absolutely the same then it means that one of the solvers fails to find a solution. Again, it is different solvers.
I've created a Matlab program which resolve some linear program and i've translate the code in python.
The two solvers return a different results.
I've used:
PYTHON:
res=linprog(f,A,b,A_eq=None,b_eq=None,bounds=(None,None),options={"maxiter":200, "tol":1e-6})
MATLAB
options = optimoptions('linprog','Algorithm','interior-point');
[res,fval]=linprog(f,A,b,[],[],[],[],options);
Does anyone know why i get different results?