如何在ILOG CPLEX中查看目标函数敏感性分析及确定最优解不变的单位利润范围
First, let's recap your OPL model for clarity:
dvar float+ x; /* daily quantity of t-shirts*/ dvar float+ y; /* daily quantity of shorts */ maximize 6*x + 10*y; /* maximize the daily profit from t-shirts and shorts*/ subject to{ 20/60*x + 10/60*y <=176; /* cutting department labour constraint*/ 20/60*x + 50/60*y <=400; /* sewing department labour constraint*/ 10/60*x + 10/60*y <= 96; /* packaging department labour constraint*/ x >= 100; /* minimum daily demand for t-shirts*/ }
Part 1: Manual Calculation of Optimal Coefficient Ranges
First, solving your LP gives the optimal solution: x=160 t-shirts, y=416 shorts. At this point, the sewing and packaging constraints are binding (they hit their maximum limits), while the cutting constraint has unused capacity and the minimum t-shirt demand is exceeded.
For this optimal solution to stay unchanged (i.e., we keep producing 160 t-shirts and 416 shorts), the unit profit coefficients need to stay within a range where the current binding constraints still define the maximum profit point. Here's how to calculate those ranges:
Range for T-shirt Unit Profit (c_x, originally 6)
- If we decrease
c_xtoo much, the optimal solution switches to producing the minimum required t-shirts (100) and more shorts (440). Setting the profit of both points equal gives us the lower bound:c_x = 4. - If we increase
c_xtoo much, the optimal solution switches to producing more t-shirts (480) and fewer shorts (96). Setting profits equal here gives us the upper bound:c_x ≈ 8.67(or exactly 26/3).
So the valid range for c_x is [4, 8.67].
Range for Shorts Unit Profit (c_y, originally 10)
- If we decrease
c_ytoo much, the optimal solution switches to producing more t-shirts (480) and fewer shorts (96). Setting profits equal gives the lower bound:c_y =6. - If we increase
c_ytoo much, the optimal solution switches to producing the minimum t-shirts (100) and more shorts (440). Setting profits equal here gives the upper bound:c_y≈10.27(or exactly 113/11).
So the valid range for c_y is [6, 10.27].
Part 2: Viewing Sensitivity Analysis in ILOG CPLEX Optimization Studio
You don't have to calculate these ranges manually—CPLEX can generate them for you directly. Here's how:
Step 1: Enable Sensitivity Analysis in Run Configurations
- Click the dropdown next to the green Run button and select Edit to open the run configuration.
- Navigate to the CPLEX tab in the configuration window.
- Under the Solution section, check the box labeled Sensitivity analysis (you can choose to include both variable and constraint sensitivity data).
- Click Apply then re-run your model.
Step 2: Access the Results
Once the model solves again, you can view the sensitivity data in two places:
- Output Tab: Look for a section titled Objective Coefficient Ranges—it will list each variable's current coefficient, allowable increase/decrease, and the full valid range.
- Solution Explorer: Expand the Solution node, then go to Sensitivity → Objective Coefficients to see a formatted table with the ranges for
xandy.
Example CPLEX Output
You’ll see results matching our manual calculation:
Variable x: Current coefficient: 6.0 Allowable increase: 2.6667 (to 8.6667) Allowable decrease: 2.0 (to 4.0) Variable y: Current coefficient:10.0 Allowable increase:0.2727 (to10.2727) Allowable decrease:4.0 (to6.0)
内容的提问来源于stack exchange,提问作者Charuka Deshan




