-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Anticipation Velocity Model (AVM) #1432
Open
chraibi
wants to merge
52
commits into
PedestrianDynamics:master
Choose a base branch
from
chraibi:CollisionFreeSpeedModelV3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 49 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
46c0bd8
Change version of jupedsim
chraibi 09001fb
First version compiles
chraibi 778523f
Running CollisionFreeSpeedModelV3.
chraibi 6e65c65
update example
chraibi 0e1838e
Rename model CollisionFreeSpeedModelV3 to AVM
chraibi f2344d9
remove unused imports
chraibi b7e4218
Implement direction of agents
chraibi 9c6b365
Implement boundaryRepulsion
chraibi ec801e4
Update the direction according to eq 7
chraibi de57a2e
validate parameters of the model
chraibi 42bb1db
Update functionality for walls behind walls
chraibi 681b518
Add anticipation and reaction times to C-API
chraibi 732f1a6
Fix bug in wall calculation
chraibi 7dfffef
rename get reaction time
chraibi 407bae0
Add two parameters and remove unused parameter from AVM API
chraibi f79dd6f
python bindings for AVM
chraibi efb7ca7
Add test can construct AVM
chraibi f83fbfa
Init new parameters in libjupedsim simulation
chraibi b7147a6
Add headon examples
chraibi c8df214
Wrong sign for wall influence
chraibi df7041f
Update velocity of agents
chraibi 21bcc41
Fix bug: Apply Update velocity of agents
chraibi 23305ae
Fix missmatch of neighbor and geometry parameters
chraibi f8a5ca1
Implement sliding walls
chraibi 269b608
Refactor sliding walls
chraibi bdd9299
Add notebook to compare all models
chraibi e6cf0e0
Update models for anticipation velocity model
chraibi 6f41508
Update notebook with time plots
chraibi 9cc1865
Add documentation for AVM
chraibi f2d88a7
link notebook to documentation
chraibi 920259f
Update model notebook
chraibi 3ca16f1
Add requirement for notebook
chraibi 6d37d3b
rename notebook and add it to index
chraibi 8fbc35d
Add more explanatory context to the notebook
chraibi 354da4b
Add tests for AVM and update AVM-parameters contraints
chraibi 9092048
merge two cells in the notebook
chraibi bf8d459
Add test default parameters of AVM
chraibi 0b9352f
update AVM default parameters
chraibi 5e124cf
update clang format
chraibi 264c09b
clang-format my code
chraibi 42da8e2
clangformating
chraibi c615170
clang-formating a bunch
chraibi 5710c4c
clang formatting
chraibi e339d71
sorting imports and ruffing
chraibi 0045715
use clang-format 18
chraibi 7db6421
clang format
chraibi 35da307
Fixed python formatting
Ozaq 9dfd0a4
Format cpp code to match newer clang-format version
Ozaq 7320f23
Fix formatting
Ozaq d19228b
set version to 1.3.0
chraibi 2444f89
update example 7
chraibi 9fbb00d
reformatting and restructuring the comparison-models notebook
chraibi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ Notebooks | |
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
model-comparison | ||
corner | ||
double-bottleneck | ||
journey | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../notebooks/model-comparison.ipynb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#! /usr/bin/env python3 | ||
|
||
# Copyright © 2012-2024 Forschungszentrum Jülich GmbH | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
import pathlib | ||
import sys | ||
|
||
import jupedsim as jps | ||
from shapely import Polygon | ||
|
||
|
||
def main(): | ||
room1 = Polygon([(0, 0), (10, 0), (10, 10), (0, 10)]) # Room 1 (10m x 10m) | ||
room2 = Polygon( | ||
[(15, 0), (25, 0), (25, 10), (15, 10)] | ||
) # Room 2 (10m x 10m) | ||
width = 0.8 | ||
num_agents = 10 | ||
corridor = Polygon( | ||
[ | ||
(10, 5 - width / 2), | ||
(15, 5 - width / 2), | ||
(15, 5 + width / 2), | ||
(10, 5 + width / 2), | ||
] | ||
) | ||
geometry = room1.union(room2).union(corridor) | ||
# geometry = shapely.GeometryCollection(shapely.box(0, -2.5, 50, 2.5)) | ||
# exit_polygon = shapely.box(48, -2.5, 50, 2.5) # | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove commented out code |
||
exit_polygon = Polygon([(24, 4.5), (25, 4.5), (25, 5.5), (24, 5.5)]) | ||
trajectory_file = "example_7.sqlite" | ||
simulation = jps.Simulation( | ||
model=jps.AnticipationVelocityModel(), | ||
geometry=geometry, | ||
trajectory_writer=jps.SqliteTrajectoryWriter( | ||
output_file=pathlib.Path(trajectory_file) | ||
), | ||
) | ||
|
||
exit_id = simulation.add_exit_stage(exit_polygon) | ||
journey = jps.JourneyDescription([exit_id]) | ||
journey_id = simulation.add_journey(journey) | ||
|
||
start_positions = jps.distribute_by_number( | ||
polygon=Polygon([(0, 0), (5, 0), (5, 10), (0, 10)]), | ||
# shapely.box(0, -2.5, 5, 2.5), | ||
number_of_agents=num_agents, | ||
distance_to_agents=0.5, | ||
distance_to_polygon=0.2, | ||
) | ||
|
||
for position in start_positions: | ||
simulation.add_agent( | ||
jps.AnticipationVelocityModelAgentParameters( | ||
journey_id=journey_id, | ||
stage_id=exit_id, | ||
position=position, | ||
radius=0.2, | ||
# strength_neighbor_repulsion=8, | ||
# range_neighbor_repulsion=0.1, | ||
# strength_geometry_repulsion=5, | ||
# range_geometry_repulsion=0.1, | ||
) | ||
) | ||
|
||
while simulation.agent_count() > 0 and simulation.iteration_count() < 3000: | ||
try: | ||
simulation.iterate() | ||
except KeyboardInterrupt: | ||
print("CTRL-C Received! Shutting down") | ||
sys.exit(1) | ||
print( | ||
f"Simulation completed after {simulation.iteration_count()} iterations ({simulation.elapsed_time()} s)" | ||
) | ||
print(f"{trajectory_file = }") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#! /usr/bin/env python3 | ||
|
||
# Copyright © 2012-2024 Forschungszentrum Jülich GmbH | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
import pathlib | ||
|
||
import jupedsim as jps | ||
from shapely import Polygon | ||
|
||
|
||
def main(): | ||
width = 2 | ||
length = 10 | ||
geometry = Polygon([(0, 0), (length, 0), (length, width), (0, width)]) | ||
exit_polygon = Polygon( | ||
[(length - 0.5, 0), (length, 0), (length, width), (length - 0.5, width)] | ||
) | ||
trajectory_file = "headon_AVM.sqlite" | ||
simulation = jps.Simulation( | ||
model=jps.AnticipationVelocityModel(), | ||
geometry=geometry, | ||
trajectory_writer=jps.SqliteTrajectoryWriter( | ||
output_file=pathlib.Path(trajectory_file) | ||
), | ||
) | ||
|
||
exit_id = simulation.add_exit_stage(exit_polygon) | ||
journey = jps.JourneyDescription([exit_id]) | ||
journey_id = simulation.add_journey(journey) | ||
|
||
start_positions = [(3, 0.5 * width), (0.5 * length, 0.5 * width)] | ||
parameters = [ | ||
jps.AnticipationVelocityModelAgentParameters( | ||
journey_id=journey_id, | ||
stage_id=exit_id, | ||
position=start_positions[0], | ||
radius=0.2, | ||
v0=1.2, | ||
), | ||
jps.AnticipationVelocityModelAgentParameters( | ||
journey_id=journey_id, | ||
stage_id=exit_id, | ||
position=start_positions[1], | ||
radius=0.2, | ||
v0=0.2, | ||
), | ||
] | ||
for position, param in zip(start_positions, parameters): | ||
simulation.add_agent(parameters=param) | ||
|
||
while simulation.agent_count() > 0 and simulation.iteration_count() < 1000: | ||
simulation.iterate() | ||
|
||
print( | ||
f"Simulation completed after {simulation.iteration_count()} iterations ({simulation.elapsed_time()} s)" | ||
) | ||
print(f">> {trajectory_file = }") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#! /usr/bin/env python3 | ||
|
||
# Copyright © 2012-2024 Forschungszentrum Jülich GmbH | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
import pathlib | ||
|
||
import jupedsim as jps | ||
from shapely import Polygon | ||
|
||
|
||
def main(): | ||
width = 2 | ||
length = 10 | ||
geometry = Polygon([(0, 0), (length, 0), (length, width), (0, width)]) | ||
exit_polygon = Polygon( | ||
[(length - 0.5, 0), (length, 0), (length, width), (length - 0.5, width)] | ||
) | ||
trajectory_file = "headon_CSM.sqlite" | ||
simulation = jps.Simulation( | ||
model=jps.CollisionFreeSpeedModel(), | ||
geometry=geometry, | ||
trajectory_writer=jps.SqliteTrajectoryWriter( | ||
output_file=pathlib.Path(trajectory_file) | ||
), | ||
) | ||
|
||
exit_id = simulation.add_exit_stage(exit_polygon) | ||
journey = jps.JourneyDescription([exit_id]) | ||
journey_id = simulation.add_journey(journey) | ||
|
||
start_positions = [(3, 0.5 * width), (0.5 * length, 0.5 * width)] | ||
parameters = [ | ||
jps.CollisionFreeSpeedModelAgentParameters( | ||
journey_id=journey_id, | ||
stage_id=exit_id, | ||
position=start_positions[0], | ||
radius=0.2, | ||
v0=1.2, | ||
), | ||
jps.CollisionFreeSpeedModelAgentParameters( | ||
journey_id=journey_id, | ||
stage_id=exit_id, | ||
position=start_positions[1], | ||
radius=0.2, | ||
v0=0.2, | ||
), | ||
] | ||
for position, param in zip(start_positions, parameters): | ||
simulation.add_agent(parameters=param) | ||
|
||
while simulation.agent_count() > 0 and simulation.iteration_count() < 1000: | ||
simulation.iterate() | ||
|
||
print( | ||
f"Simulation completed after {simulation.iteration_count()} iterations ({simulation.elapsed_time()} s)" | ||
) | ||
print(f">> {trajectory_file = }") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the version bump, 1.3.0 is still unreleased