Professional Documents
Culture Documents
Session 7
Session 7
Session 7
4 subject to:
4x1 + 5x2 < 20
10x1 + 7x2 < 35
3 3x1 + 4x2 > 6
x1, x2 > 0 {non-negativity}
2
FEASIBLE
1 REGION
0 1 2 3 4 5
Basics Produced
XPs produced Basics=x1
6 XPs=x2
4 subject to:
x1 = 1.59 4x1 + 5x2 < 20
x2 = 2.73 10x1 + 7x2 < 35
3 3x1 + 4x2 > 6
x1, x2 > 0 {non-negativity}
2
FEASIBLE
1 REGION
0 1 2 3 4 5
Basics Produced
XPs produced Basics=x1
6 XPs=x2
0 1 2 3 4 5
Basics Produced
Basics=x1
Advertising
6 XPs=x2
4 subject to:
x1 = 1.59 4x1 + 5x2 < 20
x2 = 2.73 LP Relaxation: Gives the 10x1 + 7x2 < 35
3 3x1 + 4x2 > 6
Profit = 28.65 upper bound of the
x1, x2 > 0 AND INTEGER
2 integer optimal solution (ALL INTEGER PROBLEM)
0 1 2 3 4 5
Basics Produced
XPs produced Basics=x1
6 XPs=x2
5
ROUNDING
4 UP
3
In Minimization IP, rounding up
2 gives a feasible solution
1
ROUNDING
DOWN 0 1 2 3 4 5
Basics Produced
• The solution procedure used by Solver is called branch and bound.
• Consider a model with 100 changing cells, all constrained to be binary. Because there
are only two values for each binary variable - 0 and 1 - there are potentially 2100
feasible solutions, although many of these might not satisfy all of the constraints.
• Unfortunately, 2100 is an extremely large number, so it would take even a very fast
computer a long time to check each one of them. Therefore, the naive method of
complete enumeration of all possible solutions - look at each solution and select the
best - is usually impractical.
• However, implicit enumeration is often very practical. This approach
examines only a fraction of all 2100 potential solutions and guarantees that
solutions not examined have no chance of being optimal.
• A general idea is the essence of the branch and bound method used by
Solver in IP models.
• The branching part means that the algorithm systematically searches through the set
of all feasible integer solutions, creating branches, or subsets, of solutions as it goes.
• The key, however, is the bounding part of the algorithm. Every time the best feasible
solution is found, it is called the incumbent solution – the best so far. It is the easy part
of the bounding procedure, and the solution represents a lower bound on the optimal
solution (for a maximize objective).
• The upper bound is more difficult to find, and the procedures used to find upper bounds
are beyond the level of this course.
• The Solver Options dialog box
contains a Tolerance setting,
which is relevant for integer-
constrained models.
• Excel’s default tolerance is 1%
or 5%. In Excel 2010, this
setting, listed as Integer
Optimality (%), is found under
Solver Options in the dialog box
shown here.
• The Tolerance option, relates to the LP relaxation of an IP model.
• This is the same model as the IP model, except that all integer constraints
are omitted.
• In particular, cells that are originally constrained to be binary are allowed under
the LP relaxation to have any fractional values between 0 and 1 (including 0 and 1).
• The LP relaxation is typically easy to solve (using the simplex method), and
it provides a bound for the IP model.
• A tolerance setting of 5% means that Solver stops as soon as it finds a
feasible (integer) solution to the IP model that is within 5% of the
current upper bound.
• Initially, the optimal objective value of the LP relaxation serves as the
upper bound. As Solver proceeds to find solutions that satisfy the
integer constraints, it keeps updating the upper bound.
• The important point is that when Solver stops, it guarantees an integer
solution that is within at least 5% of the optimal integer solution.
• The implication is that if you set the tolerance to 0%, Solver will (in theory)
run until it finds the optimal integer solution. So why isn’t a tolerance setting
of 0% always used?
• The reason is that for many IP models, especially large models, it can take
Solver a long time to find the optimal solution (or guarantee that the best
solution found so far is optimal).
• On the other hand, a solution that is close to optimal - within 5%, say - can
often be found quickly.
• When you run Solver on some of the difficult problems, you might get
different messages, shown below.
Budget constraint
Amount invested Budget
$14,500 <= $15,000
Objective to maximize
Total NPV $46,000
Using Solver
• We want to maximize the
total NPV, subject to staying
within the budget.
• However, we also need to
constrain the changing cells to
be 0-1.
• With the Solver this is simple,
as shown in the dialog box
here.
Using Solver
• We add a constraint with Investments in the
left box and choose the “bin” option in the
middle box.
• The “binary” in the right box is added
automatically.
• Note that if all changing cells are binary, we
do not need to check Solver’s Assume Non-
Negative option, but we should still choose
the Simplex LP method if the model is linear,
as it is here.
The Solution
• The optimal solution that was shown indicates that Tatham can obtain a
maximum NPV of $46,000 by selecting investments 1, 2, and 5.
• These three investments use up only $14,500 of the available budget, with
$500 left over. However, this $500 is not enough – investing all the way is
required – to invest in any of the remaining investments.
• If we rank Tatham’s investments on the basis of NPV per dollar invested, the
ranking from best to worst is 4, 1, 2, 5, 3, 6, 7.
• Using your economic intuition, you might expect the investments to be chosen
in this order, until the budget runs out.
• However, the optimal solution does not do this. It selects the 2nd , 3rd and 4th
best investments but ignores the best.
The Solution
• To understand why this is the case, suppose Tatham invests in the three
highest-ranking investments: 4, 1, and 2.
• This uses up $13,500 of the budget, with $1500 left over and unusable. This
strategy provides an NPV of $43,500.
• The optimal solution gains you an addition $2,500 NPV.
Oneway analysis for Solver model in Model worksheet Sensitivity of Total_NPV
Sensitivity Analysis Budget (cell $D$14) values along side, output cell(s) along top Data for chart
Investment_levels_1
Investment_levels_2
Investment_levels_3
Investment_levels_4
Investment_levels_5
Investment_levels_6
Investment_levels_7
Amount_invested
input cell, allow it to vary from $15,000
Total_NPV
Total_NPV
to $25,000 in increments of $1000, and 9
Budget ($D$14)
Oneway analysis for Solver model in Model worksheet Sensitivity of Total_NPV
Budget (cell $D$14) values along side, output cell(s) along top Data for chart
Sensitivity Analysis
Investment_levels_1
Investment_levels_2
Investment_levels_3
Investment_levels_4
Investment_levels_5
Investment_levels_6
Investment_levels_7
Amount_invested
• Note also how selected
Total_NPV
Total_NPV
investments vary wildly as the $15,000 1 1 0 0 1 0 0 $14,500 $46,000
9
46000
Budget ($D$14)
Oneway analysis for Solver model in Model worksheet Sensitivity of Total_NPV to Budge
Budget (cell $D$14) values along side, output cell(s) along top Data for chart
Investment_levels_1
Investment_levels_2
Investment_levels_3
Investment_levels_4
Investment_levels_5
Investment_levels_6
Investment_levels_7
dropdown l
Amount_invested
will adapt to
Total_NPV
Total_NPV
9
Solver Tolerance setting, $15,000
$16,000
1
0
1
1
0
0
0
1
1
1
0
0
0
0
$14,500
$15,500
$46,000
$49,500
46000
49500
Budget ($D$14)
• Sensitivity Analysis
• The latter figure uses Solver’s default tolerance, whereas the former uses a
tolerance of 0%.
• The three shaded cells in the figure on the previous slide indicate lower NPV
than the corresponding cells in the figure for 0% tolerance setting.
• This is because in these three settings, Solver stopped short of finding the
true optimal solutions because it found solutions within the 5% tolerance
and then quit.
• In many situations, a cost is incurred if an activity is undertaken at any positive level. This
cost is independent of the level of the activity and is known as a fixed cost (or fixed
charge).
• Here are three examples of fixed costs:
• The construction of a warehouse incurs a fixed cost that is the same whether the warehouse is
built with a low- or a high-capacity level.
• A cash withdrawal from a bank incurs a fixed cost, independent of the size of the withdrawal.
• A machine that is used to produce several products must be set up for the production of each
product. Regardless of the batch size produced, the same fixed cost (lost production due to the
setup time) is incurred.
• In these examples, a fixed cost is incurred if an activity is undertaken at any positive level,
whereas no fixed cost is incurred if the activity is not undertaken at all.
• Although it might not be obvious, this feature makes the problem inherently nonlinear,
which means that a straightforward application of LP is not possible.
• However, a clever use of 0–1 variables can result in a model with linear constraints and a
linear objective.
• It is important to realize that you do not simply create an LP model and then add
integer constraints.
• Instead, you use 0-1 variable to model the logic.
• The logic in this section is that if a certain activity is done on any positive level, a fixed
cost is incurred.
• No fixed cost is incurred if the activity is not done at all.
• Solver is able to handle linear models with binary variables, so this is the approach you
should take whenever possible.
• The Great Threads Company is capable of manufacturing shirts, shorts, pants, skirts, and jackets.
• Each type of clothing requires that Great Threads have the appropriate type of machinery available.
• The machinery needed to manufacture each type of clothing must be rented at the following rates.
Each type of clothing requires the amounts of cloth and labor given in the following table. This table
also shows the unit variable cost and selling price for each type of clothing.
Rental Cost Labor Hours Cloth (sq yd) Selling Price Unit Variable Cost
Shirts $1500 2.0 3.0 $35 $20
Shorts $1200 1.0 2.5 $40 $10
Pants $1600 6.0 4.0 $65 $25
Skirts $1500 4.0 4.5 $70 $30
Jackets $1600 8.0 5.5 $110 $35
• There are 4000 hours and 4500 square yards of cloth available in a given week.
• Objective: The company wants to find a solution that maximizes its weekly profit.
Variables and Constraints
• The cost of producing x shirts during a week is 0 if x=0, but it is 1500+20x if x>0.
• The cost structure violates the proportionality assumption that is needed for a linear model.
• If proportionality were satisfied, then the cost of making, say, 10 shirts would be double the cost of
making 5 shirts. However, because of the fixed cost, the total cost of making 5 shirts is $1600, and
the cost of making 10 shirts is only $1700. This violation of proportionality requires us to resort 0-1
variables to obtain a linear model.
Input Variables Fixed rental costs. Resource availabilities (labor, cloth) per unit, selling prices, unit variable
costs
Decision Variables (Changing Cells) Whether to produce (binary), how much to produce any of each type of clothing
Objective Cell Profit
Other Calculated Variables Resources used, upper limits on amounts to produce, total revenue, total variable cost,
total fixed cost
Constraints Amounts produced ≤ Logical upper limit (capacity)
Resources used ≤ Resources available
Developing the model
• To model the Great Threads problem, we need to keep track of the following:
• Number of shirts, shorts, pants, skirts, and jackets produced
• 0-1 variable for each type of clothing that indicates whether any of that type of clothing
is produced
• Resource usage of labor and cloth
• Total profit, which equals revenue from sales minus the cost of renting machines minus
the variable cost of producing clothing
• We must also ensure that if any of a given type of clothing is produced, then its 0-1 variable
equals 1.
Developing the model
To formulate the model, follow these steps:
1. Inputs. Enter the given inputs in the blue ranges.
2. Binary values for clothing types. Enter any trial values for the 0-1 variables for the various
clothing types in the Units_produced range.
3. Production quantities. Enter any trial values for the numbers of the various clothing types
produced in the Units_produced range.
4. Labor and cloth used. In cell B22 enter the formula =SUMPRODUCT(B5:F5, Units_produced).
Then copy this to cell B23 to calculate the amount of cloth used.
5. Effective capacities. We need to ensure that if any of the given type of clothing is produced,
then its 0-1 variable equals 1. This ensures that the model incurs the cost of renting a machine
for this type of clothing. Excel’s Solver is unable to deal with IF Functions accurately. Therefore,
we instead model the fixed cost constraint as follows:
Shirts produced Maximum capacity X (0-1 variable for shirts). Of course, there are similar
inequalities for other clothings.
Developing the model
The logic behind inequality:
• If the 0-1 variable for shirts is 0, then the right side of the inequality is 0, which means that the left
side must be 0 – no shirts can be produced. That is, if the 0-1 variable for shirts is 0, so that no
fixed cost for shirts is incurred, then the inequality does not allow Great Threads to “cheat” and
produce a positive number of shirts.
• On the other hand, if the 0-1 variable for shirts is 1, then the inequality is certainly true. It simply
says that the number of shirts produced must be no greater than the maximum number that can
be produced.
• The inequality rules out the one case we want to rule out, namely, that Great Threads produces
shirts but avoids the fixed cost. However, it will allow the 0-1 variable to be 1 even if Great Threads
plans to produce no shirts.
Developing the model
To implement the inequality, we need an upper limit on the number of shirts that could be
produced. To obtain this, observe that the number of shirts that could be produced is
limited by the smaller of
𝐴𝑣𝑎𝑖𝑙𝑎𝑏𝑙𝑒 𝐿𝑎𝑏𝑜𝑟 𝐻𝑜𝑢𝑟𝑠
𝐿𝑎𝑏𝑜𝑟 ℎ𝑜𝑢𝑟𝑠 𝑝𝑒𝑟 𝑠ℎ𝑖𝑟𝑡
and
𝐴𝑣𝑎𝑖𝑙𝑎𝑏𝑙𝑒 𝑠𝑞𝑢𝑎𝑟𝑒 𝑦𝑎𝑟𝑑𝑠 𝑜𝑓 𝑐𝑙𝑜𝑡ℎ
𝑆𝑞𝑢𝑎𝑟𝑒 𝑦𝑎𝑟𝑑𝑠 𝑜𝑓 𝑐𝑙𝑜𝑡ℎ 𝑝𝑒𝑟 𝑠ℎ𝑖𝑟𝑡
Therefore, the smaller of these can be used as the maximum needed in the inequality. So, in
cell B18, calculate the “effective capacity” for shirts with the formula
=B14*MIN($D$22/B5,$D$23/B6). Then copy this formula to the range C18:F18 for the
other types of clothes.
Developing the model
6. Monetary values. Calculate the total sales revenue and the total variable cost
by entering the formula =SUMPRODUCT(B8:D8,Units_produced) in cell B26 and
copying it to cell B27. Then calculate the total fixed cost in the cell B28 with the
formula =SUMPRODUCT(B10:F10,Rent_equipment). Note that this formula
picks up the fixed costs only for those products with 0-1 variables equal to 1.
Finally, calculate the total profit in the Profit cell with the formula =B26-B27-
B28.
Great Threads fixed cost clothing model Range names used:
Effective_capacity =Model!$B$18:$F$18
Developing the Input data on products
Shirts Shorts Pants Skirts Jackets
Rent_equipment
Profit
=Model!$B$14:$F$14
=Model!$B$29
model Labor hours/unit
Cloth (sq. yd.)/unit
2
3
1
2.5
6
4
4
4.5
8
5.5
Resource_available
Resource_used
=Model!$D$22:$D$23
=Model!$B$22:$B$23
Units_produced =Model!$B$16:$F$16
Selling price/unit $35 $40 $65 $70 $110
Variable cost/unit $20 $10 $25 $30 $35
Fixed cost for equipment $1,500 $1,200 $1,600 $1,500 $1,600
Constraints on resources
Resource used Available
Labor hours 4000.00 <= 4000
Cloth 4500.00 <= 4500
Monetary outputs
Revenue $80,345
Variable cost $22,931
Fixed cost for equipment $2,800
Profit $54,614 Objective to maximize
Using Solver
• We maximize the profit, subject to not using
more hours or cloth than is available, and
we ensure that production is no greater
than effective capacity.
• The key is that this effective capacity is 0 if
we decide not to produce any of a given
product.
• Also, make sure to check the Assume Linear
Model and Assume Non-Negative boxes
under Solver options, and set the tolerance
to 0%.
The Solution
• From the optimal solution shown before, we see that Great Threads should produce about
966 shorts and 379 jackets, but no shirts, pants or skirts.
• The total profit is $54,614. Note that the 0-1 variables for shirts, pants, and skirts are 0,
which forces production of these products to be 0.
• However, the 0-1 variable for shorts and jackets, the products that is produced is 1. This
ensures that the fixed cost of producing shirts is included in the total cost.
• It may be helpful to think of this solution as occurring in two stages.
• In the first stage the Solver determines which products to produce – in this case, shorts and
jackets only.
• Then in the second stage, the Solver specifies how many shorts and jackets to produce.
The Solution
• Of course, these two stages are interrelated, and the Solver considers both of
them in its solution process.
• The Great Threads management might not be very excited about being a shorts
and jackets only shop.
• Suppose the company wants to ensure that at least three types of clothing are
produced at positive levels.
• One approach is to add another constraint, namely, that the sum of the 0-1
values in row 14 is greater than or equal to 3.
• You can check, however, that when this constraint is added and the Solver is
rerun, the 0-1 variable for skirts becomes 1, but no skirts are produced.
The Solution
• Shorts and jackets are more profitable than skirts, so only shorts and jackets are
produced.
• The new constraint forces Great Threads to rent an extra piece of machinery,
but it doesn’t force the company to use it.
• To force the company to produce some shirts, we would also need to add a
constraint on the value in E16, such as E16>=100.
• Any of these additional constraints will cost Great Threads money, but if they
want to produce more than two types of clothing, this is their only option.
Sensitivity Analysis
• Because the optimal solution currently calls for only shorts and jackets to be
produced, an interesting sensitivity analysis is to see how much “incentive” is
required for other products to be produced.
• One way to check this is to increase the sales prices for a nonproduced product
such as skirts in a one-way Solver Table.
Oneway analysis for Solver model in Model worksheet Sensitivity of Profit to Selling price skirts
Selling price skirts (cell $E$8) values along side, output cell(s) along top Data for chart
Sensitivity Analysis
Rent_Equipment_1
Rent_Equipment_2
Rent_Equipment_3
Rent_Equipment_4
Rent_Equipment_5
When you select an
dropdown list in cell
will adapt to that ou
Profit
Profit
6
60000
30000
10000
0
$70 $75 $80 $85 $90 $95 $100
Selling price skirts ($E$8)
• A model with IF functions
• In case you are doubtful if binary variable approach is required, and you think
IF functions could be used instead, prepare a new model with the following
changes:
• The resulting model will look the same, but it incorporates the following
changes:
• We no longer use the binary range as part of the changing cells range. Instead, we enter
the formula =IF(B16>0,1,0) in cell B14 and copy it across to cell F14.
• We model the effective capacities in row 18 with IF functions. Specifically, we enter the
formula =IF(B16>0,MIN($D$22/B5,$D$23/B6),0) in cell B18 and copy it across to cell F18.
• A model with IF functions
• Change the Solver dialog box so
that it appears as shown below.
The Rent_equipment range is not
part of the changing cells range,
and there is no binary constraint.
• A model with IF functions
• What do you find?