Location Dataclass
Module containing location representation for the AMR Hub ABM simulation.
Location
dataclass
Representation of a location in the AMR Hub ABM simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
The x-coordinate of the location. |
required |
y
|
float
|
The y-coordinate of the location. |
required |
floor
|
int
|
The floor number of the location. |
required |
building
|
str | None
|
The building name of the location. Defaults to None, which indicates that the location is not associated with a specific building. |
None
|
Source code in src/amr_hub_abm/spatial/location.py
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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
__repr__()
Return a string representation of the location.
Source code in src/amr_hub_abm/spatial/location.py
68 69 70 71 72 | |
check_intersection_with_walls(loc_x, loc_y, interaction_radius, walls)
staticmethod
Check if the agent intersects with any walls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loc_x
|
float
|
The x-coordinate of the agent's location. |
required |
loc_y
|
float
|
The y-coordinate of the agent's location. |
required |
interaction_radius
|
float
|
The radius within which the agent is considered to interact with walls. |
required |
walls
|
list[Wall]
|
The list of walls to consider. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the agent intersects with any walls, False otherwise. |
Source code in src/amr_hub_abm/spatial/location.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
check_line_of_sight(other, walls)
Check if there is a line of sight to another location, considering walls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Location
|
The other location to check line of sight to. |
required |
walls
|
list[Wall]
|
The list of walls to consider. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if there is a line of sight, False otherwise. |
Source code in src/amr_hub_abm/spatial/location.py
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 | |
distance_to(other)
Calculate the Euclidean distance to another location.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Location
|
The other location to calculate the distance to. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The Euclidean distance between the two locations. |
Raises:
| Type | Description |
|---|---|
InvalidDistanceError
|
If the two locations are in different buildings or on different floors. |
Source code in src/amr_hub_abm/spatial/location.py
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 | |