Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yuu-ito/a72dc0a2b45ed51c952bddc4984d390d to your computer and use it in GitHub Desktop.
Save yuu-ito/a72dc0a2b45ed51c952bddc4984d390d to your computer and use it in GitHub Desktop.
コーヒーの注文待ちをシミュレーションしてみた http://techlog.voyagegroup.com/entry/advent2016
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# コーヒーの注文待ちをシミュレーションしてみた\n",
"\n",
"これは [VOYAGE GROUP Advent Canlendar 2016](http://techlog.voyagegroup.com/entry/advent2016) の3日目のエントリです。\n",
"\n",
"こんにちは、最近RよりもPythonを書いてお仕事している yuu-ito です。\n",
"\n",
"弊社ではバリスタさんが美味しいコーヒーを淹れてくれる「ガーデン」というサービスがあるのですが、\n",
"\n",
"オススメです。もし弊社に商談などで寄る際はぜひ注文してみてください。\n",
"\n",
"https://www.instagram.com/officecafe_garden/\n",
"\n",
"今回は最近業務で使い始めたPythonでコーヒーの注文待ちのシミュレーションしてみます。\n",
"\n",
"Python シミュレーションフレームワークである[SimPy](http://simpy.readthedocs.io/en/latest/)を使って実装します。\n",
"\n",
"コードはこの記事を読んでわかる通り[Jupyter](http://jupyter.org/)で以下に書いていきます。\n",
"\n",
"(Jupyter notebookって本当に便利ですよね!)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"import pandas as pd\n",
"import numpy as np\n",
"import simpy\n",
"\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"STATE_FILE = \"./state.csv\"\n",
"def log_state(m):\n",
" # 実行結果をファイルに追記\n",
" with open(STATE_FILE,\"a\") as f:\n",
" f.write(m+\"\\n\")\n",
"\n",
"def get_state_results():\n",
" return pd.read_csv(STATE_FILE)\n",
"\n",
"def reset_state():\n",
" # ファイルのクリア\n",
" with open(STATE_FILE,\"w\") as f:\n",
" f.write(\"name,time,state\\n\")\n",
"\n",
"class Person(object):\n",
" def __init__(self, env, name, freq, coffee_garden):\n",
" self.env = env\n",
" self.name = name\n",
" self.freq = freq\n",
" self.coffee_garden = coffee_garden\n",
"\n",
" def needs_coffee(self):\n",
" # 一定の確率でコーヒーが飲みたくなる\n",
" if np.random.randint(SIM_SIZE) <= self.freq:\n",
" log_state(\"%s,%d,コーヒー飲みたい!\" % (self.name, self.env.now))\n",
" return True\n",
" else:\n",
" log_state(\"%s,%d,仕事しよ...\" % (self.name, self.env.now))\n",
" return False\n",
"\n",
" def run(self):\n",
" # シミュレータが実行するメソッド。毎ループごとにコーヒーを飲みにいくか判断する\n",
" while True:\n",
" if self.needs_coffee():\n",
" with self.coffee_garden.request() as req:\n",
" yield req\n",
" yield self.env.timeout(1) # コーヒーを淹れる時間\n",
" log_state(\"%s,%d,おいしかった!!\" % (self.name, self.env.now))\n",
" yield self.env.timeout(1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"ざっとコード貼ってしまいましたが、\n",
"\n",
"\n",
"大事なとこは **Personクラス** でもつ **env** 変数と **run()** メソッドです。\n",
"\n",
"このあとメインとなるシミュレーションの実行処理を書くのですが、その処理(process)が\n",
"\n",
"上の **Personクラス** のオブジェクトから **run()** メソッドを実行するように設定します。\n",
"\n",
"- http://simpy.readthedocs.io/en/latest/simpy_intro/process_interaction.html\n",
"\n",
"以下がシミュレータの準備のコードになります。"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"SIM_SIZE = 10 # ループを回す回数\n",
"FREQ = 1 # Personがコーヒーを飲みに行きたくなる頻度\n",
"NUM_OF_PEOPLE = 5 # Personの人数\n",
"\n",
"# simpy のEnvironmentオブジェクトを生成\n",
"env = simpy.Environment()\n",
"\n",
"# コーヒースタンドオブジェクトの生成\n",
"coffee_garden = simpy.Resource(env, 2)\n",
"\n",
"# Personオブジェクトを生成。runメソッドをプロセスとして設定\n",
"for name in [\"person_%03d\" % i for i in np.arange(0,NUM_OF_PEOPLE,1)]:\n",
" env.process(Person(env, name, FREQ, coffee_garden).run())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"SimPy 特有の処理の書き方ですが、\n",
"\n",
"複数のプロセス(今回だと**Personオブジェクト**)が共有するモノに対して処理を行う場合、\n",
"\n",
"またそのモノに容量の制限があるオブジェクトを用意したいときは[simpy.Resource](http://simpy.readthedocs.io/en/latest/simpy_intro/shared_resources.html)オブジェクトを利用します。\n",
"\n",
"今回だとバリスタさんとコーヒースタンドの場所がそれにあたります。"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"それでは実際に実行してみましょう。"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"reset_state()\n",
"env.run(until=SIM_SIZE)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"csvファイルが吐かれているはずです。読み込んでデータを可視化してみましょう。"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>name</th>\n",
" <th>time</th>\n",
" <th>state</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>person_000</td>\n",
" <td>0</td>\n",
" <td>仕事しよ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>person_001</td>\n",
" <td>0</td>\n",
" <td>仕事しよ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>person_002</td>\n",
" <td>0</td>\n",
" <td>コーヒー飲みたい!</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>person_003</td>\n",
" <td>0</td>\n",
" <td>コーヒー飲みたい!</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>person_004</td>\n",
" <td>0</td>\n",
" <td>コーヒー飲みたい!</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" name time state\n",
"0 person_000 0 仕事しよ...\n",
"1 person_001 0 仕事しよ...\n",
"2 person_002 0 コーヒー飲みたい!\n",
"3 person_003 0 コーヒー飲みたい!\n",
"4 person_004 0 コーヒー飲みたい!"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dat = get_state_results()\n",
"dat.head()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th>name</th>\n",
" <th>person_000</th>\n",
" <th>person_001</th>\n",
" <th>person_002</th>\n",
" <th>person_003</th>\n",
" <th>person_004</th>\n",
" </tr>\n",
" <tr>\n",
" <th>time</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" <td>コーヒー飲みたい!</td>\n",
" <td>コーヒー飲みたい!</td>\n",
" <td>コーヒー飲みたい!</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" <td>おいしかった!!</td>\n",
" <td>おいしかった!!</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>コーヒー飲みたい!</td>\n",
" <td>コーヒー飲みたい!</td>\n",
" <td>コーヒー飲みたい!</td>\n",
" <td>仕事しよ...</td>\n",
" <td>おいしかった!!</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>おいしかった!!</td>\n",
" <td>おいしかった!!</td>\n",
" <td>None</td>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>コーヒー飲みたい!</td>\n",
" <td>コーヒー飲みたい!</td>\n",
" <td>おいしかった!!</td>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>おいしかった!!</td>\n",
" <td>おいしかった!!</td>\n",
" <td>仕事しよ...</td>\n",
" <td>コーヒー飲みたい!</td>\n",
" <td>仕事しよ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" <td>おいしかった!!</td>\n",
" <td>コーヒー飲みたい!</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>コーヒー飲みたい!</td>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" <td>おいしかった!!</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>おいしかった!!</td>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" <td>仕事しよ...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
"name person_000 person_001 person_002 person_003 person_004\n",
"time \n",
"0 仕事しよ... 仕事しよ... コーヒー飲みたい! コーヒー飲みたい! コーヒー飲みたい!\n",
"1 仕事しよ... 仕事しよ... おいしかった!! おいしかった!! None\n",
"2 コーヒー飲みたい! コーヒー飲みたい! コーヒー飲みたい! 仕事しよ... おいしかった!!\n",
"3 おいしかった!! おいしかった!! None 仕事しよ... 仕事しよ...\n",
"4 コーヒー飲みたい! コーヒー飲みたい! おいしかった!! 仕事しよ... 仕事しよ...\n",
"5 おいしかった!! おいしかった!! 仕事しよ... コーヒー飲みたい! 仕事しよ...\n",
"6 仕事しよ... 仕事しよ... 仕事しよ... おいしかった!! コーヒー飲みたい!\n",
"7 コーヒー飲みたい! 仕事しよ... 仕事しよ... 仕事しよ... おいしかった!!\n",
"8 おいしかった!! 仕事しよ... 仕事しよ... 仕事しよ... 仕事しよ...\n",
"9 仕事しよ... 仕事しよ... 仕事しよ... 仕事しよ... 仕事しよ..."
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# データフレームを整形して見やすく。\n",
"dat.pivot(\"time\",\"name\",\"state\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"意図通りに動いているぽいので、シミュレーションのシナリオを整理して設定してみます。"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## シミュレーション・シナリオ\n",
"\n",
"- 社内の就業時間(8時間)中に注文できる。\n",
"- 毎日行く人もいると思うけど社員全員ではないはず。1日 0〜2回のランダムで\n",
"- 社員数は300人。だいたい弊社こんなものだったはず。\n",
"- バリスタさんは3人常駐してくれている。\n",
"- 注文から淹れるのに3分ほど時間がかかるとする。\n",
"\n",
"1ループを1分としてシミュレーションを行うとすると、8時間=60分 x 8 = 480ループになります。\n",
"\n",
"バリスタさんも休憩したりで、全員がいない場合もあると思いますがとりあえず3人固定で。\n",
"\n",
"待ち人数については毎単位時間ごとに並んでる人をモニタリングする処理を追加します。"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# スタンドの前で待つ人のモニタリング\n",
"def monitor(resource, env):\n",
" while True:\n",
" # バリスタさんにコーヒーを淹れてもらっている人数\n",
" log_state(\"Brewing,%d,%d\" % (resource._env.now, resource.count))\n",
" # キャパ越えで待ってる人\n",
" log_state(\"Waiting,%d,%d\" % (resource._env.now, len(resource.queue)))\n",
" yield env.timeout(1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"それぞれのPersonの動きには注目するのは不要になったので、結果を返す処理は除いておきます。"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"class Person(object):\n",
" def __init__(self, env, name, freq, coffee_garden):\n",
" self.env = env\n",
" self.name = name\n",
" self.freq = freq\n",
" self.coffee_garden = coffee_garden\n",
"\n",
" def needs_coffee(self):\n",
" return np.random.randint(SIM_SIZE) < self.freq\n",
"\n",
" def run(self):\n",
" while True:\n",
" if self.needs_coffee():\n",
" with self.coffee_garden.request() as req:\n",
" yield req\n",
" yield self.env.timeout(COFFEE_TIME) # コーヒーを淹れる時間\n",
" yield self.env.timeout(1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"パラメタを再設定して改めてシミュレータを実行してみます。"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"SIM_SIZE = 60*8 # ループを回す回数\n",
"MAX_FREQ = 2 # Personがコーヒーを飲みに行きたくなる最大頻度\n",
"NUM_OF_PEOPLE = 300 # 人数\n",
"NUM_OF_BRISTA = 3 # バリスタさんの人数\n",
"COFFEE_TIME = 3 # コーヒーの淹れてくれる時間\n",
"\n",
"# 人ごとにコーヒーの飲みたくなる頻度を設定\n",
"def get_random_freq():\n",
" return np.random.randint(MAX_FREQ)\n",
"\n",
"# simpy のEnvironmentオブジェクトを生成\n",
"env = simpy.Environment()\n",
"\n",
"coffee_garden = simpy.Resource(env, NUM_OF_BRISTA)\n",
"\n",
"# Personオブジェクトを生成しrunメソッドをプロセスとして設定\n",
"for name in [\"person_%03d\" % i for i in np.arange(0,NUM_OF_PEOPLE,1)]:\n",
" env.process(Person(env, name, get_random_freq(), coffee_garden).run())\n",
"\n",
"# コーヒースタンドのモニタリング処理\n",
"env.process(monitor(coffee_garden, env))\n",
" \n",
"reset_state() \n",
"env.run(until=SIM_SIZE)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"やっとここからが本題です。(コードばかりで全く文章書いていないですが...!?\n",
"\n",
"1日のうちに待っている人数がどのくらいの頻度で起きていたのでしょう。\n",
"\n",
"ヒストグラムを見てみます。"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f373d02de50>"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhQAAAFoCAYAAAAPcmLCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAGfVJREFUeJzt3X+QZWV95/F3920Gx4HrTA3LDEbZRMGvgorUGJlJBLHG\nwC5Y/ohZFZNaiLsb+SFF4SqoqwViZZOQMEUCS0k0iZBas+UGjUaFYcGAhSK4CDoO8kU3mEFxhl8T\nekIGh77T+8e5Fy/t9Mzc83T36dv9flV1dd1znnPv9z7zzOlPP/c5p0cmJyeRJEkqMdp0AZIkafgZ\nKCRJUjEDhSRJKmagkCRJxQwUkiSpmIFCkiQVM1BIkqRiBgpJklTMQCFJkooZKCRJUrGxQRpHxIeA\ntwIvBXYC3wAuzMz7+9rcApzQd9gkcHVmnt3X5oXAJ4ATgR3AtcAHM3N3rXchSZIaNegMxfHAFcBx\nwBuAA4AbI2JpX5tJ4M+BVcBq4DDggt7OiBgFvkIVZtYCpwNnAJfUegeSJKlxA81QZOYp/Y8j4gzg\nYWANcFvfrn/NzEemeZqTqWY4Xp+ZjwKbIuKjwB9GxMWZOTFITZIkqXmlayiWU81IPD5l+29HxCMR\nsSki/vuUGYy1wKZumOjZCDwPOLqwHkmS1ICBZij6RcQIcDlwW2be27frfwL/BDwEvBK4FHgJ8Fvd\n/auBbVOeblvfvu/UrUmSJDWjdqAAr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
"source": [
"dat = get_state_results()\n",
"res = dat.pivot(\"time\",\"name\",\"state\")\n",
"res.Brewing.hist()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Brewing(コーヒーを淹れてもらっている状態)の人数が左から 0,1,2,3 となり\n",
"\n",
"一番右が、バリスタの方3人が同時にコーヒーを淹れている状態です。\n",
"\n",
"50に達していないので、1日(60x8=480)のうちの1割程度です。"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f373af7f890>"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhQAAAFoCAYAAAAPcmLCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAGYdJREFUeJzt3X2UZHV95/F3P8A4DDbMCWEGVogxylclLmFHyMxJQNyJ\nsAq7PrARTHYjEkx4kGOIDzysLgrrRpPjLBp04SRucPBo1gOLCirDghGPMCvsiDjh4avZPICSGYKM\nNE7QoWt6/7i3tShmmL71677V1bxf5/TpqXt/Vf2t71RXffpXv3trZHp6GkmSpBKjgy5AkiQNPwOF\nJEkqZqCQJEnFDBSSJKmYgUKSJBUzUEiSpGIGCkmSVMxAIUmSihkoJElSMQOFJEkqNt5kcERcDFzc\ns/n+zHxpvX8JsA44BVgCbADOzsyHu27jEOAK4DjgcWA9cEFm7uzzPkiSpAFrFChqfw2sBUbqy1Nd\n+y4DXg2cDEwCHwOuBY4BiIhR4EvAQ8Bq4GDgamAH8J4+apEkSQvASJMPB6tnKF6bmf9qF/smgH8C\nTs3M6+ptAdwHrM7MOyLi1cAXgIMy85F6zO8DHwR+PjOnem9XkiQtfP2soXhRRHw/Iv5fRHyqfgsD\nYBXVjMctMwMzM4EHgDX1ptXA5pkwUdsA7Acc3kctkiRpAWgaKP4PcBpwAnAm8IvA1yJiGbAS2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0GD19GFuIbiEaBD9Qmk\n3Q7k6QlqxpaG4/VU/fQcgIh4J9Unxq7NzHvmp7xFqWnPfwn4BeD6rvdERwHqv+IiM/9unmpdLPp5\nnP8jsKOepp9xH7AyIsYzc2ruy1xU+un5JcD6rrf17qkD9ZXAf5mXKrW719DJJn8kLrgZisx8kuoQ\nxLUz2+on0LVU763tysbu8bVX1du1B332nIh4F/CfgBMy8675rnMx6aPn9wEvozqK6Yj66wvAV+p/\nPzjPJQ+9Ph/ntwEv7NkWwD8aJvasz57vA+zs2bYTGJnlAkM1t6vX0ONp+Bq6EGcoANYBn4yITcAd\nVCtN9wGuAoiI9cD3MnPmfcyPALdGxB9SLdx5E9VCoLe2XPcwa9TziHg31V8Sb6JahT2Tbn+Umdtb\nrn1Yzbrn9V8J93ZfOSJ+CExn5n2tVj3cmj63/HfgbRHxEeBy4DDgQuCyluseZk17fj1wXkR8C/gG\n8CKq55rP98wUaTciYhlVEJ4JYC+IiCOARzPzwYj4I+DgzHxzvf8Kqsf5h4D/QRUu/j3VYthZW3Az\nFAD1+5TvoHoQ3QX8S6q/gv+pHvI8uhb0ZOZGqhe236M69vYNwGsz8ylPwNq9pj2neg95L6oTzjzU\n9fWOtmoedn30XIX6eG75HtVfakdRnT/hMuC/US1C1iz08Ti/lOq8FZcC91CdX+jLVGsqNDsvp+r1\nJqo1EB8Gvgm8v96/EjhkZnBm/j3Voby/QfUaeh7wu5nZaJH9yPS0gU+SJJVZkDMUkiRpuBgoJElS\nMQOFJEkqZqCQJEnFDBSSJKmYgUKSJBUzUEiSpGIGCkmSVMxAIUmSihkoJElSMQOFJEkq9v8BRcAa\nt4CLqH0AAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7f373d10cd10>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"res.Waiting.hist()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"次はWaiting(前に先約がいて待ちの状態)のヒストグラムです。\n",
"\n",
"待ち人数が1人である割合はごくごくわずかですね。基本的に待たずに注文ができているようです。\n",
"\n",
"**バリスタさん3人がいれば、弊社の社員数であればほぼ待たずにコーヒーを注文できるようです。いいね!**"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"ただ、このままだと実行する度に結果にばらつき起きるので\n",
"\n",
"複数回実行した結果から、**各待ち人数の発生するばらつき具合**も確認しておきます。"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from collections import Counter\n",
"\n",
"def get_hist_data(simulate_data):\n",
" # スタンド前での待ち人数を集計した結果を返す\n",
" d = simulate_data.pivot(\"time\",\"name\",\"state\")\n",
" return dict(Counter(d.Brewing)), dict(Counter(d.Waiting))\n",
"\n",
"def simulate():\n",
" i = 0\n",
" # 人ごとにコーヒーの飲みたくなる頻度を設定\n",
" def get_random_freq():\n",
" return np.random.randint(MAX_FREQ)\n",
"\n",
" SIM_SIZE = 60*8 # ループを回す回数\n",
" MAX_FREQ = 2 # Personがコーヒーを飲みに行きたくなる最大頻度\n",
" NUM_OF_PEOPLE = 300 # 人数\n",
" NUM_OF_BRISTA = 3 # バリスタさんの人数\n",
" COFFEE_TIME = 3 # コーヒーの淹れてくれる時間\n",
"\n",
" # simpy のEnvironmentオブジェクトを生成\n",
" env = simpy.Environment()\n",
" \n",
" coffee_garden = simpy.Resource(env, NUM_OF_BRISTA)\n",
" \n",
" # Personオブジェクトを生成しrunメソッドをプロセスとして設定\n",
" for name in [\"person_%03d\" % i for i in np.arange(0,NUM_OF_PEOPLE,1)]:\n",
" env.process(Person(env, name, get_random_freq(), coffee_garden).run())\n",
" \n",
" # コーヒースタンドのモニタリング処理\n",
" env.process(monitor(coffee_garden, env))\n",
" \n",
" reset_state() \n",
" env.run(until=SIM_SIZE)\n",
" return get_hist_data(get_state_results())"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"brew_stats = []\n",
"wait_stats = []\n",
"for i in np.arange(0,200,1):\n",
" b, w = simulate()\n",
" brew_stats.append(b)\n",
" wait_stats.append(w)"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f371d073510>"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgkAAAFoCAYAAADdImiaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzt3X2QXNV9p/Gnu2f0wkgtRoPQSyAIjH0wJPFSOFjULviF\nLGywE3B5129JxcS1CRjHcVxlG5NNCgfXrrOkTLkwUcBsNphUki0n3hi/gVyG2Ak2Ml6MHSSs42Aj\nUBAahpmJZjQjwah79o/bg4bhAN09c6d77jyfKlXX9D3d9zRHor/zu+ecW5qenkaSJGmucqc7IEmS\nupMhQZIkJRkSJElSkiFBkiQlGRIkSVKSIUGSJCUZEiRJUpIhQZIkJRkSJElSkiFBkiQl9bTSOIRw\nJfA+YGvjqd3AdTHGuxrHVwI3AO8AVgI7gKtijE/Neo+TgZuBNwDjwO3Ax2KM9fl8EEmStLBarSTs\nA64Gzmn8uQe4I4Tw6sbxTwNvBt4GXABsAb4w8+IQQhn4Glk42Qa8B7gcuK7tTyBJknJRmu8NnkII\nw8CHycLAEPDOGOPfN44F4EfAthjj/SGEXwa+BGyOMT7daHMF8MfAhhjj0Xl1RpIkLZi25ySEEMoh\nhHcCxwH3kVUWeoC7Z9rEGCPwOHBe46ltwEMzAaFhB7AOOKvdvkiSpIXXckgIIfxcCGEceAbYDrw1\nxrgH2AQ8G2Mcm/OSwcYxGo+DiePMaiNJkrpASxMXG/YArwGOJ5t7cHsI4YKXaF8Cmrmm0dJ1j+np\n6elSqdTKSyRJUqapL9CWQ0Jj3sBPGz9+P4RwLvBB4PPAihBCdU414USOVQsOAL845y03Nh7nV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hvB/4MLAJ+CHZPhLf62yv1I4QwvnAR8jufroZuCzG\n+KXO9krtCCFcA7wVOAM4TLZL7NUxxh93tGNqWwjhSuB9wNbGU7uB62KMd3WsU13CSkKXCiG8A/gU\ncC1wNllI2BFCOKGjHVO7+sg2DHs/Td7ETF3rfOAzwOuAXwJ6ga+HELwr0NK1D7iaLMSfA9wD3BFC\neHVHe9UF3EypS4UQdgLfjTF+sPFziewv8o0xxus72jnNSwihjpWEwmgE96eAC2KM93a6P1oYIYRh\n4MMxxr/odF86yUpCFwoh9JKl2btnnosxTgPfAM7rVL8kJR1PVh0a6XRHNH8hhHII4Z1k9xK6r9P9\n6TTnJHSnE4AKL7xt9iAQFr87klIaFb5PA/fGGB/udH/UvhDCz5GFglXAOPDWGOOezvaq86wkLC0l\nvJ4tdZPtwJnAOzvdEc3bHuA1ZHNN/gy4PYRwRme71HlWErrT00CN7O6Ys53IC6sLkjoghHATcAlw\nfozxyU73R/MTYzwK/LTx4/dDCOcCHyRb9bBsWUnoQjHGKeAB4MKZ5xplzQvJlltJ6qBGQLgUeGOM\n8fFO90e5KAMrO92JTrOS0L1uAD4XQngAuB/4ENlEmts62Sm1J4TQB5xOdskI4LQQwmuAkRjjvs71\nTK0KIWwH3gX8KjARQpip+B2MMR7pXM/UrhDCfwfuJFtBthb4NeD1wEWd7Fc3MCR0qRjj5xtLq64j\nu+zwA+CZ9IExAAAAiElEQVTiGONQZ3umNr0W+AeyOSXTZHtgAHwOeG+nOqW2XEk2ht+c8/xvArcv\nem+0EDaSjd1m4CDwz8BFMcZ7OtqrLuA+CZIkKck5CZIkKcmQIEmSkgwJkiQpyZAgSZKSDAmSJCnJ\nkCBJkpIMCZIkKcmQIEmSkgwJkiQpyZAgSZKSDAmSJCnp/wO4wM1FCKlVeQAAAABJRU5ErkJggg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7f371f80fe10>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"pd.DataFrame(brew_stats).fillna(0).boxplot()"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f3737889a50>"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgkAAAFoCAYAAADdImiaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAHIVJREFUeJzt3X2QZFWZ5/FvZjY0TUFWNw10w6CDbzwCjgyDYLEK6jLC\nKs6AS6zgOqFooIDIOsw6C7gYKIQzrBOyBCLRzKyx2LLqGhqK+NYsGOqKINgwLA30cXDkRZECupqu\ntvq1Kmv/uFlUUZx6yayXW2V+PxEV2XnvubdPPpFR+atzzz1ZGR4eRpIkabxq2R2QJEkLkyFBkiRl\nGRIkSVKWIUGSJGUZEiRJUpYhQZIkZRkSJElSliFBkiRlGRIkSVKWIUGSJGUtaaVxRFwOXD5u88aU\n0hHN/UuBq4EzgaXAOuDDKaWnx5zjJcAa4M3AVmAtcElKqdHma5AkSXOgpZDQtAE4Cag0nw+O2XcN\n8DbgDKAf+DzwDeAEgIioAt8DngR6gIOBLwG7gMva6IskSZojlVa+4Kk5knBaSunPMvvqwDPAWSml\nbza3BfAw0JNSujsi3gZ8GzgopfRss825wFXAASmlwfHnlSRJ5WhnTsKrIuK3EfGriLipefkA4BiK\nkYnbRxqmlBLwOHB8c1MP8MBIQGhaB3QDR7bRF0mSNEdaDQl3AWcDpwDnAS8DfhIRXcBqYFdKqX/c\nMb3NfTQfezP7GdNGkiQtAC3NSUgprRvzdENE3A08BrwL2DHBYRVgOtc0pn/dAxgeHh6uVCpTN5Qk\nSeNN6wO0nYmLz0spbYmIXwKvBG4D9oyI+rjRhAMZHS14Cjh23GlWNR/HjzBMqq9vgGq1vJBQq1Wp\n15fR37+doaHOvjHDWhSswyhrUbAOBeswaqHUYsWKrmm1m1FIiIh9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HAMcAKwfM1enBpwYER8BljYvUXaclNKWiPgl\n8Mqy+zLPfseL5+U8DPz7EvrSEi83tKj5l8F64KSRbc1fBCdR3PqmDtQMCKcBb0kpPV52fxaQKrC0\n7E7Ms9uAP6G43HBU8+cXFH8xHtWpAQGen8z5CooPzU5yBxDjtgWLYPKiIwntuRr4YkSsB+6muNth\nb+DGMjs135rXFV9JcakF4OURcRTQl1J6oryeza+IuB54N/CXwEBEjIwybUkp7SivZ/MrIj4NfJ/i\nVsh9gfcAb6K4BtsxUkoDwAvmo0TEALAppdRRd3lExD8At1B8GP4R8ClgEPhKmf0qwX8H7miumfE1\nitulz6G4PXZBcyShDSmlr1Hc43oFcB/wWuCUDrzN53UUr389xXyMzwL3Uvwi6CTnAXXgR8CTY37e\nVWKfyrAKWEsxL+E2imH3k53dD3TufKVDgC9TvCe+CjwD9KSUNpXaq3mWUvoFxYJr7wYeAP4r8NGU\n0ldL7dg0VIaHO/W9K0mSJuNIgiRJyjIkSJKkLEOCJEnKMiRIkqQsQ4IkScoyJEiSpCxDgiRJyjIk\nSJKkLEOCJEnKMiRIkqQsQ4IkScr6/y6SNmeCmvzbAAAAAElFTkSuQmCC\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7f371d7b7290>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"pd.DataFrame(wait_stats).fillna(0).boxplot()"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"Waitingのほうは横軸が5の位置まであるので、何度か6人待ちの状態が発生していたようです。\n",
"\n",
"それでも、待ち0の箱が最大値の480に集中しているので\n",
"\n",
"待つ事になるのはほとんど起きなさそうです。"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## まとめ\n",
"\n",
"- PythonのシミュレーションフレームワークSimPyを使ってコーヒー注文待ちのシミュレーションをしました。\n",
"\n",
"- 3人のバリスタさんがいれば弊社の規模感の客数ならうまく捌けていそう。\n",
"\n",
"**「お昼休み直後、おやつの時間はよりコーヒーを飲みたくなる」** とか \n",
"\n",
"**「たまに仲間を引き連れて注文しにくる」** みたいなシナリオを考えてみても良さそうです。\n",
"\n",
"それでは良い年末を。 明日のエントリもお楽しみに!"
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.12"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment