结合确定性与非确定性过程

Python 中的离散事件模拟

Diogo Costa (PhD, MSc)

Adjunct Professor, University of Saskatchewan, Canada & CEO of ImpactBLUE-Scientific

确定性与非确定性过程

展示某系统流程顺序的图示。先是确定性过程A,接着是非确定性过程B,最后为确定性过程C。

示例:机场客流管理

  • 非确定性:乘客到达机场的时间
  • 确定性:值机后行李在机场内的运输
Python 中的离散事件模拟

示例:工厂装配线

确定性过程

  • 原材料运至工厂
  • 全自动化工序
  • 质量检验
  • 包装
  • 成品运送给客户

示例:焊接机

加工时间 = 焊缝长度 × 焊接机速度

非确定性过程

  • 原材料订购
  • 复杂部件的手工装配

散点图展示某次手工装配在多次重复中的时长分布。

Python 中的离散事件模拟

确定性过程

示例:带焊接的装配线

  • 2 个确定性过程
    welding_1

welding_2

  • welding_1

    • 过程名称:焊接部件A

    • 加工时间:5 小时

  • welding_2
    • 过程名称:焊接部件B
    • 加工时间:length * hours_per_length

为每个过程创建 dictionary

welding_1 = {
    "name": "Welding component A",
    "time_hours": 5
}

length = 20   # meters
hours_per_length = 0.2  # hours 

welding_2 = {
    "name": "Welding component B",
    "time_hours": length * hours_per_length
}
Python 中的离散事件模拟

非确定性过程

示例:装配线

  • 2 个非确定性过程 manual_assembly_1

manual_assembly_2

  • manual_assembly_1

    • 过程名称:手工装配A
    • 平均加工时间:80 小时

    • 标准差:5 小时

  • manual_assembly_2
    • 过程名称:手工装配B"
    • 平均加工时间:20 小时
  • 标准差:2 小时

为每个过程创建 dictionary

manual_assembly_1 = {
    "name": "Manual Assembly A",
    "time_hours": 80,
    "std_hours": 5
}
manual_assembly_2 = {
    "name": "Manual Assembly B",
    "time_hours": 20,
    "std_hours": 2}
Python 中的离散事件模拟

构建基于事件的仿真

制造流程顺序 展示制造活动流程顺序的图示,按时间依次为:welding_1、manual_assembly_1、manual_assembly_2、welding_2。

离散事件模型

# Initiate time-tracking variable
time = numpy.zeros(number_of_processes)

# Next-event time progression time[0] = 0 time[1] = time[0] + welding_1["time_hours"] time[2] = time[1] + rd.gauss(manual_assembly_1["time_hours"], manual_assembly_1["std_hours"]) time[3] = time[2] + rd.gauss(manual_assembly_2["time_hours"], manual_assembly_2["std_hours"]) time[4] = time[3] + welding_2["time_hours"] time[5] = time[4]
Python 中的离散事件模拟

时间单位与模型探索

  • 时间单位
    • 确保所有过程的时间单位一致。
Python 中的离散事件模拟

¡Vamos a practicar!

Python 中的离散事件模拟

Preparing Video For Download...