API reference
amr_hub_abm package.
agent
Module to represent an agent in the AMR Hub ABM simulation.
Agent
dataclass
Representation of an agent in the AMR Hub ABM simulation.
Source code in src/amr_hub_abm/agent.py
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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | |
heading_degrees
property
writable
Get the agent's heading in degrees.
__post_init__()
Post-initialization to log agent creation.
Source code in src/amr_hub_abm/agent.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
__repr__()
Return a string representation of the agent.
Source code in src/amr_hub_abm/agent.py
233 234 235 236 237 238 239 240 | |
add_task(time, location, event_type, additional_info=None)
Add a task to the agent's task list and log the addition.
Source code in src/amr_hub_abm/agent.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | |
attempt_task_insertion(next_task, next_task_move_time, current_time)
Attempt to insert a task to occupy an empty chair.
Source code in src/amr_hub_abm/agent.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | |
check_if_location_reached(target_location)
Check if the agent has reached the target location.
Source code in src/amr_hub_abm/agent.py
182 183 184 185 186 187 188 189 190 | |
estimate_time_to_reach_location(target_location)
Estimate the time required to reach a target location.
Source code in src/amr_hub_abm/agent.py
583 584 585 586 | |
get_room(coords=None)
Get the room the agent is currently located in, if any.
Source code in src/amr_hub_abm/agent.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
head_to_point(point)
Set the agent's heading to face a specific point.
Source code in src/amr_hub_abm/agent.py
332 333 334 335 336 337 | |
move_one_step(stochasticity=0.2)
Move the agent one step in the direction of its heading.
Source code in src/amr_hub_abm/agent.py
422 423 424 425 | |
move_to_location(new_location)
Move the agent to a new location and log the movement.
Source code in src/amr_hub_abm/agent.py
192 193 194 195 196 | |
perform_in_progress_task(current_time)
Perform an in-progress task and return True if a task was performed.
Source code in src/amr_hub_abm/agent.py
441 442 443 444 445 446 447 | |
perform_moving_to_task_location(current_time)
Move the agent towards the location of its next task.
Source code in src/amr_hub_abm/agent.py
449 450 451 452 453 454 455 | |
perform_suspended_task(current_time)
Perform a suspended task and return True if a task was performed.
Source code in src/amr_hub_abm/agent.py
457 458 459 460 461 462 463 464 465 | |
perform_task(current_time, *, record=False)
Perform the agent's current task if it's due.
Source code in src/amr_hub_abm/agent.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | |
perform_to_be_started_task(current_time)
Perform a to-be-started task and return True if a task was performed.
Source code in src/amr_hub_abm/agent.py
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | |
plot_agent(ax, *, show_tags=True)
Plot the agent on the given axes.
Source code in src/amr_hub_abm/agent.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
plot_trajectory(ax)
Plot the agent's trajectory on the given axes.
Source code in src/amr_hub_abm/agent.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
propose_new_coordinates(coordinates, heading_rad, movement_speed, stochasticity, rng_generator)
staticmethod
Propose a new location for agent movement.
Source code in src/amr_hub_abm/agent.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
record_state(current_time)
Push a record of the agent's current state to the trajectory.
Source code in src/amr_hub_abm/agent.py
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | |
select_task_based_on_progress(progress, *, allow_multiple=False)
Select a task based on its progress.
Source code in src/amr_hub_abm/agent.py
427 428 429 430 431 432 433 434 435 436 437 438 439 | |
try_move_one_step(stochasticity, max_attempts=5)
Return valid coordinates for a single movement step.
Source code in src/amr_hub_abm/agent.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | |
AgentType
Bases: IntEnum
Enumeration of possible agent types.
Source code in src/amr_hub_abm/agent.py
43 44 45 46 47 48 | |
InfectionStatus
Bases: IntEnum
Enumeration of possible infection statuses.
Source code in src/amr_hub_abm/agent.py
58 59 60 61 62 63 64 | |
Record
dataclass
Representation of a record of an agent's state at a given time step.
Source code in src/amr_hub_abm/agent.py
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 | |
__post_init__()
Post-initialization to setup the record arrays.
Source code in src/amr_hub_abm/agent.py
79 80 81 82 83 84 85 | |
push(time, building_idx, floor, pos_x, pos_y, heading, infection_status)
Push a new record of the agent's state at a given time step.
Source code in src/amr_hub_abm/agent.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
exceptions
Module defining all custom exceptions for the AMR Hub ABM simulation.
InvalidDefinitionError
Bases: Exception
Exception raised when a general invalid definition is encountered.
Source code in src/amr_hub_abm/exceptions.py
53 54 55 56 57 58 | |
__init__(message)
Initialize the InvalidDefinitionError.
Source code in src/amr_hub_abm/exceptions.py
56 57 58 | |
InvalidDistanceError
Bases: Exception
Exception raised when an invalid distance calculation is attempted.
Source code in src/amr_hub_abm/exceptions.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
__init__(locations, building)
Initialize the InvalidDistanceError.
Source code in src/amr_hub_abm/exceptions.py
15 16 17 18 19 20 21 22 23 24 25 26 | |
InvalidDoorError
Bases: Exception
Exception raised when a door is defined with invalid parameters.
Source code in src/amr_hub_abm/exceptions.py
45 46 47 48 49 50 | |
__init__(message)
Initialize the InvalidDoorError.
Source code in src/amr_hub_abm/exceptions.py
48 49 50 | |
InvalidRoomError
Bases: Exception
Exception raised when a room is defined with invalid parameters.
Source code in src/amr_hub_abm/exceptions.py
37 38 39 40 41 42 | |
__init__(message)
Initialize the InvalidRoomError.
Source code in src/amr_hub_abm/exceptions.py
40 41 42 | |
SimulationModeError
Bases: Exception
Exception raised when an operation is invalid for the current simulation mode.
Source code in src/amr_hub_abm/exceptions.py
4 5 6 7 8 9 | |
__init__(message)
Initialize the SimulationModeError.
Source code in src/amr_hub_abm/exceptions.py
7 8 9 | |
TimeError
Bases: Exception
Exception raised when a negative time value is encountered.
Source code in src/amr_hub_abm/exceptions.py
29 30 31 32 33 34 | |
__init__(message)
Initialize the TimeError.
Source code in src/amr_hub_abm/exceptions.py
32 33 34 | |
read_space_input
Module to import space input data for the AMR Hub ABM simulation.
SpaceInputReader
dataclass
Class to read space input data from a YAML file.
Source code in src/amr_hub_abm/read_space_input.py
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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
__post_init__()
Post-initialization to read and validate the YAML file.
Source code in src/amr_hub_abm/read_space_input.py
52 53 54 55 56 57 58 59 60 61 62 63 | |
check_tuple_length(data_tuple, expected_length, data_type)
staticmethod
Check if a data tuple has the expected length.
Source code in src/amr_hub_abm/read_space_input.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
create_doors_from_detatched_doors()
Create Door instances from detatched doors.
Source code in src/amr_hub_abm/read_space_input.py
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 134 135 136 137 138 139 140 | |
create_room(room_data, room_id, building_name, floor_level)
Create a Room instance from room data.
Source code in src/amr_hub_abm/read_space_input.py
206 207 208 209 210 211 212 213 214 | |
create_rooms_from_data()
Create Room instances from the validated data.
Source code in src/amr_hub_abm/read_space_input.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
create_spatial_room(room_data, room_id, building_name, floor_level)
Create a spatial Room instance from room data.
Source code in src/amr_hub_abm/read_space_input.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
create_topological_room(room_data, room_id, building_name, floor_level)
Create a topological Room instance from room data.
Source code in src/amr_hub_abm/read_space_input.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
get_room_name_dict()
Extract room names and their corresponding detatched doors.
Source code in src/amr_hub_abm/read_space_input.py
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 | |
organise_rooms_into_floors_and_buildings(rooms)
staticmethod
Organize rooms into floors and buildings.
Source code in src/amr_hub_abm/read_space_input.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
validate_building_data(building_data)
staticmethod
Validate the building data structure.
Source code in src/amr_hub_abm/read_space_input.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
validate_floor_data(floor_data)
staticmethod
Validate the floor data structure.
Source code in src/amr_hub_abm/read_space_input.py
303 304 305 306 307 308 309 310 311 312 313 314 | |
validate_room_data(room_data)
staticmethod
Validate the room data structure.
Source code in src/amr_hub_abm/read_space_input.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | |
validation()
Validate the space input data from the YAML file.
Source code in src/amr_hub_abm/read_space_input.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
run
Module to run the AMR Hub ABM simulation.
run_steps(simulation, plot_path, *, record)
Run the simulation steps until completion.
Source code in src/amr_hub_abm/run.py
53 54 55 56 57 58 59 60 61 62 63 64 | |
simulate(*, plot=False, record=False, plot_trajectory=False)
Simulate the AMR Hub ABM based on a configuration file.
Source code in src/amr_hub_abm/run.py
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 | |
simulation
The main simulation module for the AMR Hub ABM.
Simulation
dataclass
Representation of the AMR Hub ABM simulation.
Source code in src/amr_hub_abm/simulation.py
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 134 135 136 137 138 139 140 141 142 143 | |
rooms
property
Get all rooms in the simulation space.
__repr__()
Representation of the simulation.
Source code in src/amr_hub_abm/simulation.py
93 94 95 96 97 98 99 100 101 102 103 104 105 | |
plot_agent_trajectories(output_file)
Plot the trajectories of all agents from a recorded CSV file.
Source code in src/amr_hub_abm/simulation.py
141 142 143 | |
plot_current_state(directory_path, *, trajectory=False)
Plot the current state of the simulation.
Source code in src/amr_hub_abm/simulation.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
record_agent_states(file_path)
Record the states of all agents at the current time step to a CSV file.
Source code in src/amr_hub_abm/simulation.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
step(plot_path=None, *, record=False)
Advance the simulation by one time step.
Source code in src/amr_hub_abm/simulation.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
SimulationMode
Bases: IntEnum
Enumeration of simulation modes.
Source code in src/amr_hub_abm/simulation.py
24 25 26 27 28 | |
simulation_factory
Module for creating simulation instances.
create_simulation(config_file)
Create a simulation instance from a configuration file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_file
|
Path
|
Path to the configuration file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Simulation |
Simulation
|
An instance of the Simulation class. |
Source code in src/amr_hub_abm/simulation_factory.py
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 | |
create_space_from_rooms(rooms)
Create a list of Building instances from a list of Room instances.
Source code in src/amr_hub_abm/simulation_factory.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
get_random_location(room, building, floor)
Get a random location within a room.
Source code in src/amr_hub_abm/simulation_factory.py
126 127 128 129 130 131 132 133 134 | |
parse_location_string(location_str)
Parse a location string into its components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location_str
|
str
|
The location string in the format "BuildingName:x,y". |
required |
Returns:
| Type | Description |
|---|---|
str
|
tuple[str, int, str]: A tuple containing the building name, floor number, |
int
|
and room name. |
Source code in src/amr_hub_abm/simulation_factory.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
parse_location_timeseries(timeseries_data, rooms, start_time, total_time_steps, time_scaling_factor, rng_generator)
Parse a CSV file containing location time series data for agents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeseries_data
|
DataFrame
|
DataFrame containing the location time series. |
required |
Returns:
| Type | Description |
|---|---|
list[Agent]
|
list[Agent]: A list of Agent instances with populated location time series. |
Source code in src/amr_hub_abm/simulation_factory.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |
read_location_timeseries(file_path)
Read a CSV file containing location time series data for agents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
Path to the CSV file. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: DataFrame containing the location time series data. |
Source code in src/amr_hub_abm/simulation_factory.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
timestamp_to_timestep(timestamp, start_time, time_scaling_factor)
Convert a timestamp to a simulation time step index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamp
|
Timestamp
|
The timestamp to convert. |
required |
start_time
|
Timestamp
|
The simulation start time. |
required |
time_scaling_factor
|
int
|
The duration of timestep in seconds. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The corresponding time step index. |
Source code in src/amr_hub_abm/simulation_factory.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | |
update_hcw(hcw_id, space_tuple, event_tuple, hcw_dict, total_time_steps, space, rng_generator, additional_info=None)
Update healthcare worker information from data.
Source code in src/amr_hub_abm/simulation_factory.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
update_patient(patient_id, space_tuple, patient_dict, total_time_steps, space, rng_generator)
Update patient information from data.
Source code in src/amr_hub_abm/simulation_factory.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
space
Space module for the AMR Hub ABM simulation.
building
Module containing building representation for the AMR Hub ABM simulation.
Building
dataclass
Representation of a building in the AMR Hub ABM simulation.
Source code in src/amr_hub_abm/space/building.py
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 | |
plot_building(axes, agents=None, *, trajectory=False)
Plot the building layout.
Source code in src/amr_hub_abm/space/building.py
23 24 25 26 27 28 29 30 31 32 | |
sort_and_number_buildings(buildings)
staticmethod
Sort and number buildings by name.
Source code in src/amr_hub_abm/space/building.py
34 35 36 37 38 39 40 | |
content
Module defining room content types for the rooms of the AMR Hub ABM simulation.
Content
dataclass
Enumeration of possible room contents.
Source code in src/amr_hub_abm/space/content.py
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 | |
length
property
Get the length of the content based on its type.
occupied
property
Check if the content is currently occupied by an agent.
polygon
property
Get the polygon representation of the content.
position
property
Get the (x, y) position of the content.
width
property
Get the width of the content based on its type.
__post_init__()
Post-initialization to set content_id based on content_type and position.
Source code in src/amr_hub_abm/space/content.py
51 52 53 54 55 56 | |
ContentType
Bases: IntEnum
Enumeration of possible room content types.
Source code in src/amr_hub_abm/space/content.py
16 17 18 19 20 21 | |
door
Module defining door representation for the AMR Hub ABM simulation.
DetachedDoor
dataclass
Representation of a detached door in the AMR Hub ABM simulation.
Source code in src/amr_hub_abm/space/door.py
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 | |
__eq__(other)
Define equality comparison for DetachedDoor instances.
Source code in src/amr_hub_abm/space/door.py
31 32 33 34 35 | |
__hash__()
Define hash for DetachedDoor instances.
Source code in src/amr_hub_abm/space/door.py
37 38 39 | |
__post_init__()
Post-initialization to validate door coordinates.
Source code in src/amr_hub_abm/space/door.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
check_for_start_end_consistency()
Check that start and end points are consistent.
Source code in src/amr_hub_abm/space/door.py
41 42 43 44 45 46 47 48 49 | |
Door
dataclass
Bases: DetachedDoor
Representation of a door in the AMR Hub ABM simulation.
Source code in src/amr_hub_abm/space/door.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
line
property
Get the line representation of the door.
__lt__(other)
Define less-than comparison for Door instances.
Source code in src/amr_hub_abm/space/door.py
83 84 85 86 87 | |
__post_init__()
Post-initialization to validate door coordinates and create hash.
Source code in src/amr_hub_abm/space/door.py
89 90 91 | |
floor
Module for Floor class.
Floor
dataclass
Representation of a floor in a building.
Source code in src/amr_hub_abm/space/floor.py
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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
adjacency_matrix
property
Get the adjacency matrix representing room connections on the floor.
edge_set
property
Get a list of all wall edges on the floor.
room_ids
property
Get a list of room IDs on the floor.
room_names
property
Get a list of room names on the floor.
__post_init__()
Post-initialization to validate floor attributes.
Source code in src/amr_hub_abm/space/floor.py
28 29 30 31 32 33 | |
add_pseudo_rooms()
Add pseudo-rooms to the floor.
Source code in src/amr_hub_abm/space/floor.py
80 81 82 83 84 85 | |
create_spatial_room_from_pseudo_room(room)
staticmethod
Create a spatial room from a pseudo-room based on area.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
room
|
Room
|
The pseudo-room to convert. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Room |
Room
|
A spatial room with walls and doors based on the pseudo-room's area. |
Raises:
| Type | Description |
|---|---|
InvalidRoomError
|
If the pseudo-room does not have a valid positive area. |
Note
This method generates a rectangular room layout based on the area of the pseudo-room. The doors are positioned along one side of the rectangle. This function is not complete. Currently it only creates single simple rectangular rooms. Due to possibly complex topology, rectangular rooms may not always be a valid representation. Currently, no topology connections are considered. This function will be improved in future versions.
Source code in src/amr_hub_abm/space/floor.py
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 134 135 136 137 138 139 140 141 142 143 | |
find_room_by_location(location)
Find the room that contains the given location.
Source code in src/amr_hub_abm/space/floor.py
145 146 147 148 149 150 | |
plot(ax, agents=None, *, trajectory=False)
Plot the floor layout including rooms and doors.
Source code in src/amr_hub_abm/space/floor.py
73 74 75 76 77 78 | |
location
Module containing location representation for the AMR Hub ABM simulation.
Location
dataclass
Representation of a location in the AMR Hub ABM simulation.
Source code in src/amr_hub_abm/space/location.py
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 | |
__repr__()
Return a string representation of the location.
Source code in src/amr_hub_abm/space/location.py
42 43 44 45 46 | |
check_intersection_with_walls(loc_x, loc_y, interaction_radius, walls)
staticmethod
Check if the agent intersects with any walls.
Source code in src/amr_hub_abm/space/location.py
71 72 73 74 75 76 77 78 79 80 81 82 | |
check_line_of_sight(other, walls)
Check if there is a line of sight to another location, considering walls.
Source code in src/amr_hub_abm/space/location.py
57 58 59 60 61 62 63 64 65 66 67 68 69 | |
distance_to(other)
Calculate the Euclidean distance to another location.
Source code in src/amr_hub_abm/space/location.py
33 34 35 36 37 38 39 40 | |
move(new_x, new_y, new_floor)
Move the location to new coordinates.
Source code in src/amr_hub_abm/space/location.py
27 28 29 30 31 | |
which_room(rooms)
Determine which room the location is in, if any.
Source code in src/amr_hub_abm/space/location.py
48 49 50 51 52 53 54 55 | |
room
Module defining room-related classes for the AMR Hub ABM simulation.
Room
dataclass
Representation of a room in the AMR Hub ABM simulation.
Source code in src/amr_hub_abm/space/room.py
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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
__eq__(other)
Check equality of two rooms based on their unique hash strings.
Source code in src/amr_hub_abm/space/room.py
83 84 85 86 87 | |
__hash__()
Generate a hash for the room based on its unique hash string.
Source code in src/amr_hub_abm/space/room.py
79 80 81 | |
__post_init__()
Post-initialization to validate room attributes.
Source code in src/amr_hub_abm/space/room.py
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 | |
contains_point(point)
Check if a given point is inside the room.
Source code in src/amr_hub_abm/space/room.py
166 167 168 169 170 171 172 | |
create_name_hash()
Create a unique hash for the room based on its name.
Source code in src/amr_hub_abm/space/room.py
97 98 99 | |
create_polygon_hash()
Create a unique hash for the room based on its polygonal region.
Source code in src/amr_hub_abm/space/room.py
89 90 91 92 93 94 95 | |
form_region()
Get the polygonal region of the room based on its walls.
Source code in src/amr_hub_abm/space/room.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
get_door_access_point()
Get a point near one of the room's doors for access.
Source code in src/amr_hub_abm/space/room.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
get_random_point(max_attempts=1000)
Get a random point within the room.
Source code in src/amr_hub_abm/space/room.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
plot(ax, agents=None, *, trajectory=False, **kwargs)
Plot the room on a given matplotlib axis.
Source code in src/amr_hub_abm/space/room.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
validate_contents()
Validate that all contents are located within the room.
Source code in src/amr_hub_abm/space/room.py
216 217 218 219 220 221 222 223 224 225 | |
wall
Module defining wall representation for the AMR Hub ABM simulation.
Wall
dataclass
Representation of a wall in the AMR Hub ABM simulation.
Source code in src/amr_hub_abm/space/wall.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
line
property
Get the line representation of the wall.
polygon
property
Get the polygon representation of the wall based on its thickness.
plot(ax, **kwargs)
Plot the wall on a given matplotlib axis.
Source code in src/amr_hub_abm/space/wall.py
28 29 30 31 | |
task
Module for AMR Hub ABM tasks.
Task
dataclass
Representation of a task assigned to an agent.
Source code in src/amr_hub_abm/task.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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
__post_init__()
Post-initialization to validate task attributes.
Source code in src/amr_hub_abm/task.py
130 131 132 133 134 135 136 137 138 | |
__repr__()
Representation of the task.
Source code in src/amr_hub_abm/task.py
187 188 189 190 191 192 193 | |
time_spent(current_time)
Calculate the time spent on the task so far.
Source code in src/amr_hub_abm/task.py
120 121 122 123 124 125 126 127 128 | |
update_progress(current_time, agent)
Update the progress of the task based on time spent.
Source code in src/amr_hub_abm/task.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
TaskAttendPatient
dataclass
Bases: Task
Representation of an 'attend patient' task.
Source code in src/amr_hub_abm/task.py
209 210 211 212 213 214 215 216 217 218 219 | |
__post_init__()
Post-initialization to set the task location.
Source code in src/amr_hub_abm/task.py
216 217 218 219 | |
TaskDoorAccess
dataclass
Bases: Task
Representation of a 'door access' task.
Source code in src/amr_hub_abm/task.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
__post_init__()
Post-initialization to set the task location.
Source code in src/amr_hub_abm/task.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
modify_location(agent)
Modify the location of the task to account for buffer.
Source code in src/amr_hub_abm/task.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
TaskGotoLocation
dataclass
Bases: Task
Representation of a 'goto location' task.
Source code in src/amr_hub_abm/task.py
196 197 198 199 200 201 202 203 204 205 206 | |
__post_init__()
Post-initialization to set the task location.
Source code in src/amr_hub_abm/task.py
203 204 205 206 | |
TaskOccupyContent
dataclass
Bases: Task
Representation of an 'occupy content' task.
Source code in src/amr_hub_abm/task.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
__post_init__()
Post-initialization to set the task location.
Source code in src/amr_hub_abm/task.py
308 309 310 | |
assign_content()
Assign the content to be occupied based on the content type and room.
Source code in src/amr_hub_abm/task.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
TaskPriority
Bases: IntEnum
Enumeration of possible task priority levels.
Source code in src/amr_hub_abm/task.py
95 96 97 98 99 100 | |
TaskProgress
Bases: IntEnum
Enumeration of possible task progress states.
Source code in src/amr_hub_abm/task.py
67 68 69 70 71 72 73 74 | |
TaskType
Bases: IntEnum
Enumeration of possible task types.
Source code in src/amr_hub_abm/task.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
TaskWorkstation
dataclass
Bases: Task
Representation of a 'workstation' task.
Source code in src/amr_hub_abm/task.py
286 287 288 289 290 291 292 293 294 295 296 | |
__post_init__()
Post-initialization to set the task location.
Source code in src/amr_hub_abm/task.py
293 294 295 296 | |
add_agent_occupancy(agent, content, current_time)
Add the agent's occupancy to the specified content.
Source code in src/amr_hub_abm/task.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
remove_agent_occupancy(agent, current_time)
Remove the agent's occupancy from any content they are currently occupying.
Source code in src/amr_hub_abm/task.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |