Simulasi Peristiwa Diskret dengan Python
Diogo Costa (PhD, MSc)
Adjunct Professor, University of Saskatchewan, Canada & CEO of ImpactBLUE-Scientific
Deskripsi sistem alam atau buatan manusia dengan konsep dan bahasa matematika.
Model dapat diklasifikasikan sebagai:
Model matematis bisa sederhana atau kompleks.
George Box: "Semua model salah, tetapi beberapa bermanfaat."

Model aliran sungai

Model ini memprediksi debit di Stasiun Hidrologi Goaya, Tiongkok.
Prediksi berbasis informasi curah hujan sebagai input model.
Contoh lain
Memprediksi inflasi

Contoh lain
# Define model parameters
processes = {"process_1": 5,
"process_2": 2,
"process_3": 3}
# Simulation period
simulation_time = 365
# Run model
discrete_model(processes, simulation_time)
def discrete_model(processes, simulation_time): # 1) Run end-condition while (time < simulation_time): process_names = list(processes.keys())# 2) Loop over all processes for p in range(len(process_names)): process_name_p = process_names[p]# 3) Account for effect of each process time += processes[process_name_p]
Contoh output model peristiwa-diskret untuk aktivitas manufaktur
=> START OF SIMULATION (Time = 0 days)
Time = 6.00 days | Process Complete: Transport of raw material
Time = 9.00 days | Process Complete: Building components
Time = 11.00 days | Process Complete: Assembling parts
Time = 14.00 days | Process Complete: Selling product
=> COMPLETED: Supply-Chain cycle #1 | Time = 15.5 days
Time = 21.50 days | Process Complete: Transport raw material
Time = 24.50 days | Process Complete: Building components
Time = 26.50 days | Process Complete: Assembling parts
Time = 29.50 days | Process Complete: Selling product
=> COMPLETED: Supply-Chain cycle #2 | Time = 31.0 days
Visualisasi hasil model: membantu mengenali pola dan titik balik sistem.
Visualisasi harus sesuai dengan tujuan simulasi.
Banyak paket visualisasi berguna: matplotlib, seaborn, plotly.

Contoh
y) vs. nilai waktu (x)plt.plot(x, y, color='green', marker='o',
markersize=12, linestyle='dashed',
linewidth=2)
x dan menghitung jumlah nilai per binplt.hist(x, 50, density=True,
facecolor='g', alpha=0.75)
Simulasi Peristiwa Diskret dengan Python