开始使用免费开始使用

服装生产:多工序与模块化

您受托为位于意大利米兰(时尚之都)的一家服装工厂创建一个离散事件模型,以帮助优化生产。

您非常兴奋,并希望构建一个有用且可扩展的模型。您知道服装行业十分复杂,涉及许多工序和资源,您仍在逐步熟悉中。

经过调研,您整理出下表所示的工序列表。为实现模型的模块化并让其可控扩展,您细致地为每个工序都创建了独立函数。

现在,您收到了经理的反馈,需要在模型中加入一个新工序,用于处理 "Spot cleaning and laundry"(局部去渍与洗涤),该工序应位于第 8 步与第 9 步之间(参见表格中红色高亮行)。包 randomsimpy 已导入。

包含工序名称、对应函数,以及该工序是否已纳入模型的信息的表格。

本练习是课程的一部分

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)
编辑并运行代码