Анализ алгоритмов маршрутизации для сетей VANET методами имитационного моделирования

Концепции био-инспирированного подхода для протоколов маршрутизации, алгоритмов оптимизации. Масштабируемость — способность беспроводной сети эффективно обрабатывать большое количество узлов. Сравнение средств агенто-ориентированного программирования.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык русский
Дата добавления 18.07.2020
Размер файла 1,2 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

Чтобы учесть случайность движения транспортных средств внутри сети, было вычислено среднее значение по результатам пяти запусков имитационной модели с одинаковыми входными параметрами. В таблице 3.1 представлена информация о том, какую долю участников движения покроют устройства за время работы алгоритма:

Таблица 3.1 -- Доля участников движения, получивших сообщение за время моделирования

Общее число автомобилей

Доля участников, получивших сообщение, %

Время работы

30

96,6%

0:00:15

50

98,1%

0:00:17

80

93,7%

0:00:33

100

96,8%

0:00:42

Из этих данных можно сделать вывод о том, что чем больше количество участников движения, тем дольше выполняется алгоритм, что может плохо влиять на его производительность при обработке сложных транспортных сетей с большим количеством трафика, на пример, мегаполиса целиком.

В таблице 3.2 представлены результаты моделирования для двенадцати различных начальных установок.

Таблица 3.2 -- Результаты моделирования

Размер популяции

Количество автомобилей

Вероятность мутации

Вероятность скрещивания

Доля покрываемых автомобилей, %

Время симуляции

15

30

0,3

0,5

87%

0:03:21

15

50

0,3

0,5

92%

0:03:39

15

100

0,3

0,5

89%

0:03:45

15

30

0,1

0,5

83%

0:04:22

15

50

0,1

0,5

84%

0:04:41

15

100

0,1

0,5

82%

0:05:25

15

30

0,3

0,2

83%

0:03:46

15

50

0,3

0,2

88%

0:04:24

15

100

0,3

0,2

89%

0:05:12

15

30

0,1

0,2

90%

0:06:10

15

50

0,1

0,2

81%

0:07:31

15

100

0,1

0,2

86%

0:08:19

Исходя из данных приведенной выше таблицы, напрашивается вывод о том, что вероятность мутации сильно влияет на время работы алгоритма, но в то же время снижается доля автомобилей, непрерывно получающих сигнал от придорожных устройств. Вероятность скрещиваний также влияет на время работы алгоритма и долю покрываемых автомобилей. Кроме того, снова наблюдается зависимость времени работы алгоритма до срабатывания стоп-фактора от количества транспортных средств -- чем больше в сети участников движения, тем дольше алгоритм находит оптимальное решение для расстановки устройств оповещения.

Таким образом, можно сказать, что мутации и скрещивания положительно влияют на выживаемость и приспособленность популяции в задаче расстановке придорожных устройств, что помогает алгоритму предоставлять довольно эффективные решения (доля оповещенных автомобилей не опускается ниже 80% на протяжении симуляции) для расстановки. Описанный алгоритм позволяет получить эффективное размещение устройств мониторинга и оповещения в транспортной сети, где эффективность оценивается по количеству уведомляемых транспортных средств. Результаты исследования могут быть использованы для решения актуальной проблемы улучшения передачи информации транспортным средствам о ситуациях в транспортной сети.

Заключение

С точки зрения поддержки развития сложных, автоматизированных и управляемых транспортных систем, технологии VANET помогают повысить безопасность дорожного движения. Чтобы избежать заторов в сети и автомобильных аварий, очень важно использовать простую и эффективную систему связи. В данной работе рассмотрена проблема наиболее эффективного и стабильного алгоритма маршрутизации для расстановки устройств оповещения в VANET. Были рассмотрены основные био-инспирированные алгоритмы для маршрутизации в сетях VANET, выделены их принципы работы, а также приведены аргументы в пользу их использования при проектировании и моделировании сетей VANET. Также, был проведен обзор существующих средств агентного моделирования, и их сравнительный анализ, после чего выявлены основные критерии выбора среды моделирования. Моделирование проводилось в вычислительной среде NetLogo. С помощью эмулирующей среды NetLogo был успешно смоделирован генетический алгоритм (GA) и наглядно показан принцип его действия. Более того, проведена успешная попытка применить генетический алгоритм для решения реальной задачи расстановки устройств оповещения и мониторинга в транспортных сетях. Результаты моделирования показали, что генетический алгоритм является неплохим применением для решения подобного рода задач, вместе с чем выявлены достоинства и недостатки его применения.

Кроме того, была наглядно показана возможность симуляции алгоритмов маршрутизации в среде NetLogo, продемонстрирован практический пример использования данной среды для задачи расстановки устройств оповещения в сетях VANET, с чем данное программное обеспечение успешно справилось.

Выполненная работа может быть использована не только для исследования VANETсетей и алгоритмов маршрутизации, которые в них действуют, но и в образовательных целях, поскольку среда NetLogo позволяет наглядно представить работу алгоритмов. Работа может быть использована студентами для изучения распределенных алгоритмов в курсе «Распределённые вычисления» направления обучения «Программная инженерия» НИУ ВШЭ г. Пермь.

Литература

1. Ершов Н. М. Введение в распределенное моделирование в среде NetLogo. с: ДМК Пресс, 2018. 264 с.

2. Sathiyaraj R., Bharathi A. An efficient intelligent traffic light control and deviation system for traffic congestion avoidance using multi-agent system //Transport. 2019.P. 1-9.

3. Zhang E., Zhang X. Road Traffic Congestion Detecting by VANETs //Atlantis Press. 2019. P 242-247.

4. Ярцев С. В., Кучерявый Е. А., Владыко А. Г.Исследование структуры потоков широковещательного трафика в сетях VANET // Научно-технические ведомости СПбГПУ. 2018. №3. P. 7-17.

5. Клименко И. С. Обзор беспроводных транспортных сетей VANET// Современные инновации. 2018. №5. С. 27.

6. E. G. Talbi, Metaheuristics: from design to implementation. Hoboken, NJ: Wiley, 2009. 587 c.

7. Huang C., Chuang Y., Chen Y., Luo Y., Yang D.Constructing alternative routes for VANET using machine learning techniques // Proc. 7th Int. Conf. AIT, Taichung, Taiwan, 2007. P 1-9.

8. Holland J. Genetic algorithms // Scientific American, vol. 267, no. 1, 1992, pp. 66-72.

9. Back T. Evolutionary algorithms in theory and practice, evolution strategies, evolutionary programming, genetic algorithms // Oxford University Press, USA, 1996. P. 307.

10. Wright A. Genetic algorithms for real parameter optimization// Foundations of Genetic Algorithms.1991. vol. 1. pp. 205-218.

11. Michalewicz Z., Janikow C. Handling constraints in genetic algorithms // in Proc. 4th Int. Conf. Genetic Algorithms, vol. 151, 1991, pp. 157.

12. Dorigo M. Optimization, learning and natural algorithms // Ph.D. dissertation, Dept. Elect., Polytechnic Univ. Milano, Italy, 1992.

13. Bitam S., Batouche M., Talbi E-G. A survey on bee colony algorithms // in Proc. IEEE IPDPS, NIDISC workshop, Atlanta, GA, USA, pp. 1-8.

14. Kennedy J., Eberhart R. Particle swarm optimization // in Proc. IEEE Int. Conf. Neural Netw., 1995, pp. 1942-1948.

15. YickJ., Mukherjee B., Ghosal D. Wireless sensor network survey //Comput. Netw., 2008, vol. 52, no. 12, pp. 2292-2330.

16. ScellatoS.,Leontiadis I.,Mascolo C.,Basu P., Zafer M. Evaluating temporal robustness of mobile networks // IEEE Trans. Mobile Comput., 2013, vol. 12, no. 1, pp. 105-117.

17. Tarakanov A. Immunocomputing for intelligent intrusion detection // IEEE Comput. Intell. Mag., 2008, vol. 3, no. 2, pp. 22-30.

18. AtreasN., KaranikasC., Tarakanov A.Signal processing by an immune type tree transform // Artificial Immune Systems, 2003, vol. 2787, pp. 111-119.

19. Berg H., Brown D. Chemotaxis in escherichia coli analysed by three-dimensional tracking // Nature, 1972, vol. 239, pp. 500-504.

20. Lee U., MagistrettiE., GerlaM., Bellavista P., LioP., Lee K.-W. Bio-inspired multi-agent data harvesting in a proactive urban monitoring environment //AdhocNetw., 2008, vol. 7, no. 4, pp. 725-741.

21. Abdou M., Hamill L., Gilbert N. Designing and building an agent-based model //Agent-based models of geographical systems. Springer, Dordrecht, 2012. P. 141-165.

22. Minar N. The swarm simulation system: A toolkit for building multi-agent simulations.1996. P. 1-7.

23. Collier N. RePast: AnRePast: An Extensible Framework for Agent Simulation //Social Science Research. 2002.P. 1-18.

24. Luke S. Mason: A multiagent simulation environment //Simulation. 2005. Т. 81. - №. 7. P. 517-527.

25. Хмыз М. В., Вахрушев С. И. Исследование транспортной сети на примере участка улицы Чкалова города Перми от пересечения с улицей Куйбышева до пересечения с улицей Героев Хасана // 2016.P. 1-9.

Приложение

Листинг программы

breed[carscar]

breed[stations station]

breed[crossings crossing]

breed[lightsRlightR]

breed[lightsLlightL]

breed[lightsUlightU]

breed[lightsDlightD]

breed[persons person]

stations-own

[

x

n1 n2 n3 n4

f

NumOfCarsAwared

Winner?

best?

Mut

Cross

pair?

]

patches-own[

non-usage

meaning

will-cross?

used

traffic

]

globals[

redV

greenV

redH

greenH

speedLimit

n

time

x_list

y_list

xy_list

pairs

counter

x1

x2

y1

y2

]

persons-own[

speed

walk-time

crossing-part

waiting?

]

cars-own[

x

f

speed

maxSpeed

will-turn?

turnX

turnY

politeness

will-stop?

awareness

]

to setup

ca

set speedLimit speed-limit

draw-sidewalk

draw-roads

set x_list []

set y_list []

set xy_list []

set pairs []

draw-crossings

place-cars

place-lights

create-population

set counter 0

set time 0

reset-ticks

tick

end

to GA

move-cars

control-traffic-lights

ask stations [

if any? cars with [awareness = 0] in-radius ((radius / 10) - 10)

[

set NumOfCarsAwaredNumOfCarsAwared + 1

]

ask cars in-radius ((radius / 10) - 10)

[

set awareness awareness + 5

]

]

every 0.5 [ask cars [

if pcolor = grey [ set awareness awareness - 3 ]

set non-usage 0

]]

ask cars with [ awareness >15 ] [ set awareness 15 ] ;; setting max awareness

ask cars with [ awareness <0 ] [ set awareness 0 ]

color-vehicles

every 1.0 [set time time + 1]

if time >= 10

[

every 15.0 [ask stations [select]

set counter counter + 1]

]

if time >= 13

[

every 15.0 [ask stations with [best? != true] [crossover]]

]

if time >= 15

[

every 15.0 [ask stations with [best? != true] [mutate]]

]

if (count stations with [best? = true]) = centers

[stop]

tick

end

to create-population

create-stations (centers - (count stations with [best? = true]))

[

setxy random-xcor random-ycor

move-to one-of patches with [(not any? other stations in-radius 30) and (pcolor = grey) and (pxcor>= 38) and (pxcor<= 235) and (pycor>= 20) and (pycor<= 125)]

set color [0 255 0 60]

set shape "circle"

set size (radius / 10)

set NumOfCarsAwaredNumOfCarsAwared

set Winner? False

set best? False

set pair? False

]

end

to select

ask stations with [NumOfCarsAwared>= ((num-of-cars / centers) * 0.5) and best? != true] [ set Winner? true set color [0 0 255 60]]

ask stations with-max [NumOfCarsAwared] with [NumOfCarsAwared != 0 and Winner? = true and (not any? other stations in-radius 30) and best? != true] [set best? true set color [255 255 0 60] ]

ask stations [ set NumOfCarsAwared 0]

set xy_list [list pxcorpycor] of stations with [ best? != true]

end

to crossover

;if random-float 1 < 0.5 [stop]

let o-t one-of other stations with [best? != true]

let t (list)

let u1 [pxcor] of self

if o-t != nobody

[let u2 [pycor] of o-t

let p1 [pxcor] of o-t

let p2 [pycor] of self

let i 0

repeat 1 [

ifelse random-float 1 > 0.5

[ask self [setxy u1 u2

set NumOfCarsAwared 0]

ask o-t [setxy p1 p2

set NumOfCarsAwared 0]]

[]

set ii + 1]

]

end

to mutate

if random-float 1 > 0.1 [stop]

let g 0

if g = 0

[setxy random-xcor random-ycor

move-to one-of patches with [(not any? other stations in-radius 30) and (pcolor = grey) and (pxcor>= 38) and (pxcor<= 230) and (pycor>= 20) and (pycor<= 125)]

set NumOfCarsAwared 0]

end

to go

move-cars

control-traffic-lights

ask stations [

if any? cars with [awareness = 0] in-radius (radius / 10)

[set NumOfCarsAwaredNumOfCarsAwared + 1]

if Winner? = false

[ask cars in-radius (radius / 10)

[

set awareness awareness + 5

]]

]

ask cars [

if pcolor = grey or pcolor = white [ set awareness awareness - 1 ]

set non-usage 0

]

