Simulasi Peristiwa Diskret dengan Python
Diogo Costa (PhD, MSc)
Adjunct Professor, University of Saskatchewan, Canada & CEO of ImpactBLUE-Scientific
Model kontinu
Berjalan pada langkah waktu tetap
Waktu adalah variabel dummy
Menggunakan for-loop waktu
for t in range(time_range):
Model peristiwa-diskret
Berjalan pada langkah waktu variabel
Waktu adalah variabel status
Sering menggunakan while-loop
while (time < 365):
time += process_duration
Contoh: model perusahaan taksi
while (time < 10):
# Process 1
time_duration_1 = manage_requests()
time += time_duration_1
# Process 2
time_duration_2 = dispatch_taxi()
time += time_duration_2
Kondisi akhir
while (time < 10)
Contoh: model perusahaan taksi
while (time < 10):
# Process 1
time_duration_1 = manage_requests()
time += time_duration_1
# Process 2
time_duration_2 = dispatch_taxi()
time += time_duration_2
Jam (clock)
time += time_duration_1
time += time_duration_2
time melacak waktu simulasi saat iniContoh: model perusahaan taksi
while (time < 10):
# Process 1
time_duration_1 = manage_requests()
time += time_duration_1
# Process 2
time_duration_2 = dispatch_taxi()
time += time_duration_2
Variabel status
time
Mengurangi waktu antara pelanggan memesan taksi dan diantar
Variabel yang mencirikan keluaran dan efisiensi sistem
Simulasi Peristiwa Diskret dengan Python