メインコンテンツ

SensitivityAnalysis

Sensitivities of linear program coefficients

Since R2026a

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

expand all

Each property is a table containing the five columns shown below.

Column NameDescription
LowerLimitThe minimum value the model parameter can take without altering the current optimal basis
UpperLimitThe maximum value the model parameter can take without altering the current optimal basis
ObjectiveValueAtLowerLimitThe objective function value at the optimal solution if the model parameter was changed to LowerLimit
ObjectiveValueAtUpperLimitThe objective function value at the optimal solution if the model parameter was changed to UpperLimit
ObjectiveValueChangeRateThe 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

collapse all

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

expand all

Version History

Introduced in R2026a