Mô phỏng Sự kiện Rời rạc bằng Python
Diogo Costa (PhD, MSc)
Adjunct Professor, University of Saskatchewan, Canada & CEO of ImpactBLUE-Scientific
LƯU Ý: Dùng thay thế “sự kiện” và “quy trình”.
Tính không tất định là gì?
Vì sao quy trình tất định quan trọng?
Tự nhiên
Quy trình do con người
Quy trình không tất định
Thống kê
Biểu diễn biến thiên thời lượng quy trình
Gói random hữu ích cho việc này
Ví dụ: random.randint(start, end)
import random
# Non-deterministic processes
process_1 = [5, 15]
while time < simulation_time:
# Update simulation time: process_1
time += random.randint(
process_1[0],
process_1[1])
Không có phương pháp riêng cho quy trình không tất định
Tính biến thiên thời lượng như với mô hình không dùng SimPy
Truyền thống kê phù hợp vào .timeout()
import random
# Non-deterministic processes
process_1 = [5, 15]
while True:
# Update simulation time: process_1
yield env.timeout(random.randint(
process_1[0],
process_1[1]))
Mô phỏng Sự kiện Rời rạc bằng Python