-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlegacy_consts.py
103 lines (95 loc) · 4.01 KB
/
legacy_consts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import numpy as np
# Note this is mostly legacy, many of these values were used during testing to find a good set of parameters.
"""Visualisation settings"""
VISUALISATION_NORMAL = 60
VISUALISATION_REAL_TIME = 0
"""Noise percentage"""
# NOISE_FRACTION = 1
NOISE_FRACTION = 0.05
# NOISE_FRACTION = 0
"""Swarm size and density"""
SWARM_SIZE = 100
# SWARM_SIZE = 50
# Swarm density is measured in entities / area (grid_size^2)
# A swarm density of 1 means 1 boid per grid unit, meaning a density of 1 with a swarm size of 100 will produce a grid of size 10x10
SWARM_DENSITY = 0.25
# SWARM_DENSITY = 0.6
GRID_SIZE = np.sqrt(SWARM_SIZE / SWARM_DENSITY) - 1
"""Parameter tuning"""
# RADIUS_MODEL = "MIN_MARUYAMA"
# RADIUS_MODEL = "MARUYAMA"
RADIUS_MODEL = "EXTENDED_MARUYAMA"
# RADIUS_MODEL = "DIRECTIONAL_MARUYAMA"
# RADIUS_MODEL = "CIRCULAR_MARUYAMA"
# RADIUS_MODEL = "MAXIMUM_MARUYAMA"
match RADIUS_MODEL:
case "FULL":
COLLISION_AVOIDANCE_RADIUS = GRID_SIZE
VELOCITY_MATCHING_RADIUS = GRID_SIZE
FLOCK_CENTERING_RADIUS = GRID_SIZE
case "MARUYAMA":
COLLISION_AVOIDANCE_RADIUS = GRID_SIZE * 0.01
VELOCITY_MATCHING_RADIUS = GRID_SIZE * 0.05
FLOCK_CENTERING_RADIUS = GRID_SIZE * 0.05
case "MIN_MARUYAMA":
EXTENDED_MULTIPLIER = 0.5
COLLISION_AVOIDANCE_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.01
VELOCITY_MATCHING_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.05
FLOCK_CENTERING_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.05
case "EXTENDED_MARUYAMA":
EXTENDED_MULTIPLIER = 3.5
COLLISION_AVOIDANCE_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.01
VELOCITY_MATCHING_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.05
FLOCK_CENTERING_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.05
case "DIRECTIONAL_MARUYAMA":
EXTENDED_MULTIPLIER = 5
COLLISION_AVOIDANCE_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.01
VELOCITY_MATCHING_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.05
FLOCK_CENTERING_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.05
case "CIRCULAR_MARUYAMA":
EXTENDED_MULTIPLIER = 5.5
COLLISION_AVOIDANCE_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.01
VELOCITY_MATCHING_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.05
FLOCK_CENTERING_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.05
case "MAXIMUM_MARUYAMA":
EXTENDED_MULTIPLIER = 20
COLLISION_AVOIDANCE_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.01
VELOCITY_MATCHING_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.05
FLOCK_CENTERING_RADIUS = EXTENDED_MULTIPLIER * GRID_SIZE * 0.05
case "EQUAL":
COLLISION_AVOIDANCE_RADIUS = GRID_SIZE * 0.25
VELOCITY_MATCHING_RADIUS = GRID_SIZE * 0.25
FLOCK_CENTERING_RADIUS = GRID_SIZE * 0.25
case "STAGGERED":
COLLISION_AVOIDANCE_RADIUS = GRID_SIZE * 0.2
VELOCITY_MATCHING_RADIUS = GRID_SIZE * 0.25
FLOCK_CENTERING_RADIUS = GRID_SIZE * 0.3
WEIGHTING_MODEL = "MARUYAMA"
match WEIGHTING_MODEL:
case "ZHANG": # From Zhang et al.
COLLISION_AVOIDANCE_WEIGHTING = 400
VELOCITY_MATCHING_WEIGHTING = 1
FLOCK_CENTERING_WEIGHTING = 10
case "MARUYAMA": # From Maruyama et al.
COLLISION_AVOIDANCE_WEIGHTING = 0.002 # 1/35
VELOCITY_MATCHING_WEIGHTING = 0.06 # 30/35
FLOCK_CENTERING_WEIGHTING = 0.008 # 4/35
case "COLLISION_AVOIDANCE":
COLLISION_AVOIDANCE_WEIGHTING = 1
VELOCITY_MATCHING_WEIGHTING = 0
FLOCK_CENTERING_WEIGHTING = 0
case "VELOCITY_MATCHING":
COLLISION_AVOIDANCE_WEIGHTING = 0
VELOCITY_MATCHING_WEIGHTING = 1
FLOCK_CENTERING_WEIGHTING = 0
case "FLOCK_CENTERING":
COLLISION_AVOIDANCE_WEIGHTING = 0
VELOCITY_MATCHING_WEIGHTING = 0
FLOCK_CENTERING_WEIGHTING = 1
case "EQUAL":
COLLISION_AVOIDANCE_WEIGHTING = 1
VELOCITY_MATCHING_WEIGHTING = 1
FLOCK_CENTERING_WEIGHTING = 1
case _:
raise ValueError("Invalid weighting model")
# RANDOM_SEED = 123456789