16
Lecture 8 Engineering Problem 1

Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Embed Size (px)

Citation preview

Page 1: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Lecture 8 Engineering Problem 1

Page 2: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

2

Learning Objectives

Experience in engineering problems solved with MATLAB

Lecture Topics

•Inventory Problem

•Advanced Inventory Problem

Page 3: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Motivation of Inventory ProblemTo survive in retailing business, an important

aspect is to keep the cost within a manageable level.

To solve an inventory problem is to figure out how to minimize the cost of the production, i.e., the way to manage the inventory.

In this case, figure out how many pieces of materials to buy each time ? and how many times to buy ?

……such that you have enough products to sale without costing too much to store them in your inventory warehouse.

3

Page 4: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Structure of Production costThe total production cost [TC] in a given

period consists of (i) the material cost [MC] (ii) the transportation cost (iii) ordering cost [OC] , and (iv) the inventory cost or the holding cost for that period of time [HC].

TC = MC + TC + OC + HC

4

Page 5: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Notes to Production cost Total cost [TC] is the sum of all the costs.Material cost [MC ] is the cost of the materials your

company needs. Usually, it is a constant in a given period of time.

Ordering cost [OC] is the cost that pays for each time you order. More often you order, more it OC is.

Transportation cost always goes with each order. So, often OC already includes the transportation cost.

Holding cost [OC] in a given period is average cost to hold the inventory.

5

Page 6: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Example1: Inventory ProblemA lamp retailer has to stock lamps in his inventory.

Each time he makes an order, there are 3 costs he has to pay. communication cost (60 baht/time) with the

supplierstransfer cost (400 baht/time) of the order lot.maintenance cost (10 baht/piece/year) of the

product lying in his garage. The retailer wants to make a good business by

minimize the 3 costs so that he will get a better profit. We are trying to write a program to help him out.

Page 7: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

TimTimee

Inventory Le Inventory Levelvel Average Average

amount of amount of hold hold

products per products per order timeorder time

(Q/2)(Q/2)

Order Order amount amount per timeper time(Q)(Q)

Amount of hold Amount of hold products in the products in the garagegarage

When no product is left, re-order once again. When no product is left, re-order once again. Assume customers of this retail gradually buy Assume customers of this retail gradually buy the lamp in a linear fashion. the lamp in a linear fashion.

Page 8: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Order Quantity Order Quantity/time/time

Annual Cost Annual Cost

Holding Cost Curve

Holding Cost Curve

Total Cost Curve

Total Cost Curve

Ordering Ordering Cost Curve Cost Curve

Optimal Order Quantity (Q Optimal Order Quantity (Q*)*)

Annual DemandAnnual Demand(D)(D)

11

Page 9: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Example1 : Inventory ProblemIf the retailer orders the lamps from suppliers N times a year, and assume there is a demand of lamp (D) he has to stock in the garage 1000 piece/year.

Write a program to find the optimal amount of ordering times (N) and the optimal amount of ordered lamps in each time.

Communication cost 60 baht/time

Transfer cost 400 baht/time

Maintenance (Holding) cost

10 baht/piece/year

year

baht*

year

time*

time

bahtcoscoscos

NSOC

Nttransfer tion communicatt ordering

year

baht

2*

year

piece *

piece

bathcoscos

QHAHC

pieceholidingaveragetholding t holding annual

Page 10: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Example1 : Inventory ProblemGoal: Find the optimal value of N and Q.

Q

DN

per timeproduct order ofamount

demandproduct annual

year

baht

2*cos

QHAHCt holding annual

year

baht*cos NSOCt ordering

2**

2**

cos cos cos

QH

Q

DS

QHNS

AHCOCTC

t holding annualtorderingttotal

Page 11: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Example1 : Inventory ProblemSimulation

Order QuantityOrder Quantity

Annual CostAnnual Cost

Holding Cost Curve

Holding Cost Curve

Total Cost Curve

Total Cost Curve

Order (Setup) Cost CurveOrder (Setup) Cost Curve

Optimal Optimal Order Quantity (QOrder Quantity (Q**))

From the graph we see that the total cost varies according to the order quantity. The best order quantity (Q*) is the one which lowers the total cost curve to the global minimum point. Goal: find the minimum of total cost

How can we find the OOQ?Simulate it with Trail and Error approach. We know the minimum order quantity we can order is 1, the maximum is D. So we vary our order quantity from 1:D and search for the minimum TC.

