Question

In: Computer Science

There are N different models of mobiles manufactured at a mobile manufacturing unit. Each mobile must...

There are N different models of mobiles manufactured at a mobile manufacturing unit. Each mobile must go through 2 major phases: ‘parts manufacturing’ and ‘assembling’. Obviously, ‘parts manufacturing’ must happen before “assembling’. The time for ‘parts manufacturing’ and ‘assembling’ (pmi and ai for ith mobile) for every mobile may be different. If we have only 1 unit for ‘parts manufacturing’ and 1 unit for ‘assembling’, how should we produce n mobiles in a suitable order such that the total production time is minimized?
Requirements:
1. Write a Greedy Algorithm to select the mobile ‘parts manufacturing’ and ‘assembling’ in such a way that total production time is minimized.
2. Analyse the time complexity of your algorithm.
3. Implement the above problem statement using Python.

Input:
For example, now there are 6 different Mobiles in total. Time for each mobile ‘parts manufacturing’ and ‘assembling’ are given as shown:

Mobile i pmi (minutes) ai (minutes)
1 5 7
2 1 2
3 8 2
4 5 4
5 5 5
6 6 6

Solutions

Expert Solution

i have used a this pattern [mobile with least production time,(descending order of remaining production time)] then calculating total time by looking assembly time and waiting time.

for eg:

mobile m1 m2 m3

prdtn 20 40 60

asmbl 10 15 20

then production unit work in this order [m1,m3,m2]

and assembly unit also work in this order [m1,m3,m2]

total time =(wt=20)+(ass=10)+(wt=50)+(ass=20)+(wt=40)+(ass=15)

print("enter the no. of mobiles")
n=int(input())
pmi={}
a=[]
for i in range(0, n):
print("enter the production time of %dth mobile"%(i+1))
pmi[i]=int(input())
print("enter the assembly time time of %dth mobile"%(i+1))
a.append(int(input()))
print(a)
#storing the least production time
l=min(pmi.values())
#new dictionary which store the mobile with least time as first element
pmi1={list(pmi.keys())[list(pmi.values()).index(l)]:l}
#list of production time
val=list(pmi.values())
#sorting the list in descending order
val.sort(reverse=True)
#inserting into the new dictionary in descending order after the first element
for i in val:
if(i!=l):
pmi1[list(pmi.keys())[list(pmi.values()).index(i)]]=i
#new list of production time after arranging acc to algorithm   
val1=list(pmi1.values())
a1=[]
#changing the list assembly with respect mobile produced
for i in list(pmi1.keys()):
a1.append(a[i])
k=k+1
#time after each production are stored in a list
timl=[]
timl.append(val1[0])
for i in range(1,n):
timl.append(timl[i-1]+val1[i])
time=0
#calculating time which is production time + assembly time + waiting time
for i in range(0,n):
while(True):
if(time==timl[i]):
time=time+a1[i]
break
else:
time=time+(timl[i]-time)
print("time required for total production",time)


Related Solutions

There are N different models of mobiles manufactured at a mobile manufacturing unit. Each mobile must...
There are N different models of mobiles manufactured at a mobile manufacturing unit. Each mobile must go through 2 major phases: ‘parts manufacturing’ and ‘assembling’. Obviously, ‘parts manufacturing’ must happen before “assembling’. The time for ‘parts manufacturing’ and ‘assembling’ (pmi and ai for ith mobile) for every mobile may be different. If we have only 1 unit for ‘parts manufacturing’ and 1 unit for ‘assembling’, how should we produce n mobiles in a suitable order such that the total production...
Chosa Corp. manufactured 900 engines that were defective. The per unit manufacturing costs of the engines...
Chosa Corp. manufactured 900 engines that were defective. The per unit manufacturing costs of the engines were Direct Materials. 2,700 $/ unit DL. 1,900 $/u VMOH. 1,100 $/u fixed overhead. 3,600 $/u The engines normally sell for $15,700 each. the company can rework the engines, which will cost $1,400 per unit for direct materials , $2,100 per unit for direct labor and $950 per unit for variable manufactuing overhead alternatively the company could sell rhe engine “as is “ for...
Cost of Goods Manufactured for a Manufacturing Company Two items are omitted from each of the...
Cost of Goods Manufactured for a Manufacturing Company Two items are omitted from each of the following three lists of cost of goods manufactured statement data. Determine the amounts of the missing items, identifying them by letter. Work in process inventory, August 1$3,700 $31,500 (e) Total manufacturing costs incurred during August26,300 (c) 184,900 Total manufacturing costs(a) $368,600 $200,700 Work in process inventory, August 315,700 77,400 (f) Cost of goods manufactured(b) (d) $168,600 a.$ b.$ c.$ d.$ e.$ f.$
Cost of Goods Manufactured for a Manufacturing Company Two items are omitted from each of the...
Cost of Goods Manufactured for a Manufacturing Company Two items are omitted from each of the following three lists of cost of goods manufactured statement data. Determine the amounts of the missing items, identifying them by letter. Work in process inventory, August 1 $19,660 $41,650 (e) Total manufacturing costs incurred during August 332,750 (c) 1,075,000 Total manufacturing costs (a) $515,770 $1,240,000 Work in process inventory, August 31 23,500 54,000 (f) Cost of goods manufactured (b) (d) $1,068,000 a. $ b....
Golding Manufacturing, a division of Farnsworth Sporting, Inc., produces two different models of bows and eight...
Golding Manufacturing, a division of Farnsworth Sporting, Inc., produces two different models of bows and eight models of knives. The bow-manufacturing process involves the production of two major subassemblies: the limbs and the handle. The limbs pass through four sequential processes before reaching final assembly: lay-up, molding, fabricating, and finishing. In the Lay-Up Department, limbs are created by laminating layers of wood. In Molding, the limbs are heat treated, under pressure, to form a strong resilient limb. In the Fabricating...
Generate n = 100 observations from each of the three models. - ARMA (1,1) - ARMA...
Generate n = 100 observations from each of the three models. - ARMA (1,1) - ARMA (1,0) -ARMA (0,1) Compute the sample ACF for each model and compare it to the theoretical values. Compute the sample PACF for each of the generated series and compare the Sample ACFs and PACFs
Give three different friction models or equations and examples of when each is valid.
Give three different friction models or equations and examples of when each is valid.
In the first stage of manufacturing each final unit of a​ product, a firm purchases a...
In the first stage of manufacturing each final unit of a​ product, a firm purchases a key input at a price of ​$3 per unit. The firm then pays a wage rate of ​$5 for the time that labor is​ exerted, combining an additional ​$2 of inputs for each final unit of output produced. The firm sells every unit of the product for ​$12. What is the contribution of each unit of output to GDP in the current​ year? The...
Could the three levels of an organization—corporate, business unit, and functional unit—each have a different organizational...
Could the three levels of an organization—corporate, business unit, and functional unit—each have a different organizational structure? Why or why not?
Suppose that the birthdays of different people in a group of n people are independent, each...
Suppose that the birthdays of different people in a group of n people are independent, each equally likely to be on the 365 possible days. (Pretend there's no such thing as a leap day.) What's the smallest n so that it's more likely than not that someone among the n people has the same birthday as you? (You're not part of this group.)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT