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 pm5 a5
6 pm6 a6


Sample Output: (Vary based on your input)
Mobiles should be produced in the order: 2, 5, 6, 1, 4, 3.
Total production time for all mobiles is: 28
Idle Time of Assembly unit: 2

Question:

Which algorithmnto use?

Whats time complexity?

How to calculate Total production time for all mobiles, Idle Time of Assembly unit?

Note: You can assume any value for pm5, a6 etc. Output value shown above is just example.

Solutions

Expert Solution


Well for Algorithms. All the cases exits i.e; best case, average case and the worst case.
Algorithms mainly depends on the input. The best suitable technique here which I think is Shortest Job First (SJF) depending upon their Parts Manufacturing Time. It will minimize the production cost.
It can be any case depending upon the input.

Greedy Algorithm
TIme Coplexity is O(n)2

Code :

from array import *


def Order():
mobiles = int(input("Enter the total number of Phones you want to Produce: "))
pmi = array('i')
ai = array('i')
pmicopy = array('i')
  
# Taking Input
  
for x in range(mobiles):
x = int(input("Enter the Parts Manufacturing Time for the Mobile{} ".format(x+1)))
pmi.append(x)
pmicopy = pmi.__copy__()
for y in range(mobiles):
y = int(input("Enter the Assembly Time for the Mobile{} ".format(x+1)))
ai.append(y)
  
# Sorting
  
for i in range(len(pmi) - 1):
if pmi[i] > pmi[i + 1]:
pmi[i], pmi[i + 1] = pmi[i + 1], pmi[i]
for i in range(len(ai) - 1):
if ai[i] > ai[i + 1]:
ai[i], ai[i + 1] = ai[i + 1], ai[i]
  
# Calculating IDLE Time
  
aitime = 0
idletime = pmi[0]
fidle = pmi[0]
for j in range(len(pmi)):
k = pmi[i]
dec = aitime - k
if dec > 0:
fidle = idletime + dec
e = sum(ai)
print(e)
production = e + fidle # Production Time
print("Idle Time of Assembly Unit is: ", fidle)

print("Mobiles Phones should be produced in the order: ")
for l in range(len(pmi)):
ind = pmicopy.index(pmi[l])
print(ind+1)
print("Production Cost is: ", production)


Order()

COMMENT DOWN FOR ANY QUERIES AND,

LEAVE A THUMBS UP IF THIS ANSWER HELPS YOU.


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....
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 $2,300 $18,600 (e) Total manufacturing costs incurred during August 15,200 (c) 108,800 Total manufacturing costs (a) $217,600 $118,100 Work in process inventory, August 31 3,300 45,700 (f) Cost of goods manufactured (b) (d) $99,200
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 $2,100 $17,600 (e) Total manufacturing costs incurred during August 14,100 (c) 103,000 Total manufacturing costs (a) $205,900 $111,800 Work in process inventory, August 31 3,100 43,200 (f) Cost of goods manufactured (b) (d) $93,900 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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT