SensitivitySensitivity or also called post-optimal analysis in extra information that is provided about the current optimal solution. lp_solve brings a lot of sensitivity information. Several API calls are available to retrieve the sensitivity: get_sensitivity_obj, get_ptr_sensitivity_obj, get_sensitivity_objex, get_ptr_sensitivity_objex, get_sensitivity_rhs, get_ptr_sensitivity_rhs, get_reduced_costs, get_ptr_reduced_costs. The lp_solve program doesn't show the sensitivity by default. So to see the sensitivity information, use the -S4 option. The best way to explain this is via an example. min: +COLONE +3 COLTWO +6.24 COLTHREE +0.1 COLFOUR; THISROW: +78.26 COLTWO +2.9 COLFOUR >= 92.3; THATROW: +0.24 COLONE +11.31 COLTHREE <= 14.8; LASTROW: +12.68 COLONE +0.08 COLTHREE +0.9 COLFOUR >= 4; COLONE >= 28.6; COLFOUR >= 18.00; COLFOUR <= 48.98; The solution of this model is (with the -S4 option): Value of objective function: 31.7828 Actual values of the variables: COLONE 28.6 COLTWO 0 COLTHREE 0 COLFOUR 31.8276 Actual values of the constraints: THISROW 92.3 THATROW 6.864 LASTROW 391.293 Objective function limits: From Till FromValue COLONE 0 1e+024 -1e+024 COLTWO 2.698621 1e+024 0.5123946 COLTHREE 0 1e+024 0.7016799 COLFOUR 1.387779e-017 0.1111679 -1e+024 Dual values with from - till limits: Dual value From Till THISROW 0.03448276 52.2 142.042 THATROW 0 -1e+024 1e+024 LASTROW 0 -1e+024 1e+024 COLONE 1 -1.943598 61.66667 COLTWO 0.3013793 -0.6355993 0.5123946 COLTHREE 6.24 -4841.16 0.7016799 COLFOUR 0 -1e+024 1e+024 First look at 'Objective function limits' (via API obtained by get_sensitivity_obj, get_ptr_sensitivity_obj, get_sensitivity_objex, get_ptr_sensitivity_objex). There is a list of all variables with for each variable 3 values. From, Till and FromValue. From - Till gives the limits where between the objective costs may vary so that the solution stays the same. For example variable COLFOUR has a From value of -1e24 and a Till value of 0.1111679. The value of the cost of this variable is 0.1 (see the coefficient of COLFOUR in the model). This means that if this coefficient varies between -1e24 and 0.1111679 that the solution doesn't change at all. The same values for the variables and the constraints will maintain as long as the cost stays in this range. The objective function value will vary of course and also the sensitivity information of the other variables, but the solution will stay the same. When the cost of variable COLFOUR is above 0.1111679 then the solution will change. The FromValue is only meaningful if the variable has a value of 0 (rejected). Then this value means that the amount of this variable will be that much when the From (minimization) or Till (maximization) value is reached. For example for variable COLTWO, which has now an amount of 0, the amount will become 0.5123946 if its cost becomes 2.698621. Note that you only get information about this variable. There is no information what the values will be of the other variables. In a blending example where the coefficients of the objective function are generally the price of an ingredient this information tells you to what point a price may change to have the same composition. Another piece of information are the Dual values with their from - till limits. This is provided for both the constraints and the variables. The information is for both the same. For example constraint THISROW has a dual value of 0.03448276 with a from value of 52.2 and a Till value of 142.042. The meaning of this is the following. The Dual value specifies how much the objective function will vary if the constraint value is incremented with one unit. This implies that there is only a non-zero dual value if the constraint is active. Constraint THATROW for example is not active because the constraint is <= 14.8, but its value is only 6.864. However constraint THISROW is >= 92.3 and its value is also 92.3, thus active. If the constraint is changed to 93.3 (+1), then the objective value will be the current value + change * dual value = 31.7828 + 1 * 0.03448276 = 31.81728. However this is only true for the range From - Till that means that the dual value says the same as long as the constraint lays between the from till limits. From the moment that you are outside of these limits, the dual value will change. The dual value give a very good indication how much this restriction costs. If the dual value is very high then this constraint is very influent on the objective function and if you are able to change it a bit then the solution will much better. Also the sign of the dual value has a meaning. If it is positive it means that if the restriction becomes bigger that the objective value will be larger and if it is negative that the objective value will be smaller. Also note that if the restriction is changed, even between the limits that the solution can change. The from - till limits only say that the cost will remain the same, nothing less, nothing more. inaccurate sensitivity analysis in a model with integer variablesThe sensitivity analysis doesn't take the integer restrictions in account. This is almost impossible since it would ask too much calculation time. In particular the from - till limits on both the objective function and the dual values are not to trust. They only apply for the current solution without the integer restrictions. Keep this in mind. The dual values are correct. |