ask cars with [ awareness >15 ] [ set awareness 15 ] ;; setting max awareness

ask cars with [ awareness <0 ] [ set awareness 0 ]

color-vehicles

every 10.0 [ask stations [die]]

every 10.0 [create-population]

tick

end

to color-vehicles

ask cars [

if pxcor>= max-pxcor - 1

[ set color grey]

ifelse activist? [

set color 64

] [

ifelse well-informed? [

set color 66

] [

ifelse aware? [

set color 68

] [

set color gray

]

]

]

]

end

to-report activist?

report awareness >= 15

end

to-report well-informed?

report awareness >= 10 and awareness < 15

end

to-report aware?

report awareness >= 5 and awareness < 10

end

to-report unaware?

report awareness >= 0 and awareness < 5

end

to control-traffic-lights

if ticks mod (50 * lights-interval * greenH + 65 * lights-interval * redH ) = 0 [change-color lightsR "H" change-color lightsL "H"]

if ticks mod (50 * lights-interval * greenV + 65 * lights-interval * redV ) = 0 [change-color lightsU "V" change-color lightsD "V"]

end

to change-color [lights D]

ask one-of lights [

ifelse color = red [

ifelse D = "H" [

set greenHgreenH + 1

][

set greenVgreenV + 1]

]

[

ifelse D = "H" [

set redHredH + 1][

set redVredV + 1]

]

]

ask lights [

ifelse color = red [set color green][set color red]

]

end

to draw-roads

ask patches with [(pxcor mod 40 = 39 or pxcor mod 40 = 0 or pxcor mod 40 = 36 or pxcor mod 40 = 37 or pxcor mod 40 = 38 )

and (pycor mod 22 = 21 or pycor mod 22 = 0 or pycor mod 22 = 19 or pycor mod 22 = 18 or pycor mod 22 = 20)] [

set pcolor grey

set meaning "crossroad"

]

ask patches with [pxcor mod 40 = 39 and meaning != "crossroad"] [

set pcolor grey

sprout 1 [

set shape "road2"

set color grey

set heading 270

stamp die

]

set meaning "road-up"]

ask patches with [pxcor mod 40 = 0 and meaning != "crossroad"] [

set pcolor grey

sprout 1 [

set shape "road2"

set color grey

set heading 90

stamp die

]

set meaning "road-up"]

ask patches with [pxcor mod 40 = 36 and meaning != "crossroad"] [

set pcolor grey

sprout 1 [

set shape "road2"

set color grey

set heading 270

stamp die

]

set meaning "road-down"]

ask patches with [pxcor mod 40 = 37 and meaning != "crossroad"] [

set pcolor grey

sprout 1 [

set shape "road2"

set color grey

set heading 90

stamp die

]

set meaning "road-down"]

ask patches with [pycor mod 22 = 21 and meaning != "crossroad"] [

set pcolor grey

sprout 1 [

set shape "road2"

set color grey

set heading 180

stamp die

]

set meaning "road-left"]

ask patches with [pycor mod 22 = 0 and meaning != "crossroad"] [

set pcolor grey

sprout 1 [

set shape "road2"

set color grey

set heading 0

stamp die

]

set meaning "road-left"]

ask patches with [pycor mod 22 = 19 and meaning != "crossroad"] [

set pcolor grey

sprout 1 [

set shape "road2"

set color grey

set heading 0

stamp die

]

set meaning "road-right"]

ask patches with [pycor mod 22 = 18 and meaning != "crossroad"] [

set pcolor grey

sprout 1 [

set shape "road2"

set color grey

set heading 180

stamp die

]

set meaning "road-right"]

ask patches with [pxcor mod 40 = 38 and meaning != "crossroad"] [

set pcolor white

sprout 1 [

set shape "road-middle"

set color grey - 1

set heading 90

stamp

die

]

set meaning "road-middle-v"

]

;the middle lanes

ask patches with [pycor mod 22 = 20 and meaning != "crossroad"] [

set pcolor white

sprout 1 [

set shape "road-middle"

set color grey - 1

set heading 0

stamp

die

]

set meaning "road-middle-h"

]

end

to draw-sidewalk

ask patches with [(pxcor mod 40 > 0 and pxcor mod 40 < 36) or pycor mod 22 = 1

or pycor mod 22 = 2 or pycor mod 22 = 3 or pycor mod 22 = 15 or pycor mod 22 = 16 or pycor mod 22 = 17] [

set pcolor brown + 2

sprout 1 [

set shape "tile stones"

set color 36

stamp

die

]

set meaning "sidewalk"]

end

to draw-crossings

ask patches with [(meaning = "road-up" or meaning = "road-down" or meaning = "road-middle-v") and (pycor mod 22 = 8 or pycor mod 22 = 9)][

sprout-crossings 1 [

set shape "crossing"

set color white

set heading 0

set size 1

]

]

ask crossings with [pxcor mod 40 = 38] [

let newY one-of [1 -1]

ask crossings in-radius 3 with [shape = "crossing"] [

set ycorycor + newY

]

]

ask crossings with [pxcor mod 40 = 38] [

set shape "waitpoint"

set meaning "waitpoint2"

set color black + 1

stamp die

]

ask patches with [(meaning = "road-left" or meaning = "road-right" or meaning = "road-middle-h") and (pxcor mod 40 = 18 or pxcor mod 40 = 19)][

sprout-crossings 1 [

set shape "crossing"

set heading 90

set color white

set size 1

]

]

ask crossings with [pycor mod 22 = 20] [

let newX one-of [1 2 3 4 5 -1 -2 -3 -4 -5]

ask crossings in-radius 3 with [shape = "crossing"] [

set xcorxcor + newX

]

]

ask crossings with [pycor mod 22 = 20] [

set heading 90

set shape "waitpoint"

set meaning "waitpoint2"

set color black + 1

stamp die

]

ask crossings [

set will-cross? false

set meaning "crossing"

stamp

die

]

ask patches with [meaning = "crossing"] [

ask neighbors4 [

if meaning = "sidewalk" [

set meaning "waitpoint"

]

]

]

end

to place-cars

ask n-of (num-of-cars / 3) patches with [meaning = "road-up"] [

if not any? cars-on patch pxcor (pycor + 1) and not any? cars-here and not any? cars-on patch pxcor (pycor - 1) and not any? patches with [meaning = "crossing"] in-radius 2 [

sprout-cars 1 [

set size 2

set will-turn? "maybe"

set will-stop? "maybe"

set shape "car top"

set color grey

set heading 0

let s random 5

if s < 3 [set maxSpeed speed-limit - 0.7 + random 0.8]

if s = 3 [set maxSpeed speed-limit - 1 + random 0.3]

if s > 3 [set maxSpeed speed-limit + random 0.8]

set speed maxSpeed - random 1

]

]

]

ask n-of (num-of-cars / 3) patches with [meaning = "road-down" and count turtles-on neighbors = 0] [

if not any? cars-on patch pxcor (pycor + 1) and not any? cars-here and not any? cars-on patch pxcor (pycor - 1) and not any? patches with [meaning = "crossing"] in-radius 2 [

sprout-cars 1 [

set size 2

set shape "car top"

set color grey

set heading 180

set will-turn? "maybe"

set will-stop? "maybe"

let s random 10

if s < 7 [set maxSpeed speed-limit - 1.5 + random 1.6]

if s = 7 [set maxSpeed speed-limit - 2.0 + random 0.6]

if s > 7 [set maxSpeed speed-limit + random 1.6]

set speed maxSpeed - random 2

]

]

]

ask n-of (num-of-cars / 3) patches with [meaning = "road-left" and count turtles-on neighbors = 0] [

if not any? cars-on patch (pxcor + 1) pycor and not any? cars-here and not any? cars-on patch (pxcor - 1) pycor and not any? patches with [meaning = "crossing"] in-radius 2 [

sprout-cars 1 [

set will-turn? "maybe"

set will-stop? "maybe"

set size 2

set color grey

set shape "car top"

set heading 270

let s random 10

if s < 7 [set maxSpeed speed-limit - 1.5 + random 1.6]

if s = 7 [set maxSpeed speed-limit - 2 + random 0.6]

if s > 7 [set maxSpeed speed-limit + random 1.6]

set speed maxSpeed - random 2

]

]

]

while [count cars < num-of-cars] [

ask one-of patches with [meaning = "road-right"] [

if not any? cars-on patch (pxcor + 1) pycor and not any? cars-here and not any? cars-on patch (pxcor - 1) pycor and not any? patches with [meaning = "crossing"] in-radius 2 [

sprout-cars 1 [

set will-turn? "maybe"

set will-stop? "maybe"

set size 2

set color grey

set shape "car top"

set heading 90

let s random 10

if s < 7 [set maxSpeed speed-limit - 15 + random 16]

if s = 7 [set maxSpeed speed-limit - 20 + random 6]

if s > 7 [set maxSpeed speed-limit + random 16]

set speed maxSpeed - random 20

]

]

]

]

end

to place-lights

ask patches with [(pycor mod 22 = 0 or pycor mod 22 = 21) and pxcor mod 40 = 1] [

sprout-lightsL 1 [

set color red

set shape "lights"

]

]

