I have a linear program in the MPS file format listing all the rows, columns, right-hand sides, etc. I can read that in Matlab and solve it using linprog. However, it seems there is no easy way to do sensitivity analysis for the right-hand side coefficients. I have to do the sensitivity analysis in Matlab as no other software is available. I would appreciate it if you could refer me to some ways I can accomplish that in Matlab.
1$\begingroup$ The Mosek optimization toolbox for Matlab has sensitivity analysis. See docs.mosek.com/9.1/toolbox/sensitivity-shared.html $\endgroup$– ErlingMOSEKMar 5, 2020 at 19:32
As documented at https://www.mathworks.com/help/optim/ug/linprog.html, linprog returns the Lagranage multipliers via the optional 5th output argument, lambda. What are called Lagrange Multipliers by linprog and in Nonlinear Programming (optimization) are more usually called dual values in Linear Programming. So perhaps that is why you did not realize linprog provides them.
[x,fval,exitflag,output,lambda] = linprog(___) additionally returns a structure lambda whose fields contain the Lagrange multipliers at the solution x.
lambda is a structure which contains the fields
lower upper eqlin ineqlin
for lower bounds, upper bounds, equality constraints, and inequality constraints respectively.
$\begingroup$ I found the lambda which after I run the linprog routine shows a structure. However when I try to retrieve data like lambda.eqlin, it says the field eqlin doesn't exist. $\endgroup$– S_ScouseMar 6, 2020 at 1:40
$\begingroup$ Please show your code. If you just type lambda at the command line, you should see what the fields are. Any ffeld which doesn't have any of that type of constraint, will be empty. If you have lb, lambda.lb should be non-empty. If no equality constraints, then lambda.eqlin will be empty, etc. $\endgroup$ Mar 6, 2020 at 3:12