開始使用免費開始

成衣生產:多重流程與模組化

你受託為位在義大利米蘭(時尚之都)的一家成衣工廠建置離散事件模型,以協助進行最佳化。

你相當興奮,並希望打造一個實用且可擴充的模型。你也知道成衣產業十分複雜,牽涉許多流程與資源,而你仍在熟悉當中。

你做了功課,整理出下表這份流程清單。你很謹慎,為每個流程都建立了獨立函式,讓模型具備模組化,並能以可控方式持續擴充。

現在你收到主管的回饋,被要求在模型中加入一個新流程「Spot cleaning and laundry(局部去汙與洗滌)」,這個流程應該放在步驟 8 與 9 之間(請見表格中紅色標註的列)。套件 random 與 simpy 已匯入。

Table with process names, respective functions, and information about whether the process has been incorporated in the model.

本練習屬於課程

Python 的離散事件模擬

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Create a function for the new process
def ____(gen_type=None, gauss_mean=None, gauss_std=None, unif_start=None, unif_end=None):
  if gen_type == "gauss":
    duration = random.gauss(gauss_mean, gauss_std)
  elif gen_type == "uniform":
    duration = random.uniform(unif_start, unif_end)
  return duration

def all_processes(env, prod_line):

  with prod_line.request() as request:
    yield request

    t1 = fabric_relaxing(gen_type="gauss", gauss_mean=2*60, gauss_std=15)
    t2 = spread_form_layout(gen_type="gauss", gauss_mean=6, gauss_std=1)
    t3 = laying_paper_pattern(gen_type="uniform", unif_start=3, unif_end=0.5)
    t4 = marking(gen_type="gauss", gauss_mean=6, gauss_std=1)
    t5 = cutting(gen_type="gauss", gauss_mean=5, gauss_std=0.5)
    t6 = embroidery_screen_and_printing(gen_type="uniform", unif_start=10, unif_end=2)
    t7 = sewing(gen_type="gauss", gauss_mean=15, gauss_std=3)
    t8 = checking(gen_type="gauss", gauss_mean=2, gauss_std=0.5)

    # Add the new process
    tnew = ____

    # Account for the new process duration in the entire process duration
    total_duration = sum([t1, t2, t3, t4, t5, t6, t7, t8, ____, t9, t10])

    yield env.timeout(total_duration)
編輯並執行程式碼