ask patches with [(pycor mod 22 = 19 or pycor mod 22 = 18) and pxcor mod 40 = 35] [

sprout-lightsR 1 [

set color red

set shape "lights"

]

]

ask patches with [(pxcor mod 40 = 36 or pxcor mod 40 = 37) and pycor mod 22 = 1] [

sprout-lightsD 1 [

set color green

set shape "lights"

]

]

ask patches with [(pxcor mod 40 = 39 or pxcor mod 40 = 0) and pycor mod 22 = 17] [

sprout-lightsU 1 [

set color green

set shape "lights"

]

]

set greenH 0

set redH 1

set redV 0

set greenV 1

end

to control-speed

let car-ahead one-of cars-on patch-ahead 1.5

ifelse car-ahead = nobody [

ifelse speed <maxSpeed [set speed speed + acceleration] [set speed speed - deceleration]

]

[

ifelse [speed] of car-ahead = 0 [set speed 0] [

ifelse [speed] of car-ahead >= maxSpeed [

set speed maxSpeed

set speed speed - deceleration

] [

ifelse [meaning] of patch-left-and-ahead 90 1 = meaning and not any? turtles-on patch-left-and-ahead 90 1 and [meaning] of patch-left-and-ahead 90 1 != "crossroad"

and meaning != "crossing" and [meaning] of patch-left-and-ahead 180 1.3 != "crossing" and not any? turtles-on patch-left-and-ahead 169 3

and not any? turtles-on patch-left-and-ahead 45 1 and not any? turtles-on patch-left-and-ahead 135 1 and not any? turtles-on patch-left-and-ahead 23 2

and not any? turtles-on patch-left-and-ahead 157 2 and not any? turtles-on patch-left-and-ahead 12 3 and [meaning] of patch-ahead 1 != "crossing" [move-to patch-left-and-ahead 90 1] [

ifelse [meaning] of patch-right-and-ahead 90 1 = meaning and not any? turtles-on patch-right-and-ahead 90 14 and [meaning] of patch-right-and-ahead 90 1 != "crossroad"

and meaning != "crossing" and [meaning] of patch-right-and-ahead 180 1.3 != "crossing" and not any? turtles-on patch-right-and-ahead 12 3

and not any? turtles-on patch-right-and-ahead 45 1 and not any? turtles-on patch-right-and-ahead 135 1 and not any? turtles-on patch-right-and-ahead 23 2

and not any? turtles-on patch-right-and-ahead 157 2 and not any? turtles-on patch-right-and-ahead 169 3 and [meaning] of patch-ahead 1 != "crossing"[move-to patch-right-and-ahead 90 1] [

set speed [speed] of car-ahead

set speed speed - deceleration]

]

]

]

]

end

to-report can-turn-right?

if pxcor mod 40 = 0 and pycor mod 22 = 18 and heading = 0 [report true]

if pxcor mod 40 = 36 and pycor mod 22 = 0 and heading = 180 [report true]

if pxcor mod 40 = 36 and pycor mod 22 = 18 and heading = 90 [report true]

if pxcor mod 40 = 0 and pycor mod 22 = 0 and heading = 270 [report true]

report false

end

to-report can-turn-left?

if pxcor mod 40 = 39 and pycor mod 22 = 18 and heading = 0 [report true]

if pxcor mod 40 = 37 and pycor mod 22 = 0 and heading = 180 [report true]

if pxcor mod 40 = 36 and pycor mod 22 = 19 and heading = 90 [report true]

if pxcor mod 40 = 0 and pycor mod 22 = 21 and heading = 270 [report true]

report false

end

to move-cars

ask cars [

control-speed

if will-turn? = "maybe" [

if can-turn-right? [

ifelse random 100 < 70 [

set will-turn? "yesR"

move-to patch-ahead 0 rt 35

]

[set will-turn? "no"]

]

if turning-left? [

if can-turn-left? [

ifelse random 100 < 70 [

move-to patch-ahead 0 lt 35

set will-turn? "yesL"

set turnX [pxcor] of patch-left-and-ahead 1 4

set turnY [pycor] of patch-left-and-ahead 1 4

]

[set will-turn? "no"]

]

]

]

if will-turn? = "yesR" [

ifelse not any? cars-on patch-right-and-ahead 55 1 [

if speed < 15 [

set speed 15

]

rt 55

set will-turn? "no"

]

[

set speed 0

]

]

if will-turn? = "yesL" [

ifelse safe-to-turn? [

if speed < 15 [

set speed 15

]

if pxcor = turnX and pycor = turnY [

move-to patch-ahead 0

lt 55

set will-turn? "no"

]

]

[

set speed 0

]

]

if meaning = "crossing" [

set will-turn? "maybe"

]

check-crossing

;whether traffic lights show red or green

ifelse not any? (lightsR-on patch-ahead 1.5) with [color = red] and not any? (lightsL-on patch-ahead 1.5) with [color = red]

and not any? (lightsD-on patch-ahead 1.5) with [color = red] and not any? (lightsU-on patch-ahead 1.5) with [color = red] [fd speed / 200 ] [set speed 0]

]

end

to check-crossing

if [meaning] of patch-ahead 1 = "crossing" and will-stop? = "maybe"[

if [used] of patch-ahead 1 = 0 and will-stop? = "maybe"[

set will-stop? "no"

ask patch-ahead 1 [

set traffic traffic + 1

ask other neighbors with [meaning = "crossing"] [set traffic traffic + 1]

]

]

if [used] of patch-ahead 1 > 0 and will-stop? = "maybe"[

ifelse random 100 < politeness [

set will-stop? "yes"

set speed 0

]

[

set will-stop? "no"

ask patch-ahead 1 [

set traffic traffic + 1

ask other neighbors with [meaning = "crossing"] [set traffic traffic + 1]

]

if any? persons-on patch-ahead 1 or any? persons-on patch-ahead 2 [set speed 0]

]

]

]

if [meaning] of patch-ahead 1 = "crossing" and [meaning] of patch-ahead 2 = "crossing" and will-stop? = "yes" and [used] of patch-ahead 1 > 0 [set speed 0]

if [meaning] of patch-left-and-ahead 180 1 = "crossing" and [meaning] of patch-left-and-ahead 180 2 = "crossing" and will-stop? = "no" and meaning != "crossing" [

set will-stop? "maybe"

ask patch-left-and-ahead 180 1 [

set traffic traffic - 1

ask other neighbors with [meaning = "crossing"] [set traffic traffic - 1]

]

]

if meaning = "crossroad" and will-stop? != "maybe" [

set will-stop? "maybe"

]

end

to-report safe-to-turn?

if not any? cars-on patch-right-and-ahead 1 5 and not any? cars-on patch-right-and-ahead 1 6 and

not any? cars-on patch-right-and-ahead 10 7 and not any? cars-on patch-right-and-ahead 10 8 and

not any? cars-on patch-right-and-ahead 15 9 and not any? cars-on patch-right-and-ahead 15 10 and not any? cars-on patch-right-and-ahead 17 11 [

if any? (cars-on patch-right-and-ahead 10 4) with [will-turn? = "yesL"] [report true]

if not any? cars-on patch-right-and-ahead 10 4 [report true]

]

if count turtles with [shape = "lights" and color = red] in-cone 7 70 > 1 [report true]

report false

end

to place-centers

if mouse-down? [

create-stations 1

[

setxy mouse-xcor mouse-ycor

set color [0 255 0 4]

set shape "circle"

set size radius

]

display

]

end

Размещено на Allbest.ru

...

Подобные документы

  • Понятие и классификация алгоритмов маршрутизации. Основное определение теории графов. Анализ и разработка алгоритмов Дейкстры и Флойда на языке программирования C# для определения наилучшего пути пакетов, передаваемых через сеть. Их сравнительный анализ.

    курсовая работа [1,2 M], добавлен 16.05.2015

  • Использование понятий из теории графов при разработке сетей и алгоритмов маршрутизации. Построение матрицы смежности и взвешенного ориентировочного графа. Результаты работы алгоритмов Дейкстры и Беллмана-Форда. Протоколы обмена маршрутной информацией.

    курсовая работа [334,1 K], добавлен 20.01.2013

  • Анализ проблемы обеспечения информационной безопасности при работе в сетях; обоснование необходимости разработки алгоритмов безопасной маршрутизации пакетов сообщений в глобальной информационной сети. Алгоритмизация задач безопасной маршрутизации пакетов.

    дипломная работа [1,0 M], добавлен 21.12.2012

  • Основные характеристики и алгоритмы настройки виртуальной локальной вычислительной сети VLAN, протоколов маршрутизации, системы доменных имен и трансляции сетевых адресов с целью разработки корпоративной сети в среде имитационного моделирования.

    курсовая работа [556,1 K], добавлен 23.04.2011

  • Описание широкополосных сетей интегрального обслуживания, классификация алгоритмов маршрутизации. Реализация логического способа формирования плана распределения информации в схеме маршрутизатора. Математическая модель и метод анализа маршрутизации.

    дипломная работа [1,1 M], добавлен 31.10.2010

  • Цель маршрутизации - доставка пакетов по назначению с максимизацией эффективности. Построение алгоритмов поиска кратчайшего пути маршрутизации, расчёт пути с минимальным количеством переходов. Характеристики протокола RIP и построение маршрутных таблиц.

    курсовая работа [74,1 K], добавлен 26.08.2010

  • Основные положения, связанные с маршрутизацией компьютерных сетей и её видами, протоколами маршрутизации и их разновидностями, алгоритмами маршрутизации, их классификацией, типами и свойствами. Разработка программы и моделирование компьютерной сети.

    курсовая работа [1,8 M], добавлен 04.11.2012

  • Центральные магистрали передачи данных. Улучшение параметров мультисервисной сети за счет использования имитационного моделирования. Сети с трансляцией ячеек и с установлением соединения. Коммутация в сети Ethernet. Многоуровневая модель протоколов.

    курсовая работа [2,3 M], добавлен 25.06.2014

  • Концепция мультисервисных сетей, их архитектура и основные предъявляемые требования. Главные понятия и виды маршрутизации, методы ее реализации, классификация алгоритмов. Анализ и оценка функционирования мультисервисной сети с адаптивной маршрутизацией.

    курсовая работа [46,5 K], добавлен 22.07.2012

  • Использование базы данных статистики последовательного соединения мобильных узлов беспроводной сети с использованием средств программирования Delphi и языка ADO. Оптимизация, отладка и тестирование программы AD-HOC сетей, решение аномалий в узлах сети.

    дипломная работа [1,7 M], добавлен 13.06.2012

  • Рассмотрение понятия обмена информацией в сети. Изучение протоколов динамической маршрутизации различных комбинаций соединений Ethernet и Serial. Определение зависимости прохождения сигнала от типа порта и кабеля. Применение данных типов маршрутизации.

    курсовая работа [1,3 M], добавлен 28.05.2014

  • Беспроводные сенсорные сети: история и использование, алгоритмы канального уровня. Требования к алгоритмам маршрутизации в беспроводных сенсорных сетях, имитационное моделирование. Исследование надежности передачи данных между узлами в системе Castalia.

    магистерская работа [2,1 M], добавлен 11.10.2013

  • Принципы разработки алгоритмов и программ на основе процедурного подхода и на основе объектно-ориентированного подхода. Реализация программы Borland Pascal 7.0, ее интерфейс. Разработка простой программы в среде визуального программирования Delphi.

    отчет по практике [934,7 K], добавлен 25.03.2012

  • Разработка программы – сетевого эмулятора, позволяющего представить в графическом виде топологию маршрутизируемой сети. Сравнительный анализ существующих программных эмуляторов сетей и сетевого оборудования. Моделирование протоколов маршрутизации.

    дипломная работа [512,2 K], добавлен 26.09.2014

  • Детерминированный и вероятностный подходы к оценке живучести сетей. Анализ моделей гибели и вероятности связности сетей. Табличное представление результатов вычислений и построение графических зависимостей в программе, написанной на языке Object Pascal.

    дипломная работа [2,9 M], добавлен 03.09.2013

  • Задача и особенности составления таблиц маршрутизации. Принципы процесса определения маршрута следования информации в сетях связи в TCP/IP. Процесс обмена пакетами информации путем использования протоколов Routing Information, Open Shortest Path First.

    презентация [494,8 K], добавлен 23.01.2014

  • Описание систем управления процессами маршрутизации пакетов, передаваемых через компьютерную сеть. Изучение методов теории выбора кратчайших путей. Разработка программы маршрутизации данных и определение кратчайших путей их маршрутов методом Дейкстры.

    курсовая работа [495,7 K], добавлен 24.06.2013

  • TCP/IP-установка протоколов, используемых для связи компьютерных сетей и маршрутизации движения информации между большим количеством различных компьютеров. "TCP" означает "Протокол контроля передачи". "IP" означает "Протокол межсетевого взаимодействия".

    контрольная работа [23,4 K], добавлен 04.10.2008

  • Особенности проектирования и анализ современных информационных локальных и глобальных вычислительных сетей. Проведение настройки виртуальной локальной вычислительной сети (VLAN), HTTP и DNS серверов, сетевых протоколов OSPF, RIP, STP, технологий NAT.

    курсовая работа [182,1 K], добавлен 16.01.2014

  • Понятие локальной вычислительной сети, ее сущность и особенности, структура и основные элементы. Факторы, влияющие на выбор физической среды передачи. Порядок и этапы составления протоколов маршрутизации, используемые в них алгоритмы и их разновидности.

    реферат [246,6 K], добавлен 02.02.2009

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.