Anda di halaman 1dari 5

Event Flow Chart and Avoiding Jams

I have drawn up three diagrams to explain some of my the topics covered in my last post better.

This is a diagram of two intersection nodes. Suppose a car needed to get from intersection 2 to the
intersection that is west of intersection 1; we will also suppose that the number of time steps required to
get from the end of an incoming queue to the center of an intersection and the number of time steps
required to get from the center of the intersection to the front of the outgoing queue, is 5. The car would
exit the west outgoing queue of intersection 2 and enter the incoming queue of intersection 1 which would
schedule a choose direction event for 5 time steps in the future. When the car got to the center of
intersection 1 (this is represented by the execution of the choose direction event), it would realize that
there was no room to enter the west outgoing queue, or any other queue for that matter, so the car would
schedule a departure event to go east for 5 time steps in the future, which would put the car in the east
outgoing queue of intersection 1. It would also schedule an arrival event for intersection 2 for the 5 time
steps in the future. This cycle may go on once or twice in hopes that one of the jams in intersection 2 will
subside. However, if the jams do not subside, the car will have to choose a different direction to avoid the
jams.
This is a diagram of many intersection nodes all in a configuration and how the previously described
algorithm can be used to avoid a jam, as well as how to avoid a livelock for the entire model. The car will
begin by attempting to go south the east, after a few tries it will go either west or north (west in this case)
and then go south. The car will then try to go east again when it is nearest to its destination, and when it
realizes that it cant, it will go south again, then east and then north. A car's final destination is determined
by the total number of spaces north or south and east or west, it has remaining to move. Therefore the
algorithm to determine where the car should move from a particular intersection becomes very simple, the
car should either towards its destination in the vertical or horizontal directions. If neither of these two
options are available, the car must pick a different direction at random and move there in an attempt to
avoid the jam.
The flow chart above describes the events that are scheduled in order to accomplish the algorithm
aforementioned. The colors indicate which intersection to the particular event is scheduled for, and the
arrows indicate which event (and intersection) the even was scheduled by. Starting at the event indicated
"start", the arrival event schedules a direction choice which schedules a departure. An arrival is then
scheduled on the blue intersection which goes through the same process as the red intersection and
sends the car back. This may happen a few times before the red intersection schedules an event to send
the car to a different intersection.

I hope to have this coded up by next week, and if all goes well I should have some performance results
within the next two weeks.

Acara Flow Chart dan Menghindari Kemacetan

Saya telah disusun tiga diagram untuk menjelaskan beberapa saya topik yang dibahas dalam posting
terakhir saya lebih baik.
Ini adalah diagram dari dua node persimpangan. Misalkan mobil diperlukan untuk mendapatkan dari
persimpangan 2 ke persimpangan yang barat dari persimpangan 1; kami juga akan menganggap bahwa
jumlah langkah waktu yang dibutuhkan untuk mendapatkan dari akhir antrian masuk ke pusat
persimpangan dan jumlah langkah waktu yang dibutuhkan untuk mendapatkan dari pusat persimpangan
ke depan antrian keluar, adalah 5. mobil akan keluar dari antrian keluar barat dari persimpangan 2 dan
masuk ke antrian masuk dari simpang 1 yang akan menjadwalkan acara memilih arah untuk 5 langkah
waktu di masa depan. Ketika mobil sampai ke pusat persimpangan 1 (ini diwakili oleh pelaksanaan event
memilih arah), akan menyadari bahwa tidak ada ruang untuk masuk antrian keluar barat, atau antrian
lainnya untuk masalah ini, sehingga mobil akan menjadwalkan acara keberangkatan pergi ke timur untuk
5 langkah waktu di masa depan, yang akan menempatkan mobil di antrian keluar timur dari perempatan
1. Hal ini juga akan menjadwalkan acara kedatangan untuk persimpangan 2 untuk 5 langkah waktu di
masa depan. Siklus ini dapat terus sekali atau dua kali dalam harapan bahwa salah satu kemacetan di
persimpangan 2 akan mereda. Namun, jika kemacetan tidak mereda, mobil akan harus memilih arah
yang berbeda untuk menghindari kemacetan.

Ini adalah diagram dari banyak persimpangan node semua dalam konfigurasi dan bagaimana algoritma
dijelaskan sebelumnya dapat digunakan untuk menghindari kemacetan, serta bagaimana untuk
menghindari livelock untuk s seluruh model. mobil akan mulai dengan mencoba untuk pergi ke selatan
timur, setelah beberapa kali mencoba akan pergi baik barat atau utara (barat dalam hal ini) dan
kemudian pergi ke selatan. mobil kemudian akan mencoba untuk pergi ke timur lagi ketika itu adalah
terdekat ke tujuan, dan ketika menyadari bahwa cant, itu akan pergi ke selatan lagi, kemudian timur dan
kemudian utara. tujuan akhir Sebuah mobil ditentukan oleh jumlah ruang utara atau selatan dan timur
atau barat, telah tersisa untuk bergerak. Oleh karena itu algoritma untuk menentukan di mana mobil
harus bergerak dari persimpangan tertentu menjadi sangat sederhana, mobil harus baik terhadap tujuan
dalam arah vertikal atau horizontal. Jika tak satu pun dari dua pilihan ini tersedia, mobil harus memilih
arah yang berbeda secara acak dan pindah ke sana dalam upaya untuk menghindari kemacetan.

Diagram alir di atas menggambarkan peristiwa yang dijadwalkan untuk mencapai algoritma tersebut.
Warna-warna menunjukkan yang simpang ke acara tertentu dijadwalkan untuk, dan panah
menunjukkan dimana kejadian (dan persimpangan) bahkan dijadwalkan oleh. Mulai dari acara tersebut
ditunjukkan "mulai", kedatangan acara jadwal pilihan arah yang jadwal keberangkatan. Kedatangan
kemudian dijadwalkan pada persimpangan biru yang berjalan melalui proses yang sama seperti
persimpangan merah dan mengirimkan mobil kembali. Hal ini bisa terjadi beberapa kali sebelum jadwal
persimpangan merah sebuah acara untuk mengirim mobil untuk persimpangan yang berbeda.
Saya berharap untuk memiliki ini dikodekan oleh minggu depan, dan jika semuanya berjalan dengan baik
saya harus memiliki beberapa hasil kinerja dalam dua minggu ke depan.

Anda mungkin juga menyukai