Page 12: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Example1 : Inventory Problem#include <stdio.h>void main(){ float N,Q,M,O,H,MC,OC,HC,TC,D,Qo,No,TCo,MCo, OCo, HCo; int i; TCo = 1000000; printf("Input demand of material (unit/year): "); scanf("%f", &D); printf("Input material cost (baht/unit): "); scanf("%f", &M); printf("Input ordering cost (baht/order): "); scanf("%f", &O); printf("Input holding cost (baht/unit/year): "); scanf("%f", &H); for ( i=1 ; i<=D ; i++ ){ Q = i; N = D/Q; MC = Q*N*M; OC = N*O; HC = Q/2.*H; TC = MC+OC+HC; if (TC < TCo){ Qo = i; //Qo is best # of pieces of materials for each order No = D/i; //No is the # of orders TCo = TC;//TCo is the optimal cost MCo = Qo*No*M; // Material cost OCo = No*O; // ordering cost HCo = Qo/2*H; // Holding cost } } printf("The best quantity is: %.2f kg/order \n",Qo); printf("Number of order is: %.2f order/month \n",No); printf("Total Cost is: %.0f baht/month \n",TCo); printf("\t Total material cost is: %.2f baht/year\n",MCo); printf("\t Total ordering cost is: %.2f baht/year\n",OCo); printf("\t Total holding cost is: %.2f baht/year\n",HCo); }

Page 13: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

Example 2 : Advanced Inventory ProblemIf the suppliers do not sell lamp in pieces but

packages to the retailer. For example, a package contains of 12 pieces.

Update your program to find the optimal order package quantity. How?From the last example, we can compute the optimal Q

we should order in each time. Now we want to compute the optimal number of packages (B) where B = Q/12

If Q can be divided by 12 perfectly (remainder is zero, e.g. Q = 60), then we the best B = Q/12

If the remainder of Q/12 is not equal to zero (e.g. Q=56; B = 4.66 we can order either 4 or 5 packages). We compute the cost of those 2 choices and compare to find the minimum.

Page 14: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

#include <stdio.h>#include <math.h>void main(){ float N,Q,M,O,H,MC,OC,HC,TC,TC_prev,D,Qo,No,Tco,LN,LTC,UN,UTC; int i,Lbox,LQ,Ubox,UQ; printf("Input demand of material (unit/year): "); scanf("%f", &D); printf("Input material cost (baht/unit): "); scanf("%f", &M); printf("Input ordering cost (baht/order): "); scanf("%f", &O); printf("Input holding cost (baht/unit/year): "); scanf("%f", &H); for ( i=1 ; i<=D ; i++ ){ Q = i; N = D/Q; MC = Q*N*M; OC = N*O; HC = Q/2*H; TC = MC+OC+HC; if (i>1 && TC > TC_prev){ Qo = i-1; if (Qo%12 == 0) { No = D/(i-1); TCo = TC_prev; MCo = Qo*No*M; OCo = No*O; HCo = Qo/2*H;}}

Page 15: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

15

else { //Check for Lower case first LBox = floor(Qo/12.); LQ = 12*LBox; LN = D/LQ; LTC = (LQ*LN*M)+(LN*O)+(LQ/2.*H); //Then Check for the upper case UBox = ceil(Qo/12.); UQ = 12*UBox; UN = D/UQ; UTC = (UQ*UN*M)+(UN*O)+(UQ/2.*H); ///Compare the lower and the upper cases // if lower case is lower if (LTC < UTC){ Qo = LQ; Box = LBox; No = LN; TCo = LTC; MCo = LQ*LN*M; OCo = LN*O; HCo = LQ/2*H;}

Page 16: Lecture 8 Engineering Problem 1. Outline 2 Learning Objectives Experience in engineering problems solved with MATLAB Lecture Topics Inventory Problem

16

else{ Qo = UQ; Box = UBox; No = UN; TCo = UTC; MCo = UQ*UN*M; OCo = UN*O; HCo = UQ/2*H; } } break; } TC_prev=TC; } printf("The best quantity is: %.2f units/order or %d boxes/order \n",Qo,Box); printf("Number of order is: %.2f orders/year \n",No); printf("Total Cost is: %.2f baht/year \n",TCo); printf("\t Total material cost is: %.2f baht/year\n",MCo); printf("\t Total ordering cost is: %.2f baht/year\n",OCo); printf("\t Total holding cost is: %.2f baht/year\n",HCo);}