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.    
Cost to make products      
  Product 1 Product 2 Product 3  
Factory 1 $4 $5 $3  
Factory 2 $2 $8 $6  
   
  Product 1 Product 2 Product 3 Cost
Factory 1 0 0 0 $0
Factory 2 0 0 0 $0
      Total Cost $0
Cost of shipping ($ per product)        
  Destinations  
  Warehouse 1 Warehouse 2 Warehouse 3 Warehouse 4  
Factory 1 Product 1 $0.50 $0.50 $1.00 $0.20  
  Product 2 $1.00 $0.75 $1.25 $1.25  
  Product 3 $0.75 $1.25 $1.00 $0.80  
Factory 2 Product 1 $1.50 $0.30 $0.50 $0.20  
  Product 2 $1.25 $0.80 $1.00 $0.75  
  Product 3 $1.40 $0.90 $0.95 $1.10  
   
  Customer 1 Customer 2 Customer 3 Customer 4 Customer 5
Factory 1 Product 1 $2.75 $3.50 $2.50 $3.00 $2.50
  Product 2 $2.50 $3.00 $2.00 $2.75 $2.60
  Product 3 $2.90 $3.00 $2.25 $2.80 $2.35
Factory 2 Product 1 $3.00 $3.50 $3.50 $2.50 $2.00
  Product 2 $2.25 $2.95 $2.20 $2.50 $2.10
  Product 3 $2.45 $2.75 $2.35 $2.85 $2.45
   
  Customer 1 Customer 2 Customer 3 Customer 4 Customer 5
Warehouse 1 Product 1 $1.50 $0.80 $0.50 $1.50 $3.00
  Product 2 $1.00 $0.90 $1.20 $1.30 $2.10
  Product 3 $1.25 $0.70 $1.10 $0.80 $1.60
Warehouse 2 Product 1 $1.00 $0.50 $0.50 $1.00 $0.50
  Product 2 $1.25 $1.00 $1.00 $0.90 $1.50
  Product 3 $1.10 $1.10 $0.90 $1.40 $1.75
Warehouse 3 Product 1 $1.00 $1.50 $2.00 $2.00 $0.50
  Product 2 $0.90 $1.35 $1.45 $1.80 $1.00
  Product 3 $1.25 $1.20 $1.75 $1.70 $0.85
Warehouse 4 Product 1 $2.50 $1.50 $0.60 $1.50 $0.50
  Product 2 $1.75 $1.30 $0.70 $1.25 $1.10
  Product 3 $1.50 $1.10 $1.50 $1.10 $0.90
Number of products shipped          
  Warehouse 1 Warehouse 2 Warehouse 3 Warehouse 4 Total  
Factory 1 Product 1 0 0 0 0 0  
  Product 2 0 0 0 0 0  
  Product 3 0 0 0 0 0  
Factory 2 Product 1 0 0 0 0 0  
  Product 2 0 0 0 0 0  
  Product 3 0 0 0 0 0  
Total Product 1 0 0 0 0  
  Product 2 0 0 0 0  
  Product 3 0 0 0 0  
Capacity Product 1 35,000 20,000 30,000 15,000  
  Product 2 30,000 25,000 15,000 24,000  
  Product 3 20,000 20,000 25,000 20,000  
   
  Customer 1 Customer 2 Customer 3 Customer 4 Customer 5 Total
Factory 1 Product 1 0 0 0 0 0 0
  Product 2 0 0 0 0 0 0
  Product 3 0 0 0 0 0 0
Factory 2 Product 1 0 0 0 0 0 0
  Product 2 0 0 0 0 0 0
  Product 3 0 0 0 0 0 0
   
  Capacity
  Total products shipped out of factory 1 Product 1 0 0
  Product 2 0 0
  Product 3 0 0
  Total products shipped out of factory 2 Product 1 0 0
  Product 2 0 0
  Product 3 0 0
   
  Customer 1 Customer 2 Customer 3 Customer 4 Customer 5 Total
Warehouse 1 Product 1 0 0 0 0 0 0
  Product 2 0 0 0 0 0 0
  Product 3 0 0 0 0 0 0
Warehouse 2 Product 1 0 0 0 0 0 0
  Product 2 0 0 0 0 0 0
  Product 3 0 0 0 0 0 0
Warehouse 3 Product 1 0 0 0 0 0 0
  Product 2 0 0 0 0 0 0
  Product 3 0 0 0 0 0 0
Warehouse 4 Product 1 0 0 0 0 0 0
  Product 2 0 0 0 0 0 0
  Product 3 0 0 0 0 0 0
Total Product 1 0 0 0 0 0  
  Product 2 0 0 0 0 0  
  Product 3 0 0 0 0 0  
Demands Product 1 30,000 23,000 15,000 32,000 16,000  
  Product 2 20,000 15,000 22,000 12,000 18,000  
  Product 3 25,000 22,000 16,000 20,000 25,000  
   
Total cost of shipping $0  
Total cost of production $0  
  Total Cost $0          
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.