始める無料で始める

衣料品生産:多工程とモジュール化

イタリアのミラノ(ファッションの都)にある衣料品工場の最適化を支援するため、離散事象モデルの作成を依頼されました。

衣料品産業は多くの工程とリソースが絡む複雑な世界で、まだ学ぶことも多いと分かっているからこそ、役立ち、かつスケール可能なモデルを作りたいと意気込んでいます。

調査の結果、下の表にある工程一覧をまとめました。モデルをモジュール化し、安定的に拡張できるよう、各工程ごとに個別の関数を丁寧に作成しました。

ここでマネージャーからフィードバックがあり、モデルに新たな工程「Spot cleaning and laundry(部分洗浄とランドリー)」を追加するよう指示がありました。これは工程の8と9の間に入れてください(表の赤でハイライトされた行を参照)。パッケージ randomsimpy はインポート済みです。

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)
コードを編集して実行