{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Resource Constraint Project Scheduling Problem\n", "\n", "## 問題設定\n", "\n", "本章ではジョブショップスケジューリング問題 (JSSP) を一般化した、資源制約付きプロジェクトスケジューリング問題の定式化について扱います。\n", "英語の頭文字をとり RCPSP と呼ぶことにします。\n", "\n", "RCPSP は JSSP の Machine の概念を一般し、 Resource という概念を導入します。\n", "Job は複数種類の Resource を適当な個数使用することで処理されます。\n", "RCPSP は以下のように定義されます。\n", "\n", "1. m種類の Resource $R_1, R_2, \\dots, R_m$ にはそれぞれ、使用可能個数 $A_1, A_2, \\dots, A_m$ (Availabily) が定まっている。\n", "1. n種類の Job $J_1, J_2, \\dots\\ J_n$ にはそれぞれ、処理時間 $D_1, \\dots, D_n$ と要求する資源の個数 (Request) が定まっている。\n", " * Job $J_i$ は Resource $R_j$ を $N_{i, j}$ 個要求する。\n", "1. (順序制約) Job には順序関係 (Precedence relations) が定まっている。\n", " * Job $J_i$ は Job $J_{p_i(1)}, J_{p_i(2)}, \\dots, J_{p_i(n_i)}$ の処理が完了してからしか処理を開始できない。\n", "1. (資源制約) 同時に処理する Job の要求する資源の個数はその資源の使用可能個数以下でなければならない。\n", "1. このとき、与えられた評価尺度を最適にするような Job の開始時刻を求める。\n", " * 全ての Job が完了する時刻の最小化問題を解くことが多い。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## amplify_sched を用いた実装\n", "\n", "amplify_sched で RCPSP を解きます。\n", "PSPLIB から RCPSP の問題をダウンロードします。\n", "\n", "PSPLIB: https://www.om-db.wi.tum.de/psplib/main.html" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%%bash\n", "# Download rcpsp j30 data from PSPLIB.\n", "wget -q https://www.om-db.wi.tum.de/psplib/files/j30.sm.zip\n", "mkdir -p rcpsp/j30\n", "unzip -q -n j30.sm.zip -d rcpsp/j30" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "PSPLIB のパーサを実装します。パーサの実装は定式化とあまり関係がありませんので、スキップしても問題ありません。" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from collections import namedtuple\n", "from dataclasses import dataclass\n", "\n", "\n", "@dataclass\n", "class RCPSP:\n", " Pred = namedtuple(\"Pred\", [\"jobnr\", \"num_modes\", \"num_successors\", \"successors\"])\n", " ReqDur = namedtuple(\"ReqDur\", [\"jobnr\", \"mode\", \"duration\", \"request\"])\n", " Job = namedtuple(\"Job\", [\"num_modes\", \"successors\", \"duration\", \"request\"])\n", "\n", " # Base data\n", " base_data: str\n", " initial_value_random_generator: int\n", " # Overview\n", " projects: int\n", " jobs: int\n", " horizon: int\n", " renewable: int\n", " nonrenewable: int\n", " doubly_constrained: int\n", " # Project information\n", " pronr: int\n", " num_jobs: int\n", " rel_date: int\n", " due_date: int\n", " tard_cost: int\n", " mpm_time: int\n", " # Precedence relations\n", " pred_list: list\n", " # Request/Durations\n", " req_dur_list: list\n", " # Resource availabilities\n", " avail_list: list\n", "\n", " def get_job(self, jobnr: int) -> Job:\n", " for pred in self.pred_list:\n", " if pred.jobnr == jobnr:\n", " num_modes = pred.num_modes\n", " successors = pred.successors\n", " break\n", " duration = dict()\n", " request = dict()\n", " for req_dur in self.req_dur_list:\n", " if req_dur.jobnr == jobnr:\n", " # Ignore mode\n", " duration = req_dur.duration\n", " request = req_dur.request\n", " break\n", " return RCPSP.Job(num_modes, successors, duration, request)\n", "\n", " def get_jobs(self) -> dict:\n", " ret = dict()\n", " for i in range(1, 1 + self.jobs):\n", " ret[i] = self.get_job(i)\n", " return ret\n", "\n", "\n", "def parse_rcpsp_file(file_path) -> RCPSP:\n", " with open(file_path) as f:\n", " d = f.readlines()\n", " for i, line in enumerate(d):\n", " if line.startswith(\"file with basedata : \"):\n", " base_data = line[32:]\n", " if line.startswith(\"initial value random generator: \"):\n", " initial_value_random_generator = int(line[32:])\n", " if line.startswith(\"projects : \"):\n", " projects = int(line[32:])\n", " if line.startswith(\"jobs (incl. supersource/sink ): \"):\n", " jobs = int(line[32:])\n", " if line.startswith(\"horizon : \"):\n", " horizon = int(line[32:])\n", " if line.startswith(\" - renewable : \"):\n", " renewable = int(line[32:].split()[0])\n", " if line.startswith(\" - nonrenewable : \"):\n", " nonrenewable = int(line[32:].split()[0])\n", " if line.startswith(\" - doubly constrained : \"):\n", " doubly_constrained = int(line[32:].split()[0])\n", " if line.startswith(\"PROJECT INFORMATION:\"):\n", " pronr, num_jobs, rel_date, due_date, tard_cost, mpm_time = [int(x) for x in d[i + 2].split()]\n", " if line.startswith(\"PRECEDENCE RELATIONS:\"):\n", " pred_list = list()\n", " sum_modes = 0\n", " for j in range(i + 2, i + 2 + jobs):\n", " tmp = d[j].split()\n", " jobnr = int(tmp[0])\n", " num_modes = int(tmp[1])\n", " sum_modes += num_modes\n", " num_successors = int(tmp[2])\n", " successors = list()\n", " if num_successors > 0:\n", " successors = [int(x) for x in tmp[3:]]\n", " pred_list.append(RCPSP.Pred(jobnr, num_modes, num_successors, successors))\n", " if line.startswith(\"REQUESTS/DURATIONS:\"):\n", " req_dur_list = list()\n", " for j in range(i + 3, i + 3 + sum_modes):\n", " tmp = d[j][:9].split()\n", " if len(tmp) > 0:\n", " jobnr = int(tmp[0])\n", " tmp = d[j][9:].split()\n", " mode = int(tmp[0])\n", " duration = int(tmp[1])\n", " request = [int(x) for x in tmp[2:]]\n", " req_dur_list.append(RCPSP.ReqDur(jobnr, mode, duration, request))\n", " if line.startswith(\"RESOURCEAVAILABILITIES:\"):\n", " avail_list = [int(x) for x in d[i + 2].split()]\n", " return RCPSP(\n", " base_data,\n", " initial_value_random_generator,\n", " projects,\n", " jobs,\n", " horizon,\n", " renewable,\n", " nonrenewable,\n", " doubly_constrained,\n", " pronr,\n", " num_jobs,\n", " rel_date,\n", " due_date,\n", " tard_cost,\n", " mpm_time,\n", " pred_list,\n", " req_dur_list,\n", " avail_list,\n", " )" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Parse file\n", "file_path = \"rcpsp/j30/j3010_1.sm\"\n", "problem = parse_rcpsp_file(file_path)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "amplify_sched で RCPSP を定式化します。\n", "\n", "amplify_sched は Job を何らかの Machine で実行することを前提としています。\n", "RCPSP には Machine という概念はありませんので、仮想的に Jobの数だけ Machine を用意し、各 Job は対応した Machine で処理されることとします。\n", "Machine は対応する一つの Job だけ処理します。\n", "\n", "amplify_sched を用いると資源制約は capacity/required_resources 制約として、順序制約は dependent_jobs 制約として実装できます。" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "from amplify_sched import *\n", "\n", "num_jobs = problem.jobs\n", "num_machines = num_jobs\n", "num_resources = problem.renewable\n", "avail_list = problem.avail_list\n", "jobs = problem.get_jobs()\n", "\n", "model = amplify_sched.Model()\n", "# Machine を仮想的に Job の数だけ追加する\n", "for i in range(num_machines):\n", " model.machines.add(str(i + 1))\n", "# Job を追加し、処理時間を設定する\n", "for i in range(num_jobs):\n", " job_id = str(i + 1)\n", " machine_id = job_id\n", " model.jobs.add(job_id)\n", " model.jobs[job_id].append()\n", " model.jobs[job_id][0].processing_times[machine_id] = jobs[int(job_id)].duration\n", "# Resource を追加し、使用可能個数を設定する\n", "for i in range(num_resources):\n", " model.resources.add(str(i + 1))\n", " model.resources[str(i + 1)].capacity = avail_list[i]\n", "# 資源制約\n", "for job_id, job in jobs.items():\n", " for i, request in enumerate(job.request):\n", " # Resource を request 回追加する\n", " resource_id = str(i + 1)\n", " for _ in range(request):\n", " model.jobs[str(job_id)][0].required_resources.append(resource_id)\n", "# 順序制約\n", "for job_id, job in jobs.items():\n", " for successor in job.successors:\n", " model.jobs[str(successor)].add_dependent_jobs(str(job_id))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "上で定式化モデルをエンジンで解くと、1秒で最適解に到達することを確認できます。" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'OPTIMAL'" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "token = \"xxxxxxxxxxxxxxxxxxxxxxxxx\"\n", "gantt = model.solve(token=token, timeout=1)\n", "gantt.status" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ガントチャートを表示すると、各 Machine が一つの Job を処理していることを確認できます。" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "base": [ 0 ], "customdata": [ [ "1", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "1", "marker": { "color": "#636efa", "pattern": { "shape": "" } }, "name": "1", "offsetgroup": "1", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 0 ], "xaxis": "x", "y": [ "1" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 0 ], "customdata": [ [ "2", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "2", "marker": { "color": "#EF553B", "pattern": { "shape": "" } }, "name": "2", "offsetgroup": "2", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 2 ], "xaxis": "x", "y": [ "2" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 0 ], "customdata": [ [ "3", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "3", "marker": { "color": "#00cc96", "pattern": { "shape": "" } }, "name": "3", "offsetgroup": "3", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 5 ], "xaxis": "x", "y": [ "3" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 0 ], "customdata": [ [ "4", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "4", "marker": { "color": "#ab63fa", "pattern": { "shape": "" } }, "name": "4", "offsetgroup": "4", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 6 ], "xaxis": "x", "y": [ "4" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 6 ], "customdata": [ [ "5", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "5", "marker": { "color": "#FFA15A", "pattern": { "shape": "" } }, "name": "5", "offsetgroup": "5", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 4 ], "xaxis": "x", "y": [ "5" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 6 ], "customdata": [ [ "6", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "6", "marker": { "color": "#19d3f3", "pattern": { "shape": "" } }, "name": "6", "offsetgroup": "6", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 2 ], "xaxis": "x", "y": [ "6" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 6 ], "customdata": [ [ "7", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "7", "marker": { "color": "#FF6692", "pattern": { "shape": "" } }, "name": "7", "offsetgroup": "7", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 9 ], "xaxis": "x", "y": [ "7" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 10 ], "customdata": [ [ "8", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "8", "marker": { "color": "#B6E880", "pattern": { "shape": "" } }, "name": "8", "offsetgroup": "8", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 9 ], "xaxis": "x", "y": [ "8" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 14 ], "customdata": [ [ "9", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "9", "marker": { "color": "#FF97FF", "pattern": { "shape": "" } }, "name": "9", "offsetgroup": "9", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 4 ], "xaxis": "x", "y": [ "9" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 18 ], "customdata": [ [ "10", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "10", "marker": { "color": "#FECB52", "pattern": { "shape": "" } }, "name": "10", "offsetgroup": "10", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 8 ], "xaxis": "x", "y": [ "10" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 2 ], "customdata": [ [ "11", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "11", "marker": { "color": "#636efa", "pattern": { "shape": "" } }, "name": "11", "offsetgroup": "11", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 7 ], "xaxis": "x", "y": [ "11" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 20 ], "customdata": [ [ "12", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "12", "marker": { "color": "#EF553B", "pattern": { "shape": "" } }, "name": "12", "offsetgroup": "12", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 10 ], "xaxis": "x", "y": [ "12" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 19 ], "customdata": [ [ "13", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "13", "marker": { "color": "#00cc96", "pattern": { "shape": "" } }, "name": "13", "offsetgroup": "13", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 1 ], "xaxis": "x", "y": [ "13" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 15 ], "customdata": [ [ "14", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "14", "marker": { "color": "#ab63fa", "pattern": { "shape": "" } }, "name": "14", "offsetgroup": "14", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 1 ], "xaxis": "x", "y": [ "14" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 5 ], "customdata": [ [ "15", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "15", "marker": { "color": "#FFA15A", "pattern": { "shape": "" } }, "name": "15", "offsetgroup": "15", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 1 ], "xaxis": "x", "y": [ "15" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 9 ], "customdata": [ [ "16", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "16", "marker": { "color": "#19d3f3", "pattern": { "shape": "" } }, "name": "16", "offsetgroup": "16", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 5 ], "xaxis": "x", "y": [ "16" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 14 ], "customdata": [ [ "17", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "17", "marker": { "color": "#FF6692", "pattern": { "shape": "" } }, "name": "17", "offsetgroup": "17", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 2 ], "xaxis": "x", "y": [ "17" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 16 ], "customdata": [ [ "18", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "18", "marker": { "color": "#B6E880", "pattern": { "shape": "" } }, "name": "18", "offsetgroup": "18", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 5 ], "xaxis": "x", "y": [ "18" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 31 ], "customdata": [ [ "19", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "19", "marker": { "color": "#FF97FF", "pattern": { "shape": "" } }, "name": "19", "offsetgroup": "19", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 5 ], "xaxis": "x", "y": [ "19" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 21 ], "customdata": [ [ "20", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "20", "marker": { "color": "#FECB52", "pattern": { "shape": "" } }, "name": "20", "offsetgroup": "20", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 9 ], "xaxis": "x", "y": [ "20" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 21 ], "customdata": [ [ "21", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "21", "marker": { "color": "#636efa", "pattern": { "shape": "" } }, "name": "21", "offsetgroup": "21", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 10 ], "xaxis": "x", "y": [ "21" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 26 ], "customdata": [ [ "22", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "22", "marker": { "color": "#EF553B", "pattern": { "shape": "" } }, "name": "22", "offsetgroup": "22", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 1 ], "xaxis": "x", "y": [ "22" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 30 ], "customdata": [ [ "23", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "23", "marker": { "color": "#00cc96", "pattern": { "shape": "" } }, "name": "23", "offsetgroup": "23", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 5 ], "xaxis": "x", "y": [ "23" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 10 ], "customdata": [ [ "24", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "24", "marker": { "color": "#ab63fa", "pattern": { "shape": "" } }, "name": "24", "offsetgroup": "24", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 4 ], "xaxis": "x", "y": [ "24" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 16 ], "customdata": [ [ "25", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "25", "marker": { "color": "#FFA15A", "pattern": { "shape": "" } }, "name": "25", "offsetgroup": "25", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 10 ], "xaxis": "x", "y": [ "25" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 35 ], "customdata": [ [ "26", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "26", "marker": { "color": "#19d3f3", "pattern": { "shape": "" } }, "name": "26", "offsetgroup": "26", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 5 ], "xaxis": "x", "y": [ "26" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 30 ], "customdata": [ [ "27", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "27", "marker": { "color": "#FF6692", "pattern": { "shape": "" } }, "name": "27", "offsetgroup": "27", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 9 ], "xaxis": "x", "y": [ "27" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 2 ], "customdata": [ [ "28", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "28", "marker": { "color": "#B6E880", "pattern": { "shape": "" } }, "name": "28", "offsetgroup": "28", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 10 ], "xaxis": "x", "y": [ "28" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 40 ], "customdata": [ [ "29", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "29", "marker": { "color": "#FF97FF", "pattern": { "shape": "" } }, "name": "29", "offsetgroup": "29", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 2 ], "xaxis": "x", "y": [ "29" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 30 ], "customdata": [ [ "30", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "30", "marker": { "color": "#FECB52", "pattern": { "shape": "" } }, "name": "30", "offsetgroup": "30", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 10 ], "xaxis": "x", "y": [ "30" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 39 ], "customdata": [ [ "31", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "31", "marker": { "color": "#636efa", "pattern": { "shape": "" } }, "name": "31", "offsetgroup": "31", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 3 ], "xaxis": "x", "y": [ "31" ], "yaxis": "y" }, { "alignmentgroup": "True", "base": [ 42 ], "customdata": [ [ "32", 0 ] ], "hovertemplate": "Job=%{customdata[0]}
Start=%{base}
Finish=%{x}
Machine=%{y}
Process=%{customdata[1]}", "legendgroup": "32", "marker": { "color": "#EF553B", "pattern": { "shape": "" } }, "name": "32", "offsetgroup": "32", "orientation": "h", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ 0 ], "xaxis": "x", "y": [ "32" ], "yaxis": "y" } ], "layout": { "barmode": "overlay", "legend": { "title": { "text": "Job" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "type": "linear" }, "yaxis": { "anchor": "x", "categoryarray": [ "32", "31", "30", "29", "28", "27", "26", "25", "24", "23", "22", "21", "20", "19", "18", "17", "16", "15", "14", "13", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1" ], "categoryorder": "array", "domain": [ 0, 1 ], "title": { "text": "Machine" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "gantt.timeline(machine_view=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "amplify_sched は Resource の使用量も簡単にプロットできます。" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Resource=1
time=%{x}
requirement=%{y}", "legendgroup": "1", "line": { "color": "#636efa", "dash": "solid", "shape": "hv" }, "marker": { "symbol": "circle" }, "mode": "lines+markers", "name": "1", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 2, 5, 6, 8, 9, 10, 12, 14, 15, 16, 18, 19, 20, 26, 27, 30, 31, 35, 36, 39, 40, 42 ], "xaxis": "x", "y": [ 9, 16, 20, 24, 21, 20, 21, 14, 21, 17, 21, 13, 19, 11, 11, 2, 15, 17, 14, 12, 5, 1, 0 ], "yaxis": "y" }, { "hovertemplate": "Resource=2
time=%{x}
requirement=%{y}", "legendgroup": "2", "line": { "color": "#EF553B", "dash": "solid", "shape": "hv" }, "marker": { "symbol": "circle" }, "mode": "lines+markers", "name": "2", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 2, 5, 6, 8, 9, 10, 14, 15, 16, 19, 20, 21, 30, 31, 35, 36, 39, 40, 42 ], "xaxis": "x", "y": [ 17, 21, 16, 10, 9, 12, 16, 3, 6, 10, 18, 20, 23, 19, 18, 18, 11, 12, 7, 0 ], "yaxis": "y" }, { "hovertemplate": "Resource=3
time=%{x}
requirement=%{y}", "legendgroup": "3", "line": { "color": "#00cc96", "dash": "solid", "shape": "hv" }, "marker": { "symbol": "circle" }, "mode": "lines+markers", "name": "3", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 2, 5, 6, 8, 9, 10, 14, 15, 16, 18, 19, 20, 21, 30, 31, 35, 36, 39, 40, 42 ], "xaxis": "x", "y": [ 23, 25, 25, 19, 11, 11, 14, 22, 23, 17, 9, 11, 12, 7, 10, 19, 16, 7, 8, 5, 0 ], "yaxis": "y" }, { "hovertemplate": "Resource=4
time=%{x}
requirement=%{y}", "legendgroup": "4", "line": { "color": "#ab63fa", "dash": "solid", "shape": "hv" }, "marker": { "symbol": "circle" }, "mode": "lines+markers", "name": "4", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 2, 5, 6, 8, 9, 10, 12, 14, 15, 16, 18, 19, 20, 21, 26, 27, 30, 31, 35, 39, 40, 42 ], "xaxis": "x", "y": [ 10, 19, 18, 32, 27, 30, 30, 27, 33, 24, 14, 9, 14, 14, 23, 23, 17, 30, 22, 21, 15, 11, 0 ], "yaxis": "y" } ], "layout": { "legend": { "title": { "text": "Resource" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "time" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "requirement" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "gantt.resource()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`avail_option` を使用すると、余っている Resource の量 (Capacity - Requirement のこと) もプロットできます。\n", "\n", "ほとんどすべての時間帯で何らかの Resource の余っている量が 0 付近の値を取っており、効率的にスケジューリング出来ていることが確認できます。" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Resource=1
time=%{x}
available=%{y}", "legendgroup": "1", "line": { "color": "#636efa", "dash": "solid", "shape": "hv" }, "marker": { "symbol": "circle" }, "mode": "lines+markers", "name": "1", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 2, 5, 6, 8, 9, 10, 12, 14, 15, 16, 18, 19, 20, 26, 27, 30, 31, 35, 36, 39, 40, 42 ], "xaxis": "x", "y": [ 15, 8, 4, 0, 3, 4, 3, 10, 3, 7, 3, 11, 5, 13, 13, 22, 9, 7, 10, 12, 19, 23, 24 ], "yaxis": "y" }, { "hovertemplate": "Resource=2
time=%{x}
available=%{y}", "legendgroup": "2", "line": { "color": "#EF553B", "dash": "solid", "shape": "hv" }, "marker": { "symbol": "circle" }, "mode": "lines+markers", "name": "2", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 2, 5, 6, 8, 9, 10, 14, 15, 16, 19, 20, 21, 30, 31, 35, 36, 39, 40, 42 ], "xaxis": "x", "y": [ 6, 2, 7, 13, 14, 11, 7, 20, 17, 13, 5, 3, 0, 4, 5, 5, 12, 11, 16, 23 ], "yaxis": "y" }, { "hovertemplate": "Resource=3
time=%{x}
available=%{y}", "legendgroup": "3", "line": { "color": "#00cc96", "dash": "solid", "shape": "hv" }, "marker": { "symbol": "circle" }, "mode": "lines+markers", "name": "3", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 2, 5, 6, 8, 9, 10, 14, 15, 16, 18, 19, 20, 21, 30, 31, 35, 36, 39, 40, 42 ], "xaxis": "x", "y": [ 2, 0, 0, 6, 14, 14, 11, 3, 2, 8, 16, 14, 13, 18, 15, 6, 9, 18, 17, 20, 25 ], "yaxis": "y" }, { "hovertemplate": "Resource=4
time=%{x}
available=%{y}", "legendgroup": "4", "line": { "color": "#ab63fa", "dash": "solid", "shape": "hv" }, "marker": { "symbol": "circle" }, "mode": "lines+markers", "name": "4", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 2, 5, 6, 8, 9, 10, 12, 14, 15, 16, 18, 19, 20, 21, 26, 27, 30, 31, 35, 39, 40, 42 ], "xaxis": "x", "y": [ 23, 14, 15, 1, 6, 3, 3, 6, 0, 9, 19, 24, 19, 19, 10, 10, 16, 3, 11, 12, 18, 22, 33 ], "yaxis": "y" } ], "layout": { "legend": { "title": { "text": "Resource" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "time" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "available" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "gantt.resource(avail_view=True)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.9" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }