SensitivityAnalysis
Description
A SensitivityAnalysis object stores sensitivity analysis
information about a linear programming solution. The object properties give the rate of change
of the objective function value with respect to various coefficients, as well as the limits on
the coefficient changes that preserve the optimal basis. For details, see More About
Creation
Create a SensitivityAnalysis object by specifying
sensitivity as the sixth output of the linprog function:
[x,fval,exitflag,output,lambda,sensitivity] = linprog(...)
Properties
Each property is a table containing the five columns shown below.
| Column Name | Description |
|---|---|
LowerLimit | The minimum value the model parameter can take without altering the current optimal basis |
UpperLimit | The maximum value the model parameter can take without altering the current optimal basis |
ObjectiveValueAtLowerLimit | The objective function value at the optimal solution if the model parameter was
changed to LowerLimit |
ObjectiveValueAtUpperLimit | The objective function value at the optimal solution if the model parameter was
changed to UpperLimit |
ObjectiveValueChangeRate | The rate of change of the objective function value with respect to the model
parameter in the range (LowerLimit,
UpperLimit) |
This property is read-only.
Sensitivity of the objective function coefficient f, returned
as an N-by-5 table, where N is the number of
variables in the problem.
This property is read-only.
Sensitivity of the linear equality constraint beq, returned as
an Neq-by-5 table, where Neq is the number of
linear equality constraints in the problem.
This property is read-only.
Sensitivity of the linear inequality constraint b, returned as
an Nineq-by-5 table, where Nineq is the number of
linear inequality constraints in the problem.
This property is read-only.
Sensitivity of the linear inequality constraint bl, returned as
an Nineq-by-5 table, where Nineq is the number of
linear inequality constraints in the problem.
This property is read-only.
Sensitivity of the lower bound lb, returned as an
N-by-5 table, where N is the number of variables
in the problem.
Data Types: table
This property is read-only.
Sensitivity of the upper bound ub, returned as an
N-by-5 table, where N is the number of variables
in the problem.
Examples
Create a linear program.
f = [-2,-1];
A = [-1 -1;
1 -1/2;
-1 1];
bl = [-5 -Inf -Inf];
b = [Inf 2 3];
lb = [0 0];
ub = [];
Aeq = [];
beq = [];Solve the linear program, requesting sensitivities.
[x,fval,exitflag,output,lambda,sensitivity] = ...
linprog(f,A,b,Aeq,beq,lb,ub)Optimal solution found.
x = 2×1
7
10
fval = -24
exitflag = 1
output = struct with fields:
iterations: 0
constrviolation: 0
message: 'Optimal solution found.'
algorithm: 'dual-simplex-highs'
firstorderopt: 0
lambda = struct with fields:
lower: [2×1 double]
upper: [2×1 double]
eqlin: [0×1 double]
ineqlinLower: [3×1 double]
ineqlin: [3×1 double]
sensitivity =
SensitivityAnalysis with properties:
Variables Sensitivity:
ObjectiveCoefficient: [2×5 table]
LowerBound: [2×5 table]
UpperBound: [2×5 table]
Constraints Sensitivity:
InequalityLHS: [3×5 table]
InequalityRHS: [3×5 table]
EqualityRHS: [0×5 table]
Examine the sensitivities.
sensitivity.ObjectiveCoefficient
ans=2×5 table
LowerLimit UpperLimit ObjectiveValueAtLowerLimit ObjectiveValueAtUpperLimit ObjectiveValueChangeRate
__________ __________ __________________________ __________________________ ________________________
-Inf 1 -Inf -3 7
-Inf 1 -Inf -4 10
sensitivity.LowerBound
ans=2×5 table
LowerLimit UpperLimit ObjectiveValueAtLowerLimit ObjectiveValueAtUpperLimit ObjectiveValueChangeRate
__________ __________ __________________________ __________________________ ________________________
-Inf 7 -24 -24 0
-Inf 10 -24 -24 0
sensitivity.InequalityLHS
ans=3×5 table
LowerLimit UpperLimit ObjectiveValueAtLowerLimit ObjectiveValueAtUpperLimit ObjectiveValueChangeRate
__________ __________ __________________________ __________________________ ________________________
-Inf -17 -24 -24 0
-Inf 2 -24 -24 0
-Inf 3 -24 -24 0
sensitivity.InequalityRHS
ans=3×5 table
LowerLimit UpperLimit ObjectiveValueAtLowerLimit ObjectiveValueAtUpperLimit ObjectiveValueChangeRate
__________ __________ __________________________ __________________________ ________________________
-17 Inf -24 -24 0
-1.5 Inf -3 -Inf -6
-2 Inf -4 -Inf -4
For descriptions of the returned sensitivities, see SensitivityAnalysis.
More About
For linear programming problems, the Lagrange multipliers and sensitivity analysis
parameters are closely related. Lagrange multipliers give the rate of change of the
objective function value with respect to a change in parameters, but only at a solution,
meaning the rate of change holds for an infinitesimal change in parameters. However, the
same rate of change in objective can hold for a large range of parameters. The sensitivity
analysis object give the range of parameters that have the same rate of change for the
objective. The absolute value of the returned ObjectiveValueChangeRate in
the sensitivity is the same as the absolute value of the associated Lagrange multiplier
(they can differ in sign as explained in the next paragraph). For an example comparing
Lagrange multipliers to sensitivities, see Obtain Sensitivities.
Why do the signs of the ObjectiveValueChangeRate and corresponding
Lagrange multiplier sometimes differ? Lagrange multipliers give the rate of change in the
objective function value with respect to a tightening of the constraint, meaning an increase
in a lower bound or inequality left hand side, or decrease in an upper bound or inequality
right hand side. These Lagrange multipliers are always nonnegative. In contrast, the
ObjectiveValueChangeRate represents the rate of change of the objective
function value with respect to a change in parameter, whether that change represents a
tightening or loosening of a constraint. So the signs of the two rates agree for the lower
bounds and the inequality right hand sides, and are opposite for the upper bounds and
inequality right hand sides.
For a linear program, the optimal basis can be interpreted as a set of constraints that are active at the solution. Typically, this set is unique and changes only when some problem coefficients change sufficiently. For more information, see Basic and Nonbasic Variables.
In some cases, the optimal basis is not unique and can change with the slightest change
in coefficients. In such cases, the reported intervals
(LowerLimit,UpperLimit) for some parameters can have a width of 0 or
close to 0. This singularity reflects a limitation of "single-basis" sensitivity
analysis.
Similarly, for some problems with a nonunique basis, each reported range reflects the interval over which one particular basis remains optimal. Therefore, the reported lower and upper limits can be narrower than the full interval with the reported objective value change rate. In other words, a different optimal basis can have a wider range corresponding to the reported change rate.
For an inactive variable or constraint upper bound, including cases where
b or ub is Inf:
LowerLimitis the variable or constraint value at the optimal solution.UpperLimitisInf.ObjectiveValueAtLowerLimitis the objective value at the optimal solution.ObjectiveValueAtUpperLimitis the objective value at the optimal solution.ObjectiveValueChangeRateis0.
For an inactive variable or constraint lower bound, including cases where
bl or lb is -Inf:
LowerLimitis-Inf.UpperLimitis the variable or constraint value at the optimal solution.ObjectiveValueAtLowerLimitis the objective value at the optimal solution.ObjectiveValueAtUpperLimitis the objective value at the optimal solution.ObjectiveValueChangeRateis0.
Version History
Introduced in R2026a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)