Discussion:
Shadow prices and bounds of the constraints at Matlab.
(too old to reply)
Eduardo Gouveia
2007-11-30 12:07:36 UTC
Permalink
Hello.

Im writing to know if anyone can answer to the following problem:

Im working with two kinds of problems: linear and non linear optimization.

To linear optimization I generally use the linprog function of Matlab
To non linear optimization I generally use fmincon.
Both problems include inequalities and equalities constraints.

In both kinds of the referred problems I need to perform post optimization (- Sensitivity Analysis).

To perform this goal I will need the values of shadow prices.

At Matlab the shadow prices are obtained using lambda options:

lamda.ineqlin gives shadow prices of inequality constraints.

lamda.eqlin gives shadow prices of equality constraints.

lamda.lower gives lower bounds on variable

lamda.upper gives upper bounds on variable

As well known, the shadow price corresponds to the improvement at objective function when we increase the RHS value of one unit. However, this situation only is true if the increase of RHS value remains at the bounds of the constraint.

An example with linprog:

A=[
-1 0 0
1 0 0
0 -1 0
0 1 0
0 0 -1
0 0 1
0 0.2 -0.4
0 -0.2 0.4]

b=[-2; 4; -3; 5; 8; -5; 3.72; 3.72];

Aeq=[1 1 1];
beq=[0];

f=[0 -1 0];

[x,fval,exitflag,output,lambda] = linprog(f,A,b,Aeq,beq,[],[],options,opt)
shadow_price_inequalities=lambda.ineqlin
shadow_price_equalities =lambda.eqlin

The results:


x=[2.0000; 4.8667; -6.8667];

shadow_price_inequalities =[ 0.6667; 0.0000; 0.0000;
0.0000; 0.0000; 0.0000; 1.6667; 0.0000];

shadow_price_equalities =[ 0.6667];

For example, for constraint number 7 the shadow price is 1.6667. This constraint is bounded at 3.72. If I increase the RHS value (vector b) to 4.72 I will not obtain a improvement at objective function of 1.6667. In fact, objective function (max X2) is bounded at 5. So the increment allowed is the difference from 4.8667 to 5. Can not be 1.6667. That means that shadow price only are true if the increment of RHS value remains at the constraints boundaries.

I used another software to perform the same exercise and I obtained the boundary values of constraint 7 which were [2,6; 3,8]. That means that the increase for 4.72 of RHS value of constraint 7 will be outside of the boundaries.

My questions are:
The Matlab, by using lambda (as far as I know) only provides de values of shadow prices and the bounds of the variables. But how can I obtain the boundary values of the constraints to evaluate the “true” of the shadow prices?

There is any command that allows getting the true improvement at objective function when RHS value is increased to the extreme bounds (for the example 3.8)?

Thank you for any help.
Eduard
Marcus M. Edvall
2007-11-30 16:46:46 UTC
Permalink
Hi Edouardo,

You can do this with TOMLAB /CPLEX: http://tomopt.com/tomlab/products/cplex/

Use the free demo first and you can see the options.

Best wishes, Marcus
Tomlab Optimization Inc.
http://tomopt.com/
Eduardo Gouveia
2007-12-07 11:46:37 UTC
Permalink
Dear Marcus
I’m using Tomlab as you suggested.
I initiate the use with a linear problem.
Later I will test Tomlab for nonlinear problems.

At Matlab I use linprog for linear optimization problems and fmincon for non linear problems. Both of problems have constraints.
My code is already written in Matlab language.

I try to use your example testlinprog

c = [-7;-5];
A = [1 2 ;4 1 ];
b_U = [6 12]';
b_L = [-Inf;-Inf];

I obtain the results:

Optimal vector x:
x_k: 2.571429 1.714286

Lagrange multipliers v. Vector length 4:

v_k: 1.776357e-015 1.776357e-015 -4.549052e+000 -4.453845e+000


But I’m interested in the RHS output bounds. How can I obtain RHS lower and RHS upper bound for each constraint?

I performed the same exercise in other software for linear programming. I obtained the RHS boundaries for both constraints in [3 , 24]

This example (testlinprog) is for linprog, and for fmincon? How can I obtain the output bounds of constraints?


Thank you

Loading...