Distribution Examples
Distribution Examples
On each example worksheet, read the comments at the bottom of the sheet, then
click Tools Solver... to examine the decision variables, constraints, and objective.
To find the optimal solution, click the Solve button.
An important group of Solver applications is based on distribution or network models.
The amount of money that companies save each year by applying linear programming
towards their distribution problems is enormous.
In this series we will look at a simple transportation problem in worksheet Transport1, then
extend it to a 2-level multi-product model in worksheets Transport2 and Transport3.
In the Facility worksheet we will look at a facility location problem, where a company has
to decide if it's profitable to close down one or more of their plants and save overall costs.
Problem
A company wants to minimize the cost of shipping a product from 2 different factories to 5 different customers.
Each factory has a limited supply and each customer a certain demand. How should the company distribute the
product?
Solution
1) The variables are the number of products to ship from each factory to the customers. These are given the
name Products_shipped in worksheet Transport1.
2) The logical constraint is
Products_shipped >= 0 via the Assume Non-Negative option
The other two constraints are
Total_received >= Demand
Total_shipped <= Capacity
3) The objective is to minimize cost. This is given the name Total_cost.
Remarks
This is a transportation problem in its simplest form. Still, this type of model is widely used to save many
thousands of dollars each year.
In worksheet Transport2 we will consider a 2-level transportation, and in worksheet Transport3 we expand this to
a multi-product, 2-level transportation problem.
Transportation Problem 2 (2-stage-transport)
Minimize the costs of shipping goods from factories to warehouses and customers, and
warehouses to customers, while not exceeding the supply available from each factory or
the capacity of each warehouse, and meeting the demand from each customer.
Problem
A company has 2 factories, 4 warehouses and 5 customers. It wants to minimize the cost of shipping its
product from the factories to the warehouses, the factories to the customers, and the warehouses to the
customers. The number of products received by a warehouse from the factory should be the same as the
number of products leaving the warehouse to the customers. How should the company distribute the products?
Solution
1) The variables are the number of products to ship from the factories to the warehouses, the factories to the
customers, and the warehouses to the customers. These are defined in worksheet Transport2 as
Factory_to_warehouse, Factory_to_customer, Warehouse_customer.
2) The logical constraints are all defined via the Assume Non-Negative option:
Factory_to_warehouse >= 0
Factory_to_customer >= 0
Warehouse_customer >= 0
The other constraints are
Total_from_factory <= Factory_capacity
Total_to_customer >= Demand
Total_to_warehouse <= Warehouse_capacity
Total_to_warehouse = Total_from_warehouse
3) The objective is to minimize cost, given by Total_cost.
Remarks
Please note that the last constraint must be an '=' , because otherwise products would start piling up at the
warehouse. It would be possible to make this a multi-period model where storage at the warehouses would be
possible and even desired, if transportation prices would fluctuate during the different time periods. In
worksheet Transport3 we will look at a multi-product situation.
Transportation Problem 3 (2-stage-transport, multi-commodity)
Minimize the costs of shipping 3 different goods from factories to warehouses and customers, and
warehouses to customers, while not exceeding the supply available from each factory or
the capacity of each warehouse, and meeting the demand from each customer.
Capacity
Total products shipped out of factory 1 Product 1 0 90,000
Product 2 0 100,000
Product 3 0 80,000
Total products shipped out of factory 2 Product 1 0 75,000
Product 2 0 65,000
Product 3 0 90,000
Problem
This model builds on model Transport2. Again, a company wants to minimize cost of shipping, but this time
there are 3 products to distribute. How should the company distribute the products?
Solution
The solution to the problem is identical to the one in Transport2. Notice that we have used the 'Insert Name
Define' command to extend the model to a multiproduct problem. This way the variables and constraints are
still the same as in Transport2.
Remarks
Notice that this model delivers the same result as three separate models for the three products. There will be
times however, that there are constraints that apply to more than one product. In that case it would not be
desirable to have three different models and maybe even impossible. For an extension of this model, where the
number of products made in the factories depends on the demand and distribution rather than being constant,
see the worksheet Prodtran in this workbook.
0
0
0
0
0
0
0
0
0
0
0
0
Partial Loading (Knapsack Problem)
A fuel truck with 4 compartments needs to supply 3 different types of gas to a customer.
When demand is not filled, the company loses $0.25 per gallon that is not delivered.
How should the truck be loaded to minimize loss?
Truck Specifications
Comp. 1 Comp. 2 Comp. 3 Comp. 4
Size (gallons) 1200 800 1300 700
Loading of Compartments (1=yes, 0=no)
Comp. 1 Comp. 2 Comp. 3 Comp. 4
Gas 1 0 0 0 0
Gas 2 0 0 0 0
Gas 3 0 0 0 0
Total 0 0 0 0
Amount (gallons)
Comp. 1 Comp. 2 Comp. 3 Comp. 4 Total Demand Loss
Gas 1 0 0 0 0 0 1800 $450.00
Gas 2 0 0 0 0 0 1500 $375.00
Gas 3 0 0 0 0 0 1000 $250.00
Total Loss $1,075.00
Maximum Amount (gallons)
Comp. 1 Comp. 2 Comp. 3 Comp. 4
Gas 1 0 0 0 0
Gas 2 0 0 0 0
Gas 3 0 0 0 0
Problem
A fuel truck needs to supply 3 different kinds of gas to a customer. When demand is not filled the company
loses $0.25 per gallon that is not delivered. The truck has 4 separate compartments of different size. How
should the truck be loaded to minimize loss?
Solution
1) The variables are the decisions to fill the compartments for each type of gas, and the amounts to be put in
if the compartment is filled. In worksheet Knapsack, these are given the name Gallons_loaded and
Loading_decisions.
2) The logical constraints are
Gallons_loaded >= 0 via the Assume Non-Negative option
Loading_decisions = binary
Since there can only be one kind of gas in any compartment we have
Total_decisions <= 1
The size limitations of the truck give
Gallons_loaded <= Maximum_gallons
We don't want to load more than needed. This gives
Total_gallons <= Demand
3) The objective is to minimize the loss. This is given the name Total_loss.
Remarks
It is often possible to have different objectives in these types of problems. We might, for instance, want to
minimize the wasted space in the truck in this example. Knapsack problems are characterized by a series of
0-1 integer variables with a single capacity constraint. If someone goes camping and his backpack can hold
only a certain amount of weight, what items should the camper bring? He should try to optimize the value
of the items while not exceeding the weight allowed by the backpack. There is a wide set of problems that
fall into this category.
Facility Location
A company currently ships its product from 5 plants to 4 warehouses. It is considering closing
one or more plants to reduce cost. What plant(s) should the company close, in order to
minimize transportation and fixed costs?
Problem
A company currently ships products from 5 plants to 4 warehouses. The company is considering the option of
closing down one or more plants. This would increase distribution cost but perhaps lower overall cost. What
plants, if any, should the company close?
Solution
1) The variables are the decisions to open or close the plants, and the number of products that should be
shipped from the plants that are open to the warehouses. In worksheet Facility these are given the names
Open_or_close and Products_shipped.
2) The logical constraints are
Products_shipped >= 0 via the Assume Non-Negative option
Open_or_close = binary
The products made can not exceed the capacity of the plants and the number shipped should meet the
demand. This gives
Products_made <= Capacity
Total_shipped >= Demand
3) The objective is to minimize cost. This is given the name Total_cost on the worksheet.
Remarks
It is often possible to increase the capacity of a plant. This could be worked into the model with additional 0-1
or binary integer variables. The Solver would find out if it would be profitable to extend the capacity of a plant.
It could also be interesting to see if it would be profitable to open another warehouse. An example of this can
be found, in somewhat modified form, in the capacity planning model in the Finance Examples workbook.
Production Transportation Problem (2-stage-transport, multi-commodity)
Minimize the costs of producing 3 different goods, and shipping them from factories to warehouses and
customers, and warehouses to customers, while not exceeding the supply available from each factory or
the capacity of each warehouse, and meeting the demand from each customer.
Problem
A company wants to minimize the cost of shipping three different products from factories to warehouses and customers
and from warehouses to customers. The production of each product at each plant depends on the distribution. How many
products should each factory produce and how should the products be distributed in order to minimize total cost while
meeting demand?
Solution
Notice that this is an extension of the transportation model as seen in the Transport3 worksheet. This time the factories do
not produce a fixed amount. The amounts produced are now variables.
1) The variables are the number of products to make in the factories, the number of products to ship from factories to
warehouses, factories to customers, and warehouses to customers. In worksheet Prodtran these are given the names
Products_made, Factory_to_warehouse, Factory_to_customer, and Warehouse_to_customer.
2) The logical constraints are all defined via the Assume Non-Negative option:
Products_made >= 0
Factory_to_warehouse >= 0
Factory_to_customer >= 0
Warehouse_to_customer >= 0
The other constraints are
Total_from_factory <= Factory_capacity
Total_to_customer >= Demand
Total_to_warehouse <= Warehouse_capacity
Total_to_warehouse = Total_from_warehouse
3) The objective is to minimize cost. This is defined in the worksheet as Total_cost.
Remarks
This is one of the more complex models in this series of examples. If the number of products, factories and warehouses
becomes large, the number of variables in a model like this one becomes very large. Also bear in mind the degree of
coordination between business units that may be needed in order to implement the optimal solution. For these reasons,
some users prefer to split problems like this one into a set of smaller, simpler models.
Total
0
0
0
0
0
0
Capacity
0
0
0
0
0
0
Total
0
0
0
0
0
0
0
0
0
0
0
0
Plants Capacity DC no.
Cost Of Shipping
Plant SKU 1 SKU 2 SKU 3 SKU 4 SKU 5 Capacity
Bhatinda 1200 40
Goa 1950 65
Haridwar 2250 75
Mysore 1650 55
Baddi 1350 45
Dummy capacity 645
Requiremen 2105 3719 2656 425 140 9045
SR. No 1 2 3 4 5 6
DC Aslali Bangalore Bhiwandi Chennai Cochin Cuttack
SKU 1 70 50 300 70 20 15
SKU 2 200 150 380 150 75 100
SKU 3 175 150 450 75 20 100
SKU 4 25 25 70 15 5 20
SKU 5 10 7 20 5 2 5
7 8 9 10 11 12 13 14 15
Goa Guwahati Hasangarh Hyderabad Indore Jaipur Jammu Kochi Kolkata
15 125 300 5 40 75 75 10 75
20 50 450 125 100 275 75 50 120
10 25 300 150 75 125 10 10 260
2 5 50 20 10 20 2 2 40
1 2 15 10 5 5 1 1 10
February March April May June July August September October
16 17 18 19 20 21 22 26 27
16 17 18 19 20 21 22 23 24
Lucknow Modinagar Nagpur Patna Payal Raipur Ranchi Rishikesh Salem
110 150 40 35 210 20 35 100 75
240 250 100 70 300 50 70 70 150
100 125 30 60 140 30 75 20 50
15 20 5 10 20 5 10 5 10
5 5 2 4 5 2 4 1 5
Total
25 26 27
Silchar Siliguri Vijayawada Total
20 50 15 2105
20 30 49 3719
10 25 56 2656
4 5 5 425
1 2 5 140
Cost Of Shipping
Plant SKU 1 SKU 2 SKU 3 SKU 4 SKU 5 Capacity
40
Bhatinda 1200
Goa 1950 65
Haridwar 2250 75
Mysore 1650 55
Baddi 1350 45
2105 3719 2656 425 140
SKU 4 SKU 5
25 10
25 7
70 20
15 5
5 2
20 5
2 1
5 2
50 15
20 10
10 5
20 5
2 1
2 1
40 10
15 5
20 5
5 2
10 4
20 5
5 2
10 4
5 1
10 5
4 1
5 2
5 5
425 140
425 140
Baddi
Y
Y
Y
N
N
45
SKU 1 SKU 2 SKU 3 SKU 4 SKU 5 Total Capacity
Jan-21 2000 3500 2500 410 8410 8680
Feb-21 1850 3238 2313 370 7771 7840
Mar-21 1900 3325 2375 380 7980 8680
Apr-21 2000 3500 2500 400 8400 8400
May-21 1975 3456 2469 395 8295 8680
Jun-21 2100 3675 2625 420 8820 8400
Jul-21 2000 3500 2500 400 8400 8680
Aug-21 2150 3763 2688 430 9031 8680
Sep-21 1950 3413 2438 390 8191 8400
Oct-21 2000 3500 2500 400 8400 8680
Nov-21 2050 3588 2563 410 15 8626 8400
Dec-21 1750 3063 2188 350 30 7381 8680
Jan-22 2155 3771 2694 431 50 9101 8680
Feb-22 1950 3413 2438 390 100 8291 8400
Mar-22 2000 3500 2500 400 110 8510 8680
Apr-22 2125 3719 2656 425 140 9065 8400
May-22 2075 3631 2594 415 160 8875 8680
Jun-22 2225 3894 2781 445 150 9495 8400
Surplus/Deficiet
270
69
700
0
385
-420
280
-351
209
280
-226
1299
-421
109
170
-665
-195
-1095