Pengantar simulasi peristiwa-diskret

Simulasi Peristiwa Diskret dengan Python

Diogo Costa (PhD, MSc)

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

Model peristiwa-diskret vs. model kontinu

Model kontinu

  • Berjalan pada langkah waktu tetap

  • Waktu adalah variabel dummy

    • Waktu tidak diperbarui di dalam loop
  • Menggunakan for-loop waktu

    for t in range(time_range):
    

Model peristiwa-diskret

  • Berjalan pada langkah waktu variabel

    • Menjalankan/Menjadwalkan peristiwa diskret dengan durasi berbeda seiring waktu
  • Waktu adalah variabel status

    • Waktu diperbarui di dalam while-loop
    • Waktu bukan variabel dummy
  • Sering menggunakan while-loop

    while (time < 365):
    time += process_duration
    
Simulasi Peristiwa Diskret dengan Python

Komponen model peristiwa-diskret

  • Variabel status
  • Jam (clock)
  • Daftar peristiwa (atau daftar proses)
  • Kondisi akhir
Simulasi Peristiwa Diskret dengan Python

Komponen model

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)
  • Kondisi yang mengakhiri simulasi
Simulasi Peristiwa Diskret dengan Python

Komponen model

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 ini
  • Jam melompat ke waktu mulai peristiwa berikutnya saat simulasi berjalan
  • Waktu melompat karena peristiwa bersifat seketika
Simulasi Peristiwa Diskret dengan Python

Komponen model

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

Variabel status

time
  • Mengurangi waktu antara pelanggan memesan taksi dan diantar

  • Variabel yang mencirikan keluaran dan efisiensi sistem

Simulasi Peristiwa Diskret dengan Python

Ayo berlatih!

Simulasi Peristiwa Diskret dengan Python

Preparing Video For Download...