Skip to content

Commit

Permalink
tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
AnastasiaPsarou committed Oct 10, 2024
1 parent 7184e42 commit 35863ac
Show file tree
Hide file tree
Showing 18 changed files with 271 additions and 358 deletions.
1 change: 0 additions & 1 deletion RouteRL/environment/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def _check_paths_ready(self) -> None:
"""
Checks if the required paths file for the simulation exists.
"""

if os.path.isfile(self.paths_csv_path):
logging.info("[CONFIRMED] Paths file is ready.")
else:
Expand Down
22 changes: 11 additions & 11 deletions RouteRL/network_and_config/csomor/csomor1.rou.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
<routes>
<route id="0_0_0" edges="
441496282#0 -115604051#2 279952229#1 279952229#2 279952229#3 279952229#4 279952229#5 115604057#1 -115604057#1
441496282#0 441496282#1 -115604043#2 279952229#2 279952229#3 279952229#4 279952229#5 115604057#1 -115604057#1
" />
<route id="0_0_1" edges="
441496282#0 -115604051#2 279952229#1 279952229#2 279952229#3 279952229#4 279952229#5 279952229#6 410338471 -819269916#2 -115604057#1
441496282#0 441496282#1 441496282#2 -115604048#2 279952229#3 279952229#4 279952229#5 115604057#1 -115604057#1
" />
<route id="0_0_2" edges="
441496282#0 441496282#1 441496282#2 441496282#3 441496282#4 -115604047#2 279952229#5 279952229#6 410338471 -819269916#2 -115604057#1
441496282#0 441496282#1 441496282#2 441496282#3 -115604050#2 279952229#4 -115604047#1 115604047#1 279952229#5 115604057#1 -115604057#1
" />
<route id="1_0_0" edges="
154551772#1 154551772#2 154551772#3 154551772#4 154551772#5 154551772#6 154551772#7 115604050#0 -115602933#2 115604047#1 279952229#5 115604057#1 -115604057#1
154551772#1 154551772#2 154551772#3 115604043#0 -115602933#4 115604048#1 279952229#3 279952229#4 279952229#5 115604057#1 -115604057#1
" />
<route id="1_0_1" edges="
154551772#1 154551772#2 154551772#3 154551772#4 -115601277 115601277 -154551772#4 115604043#0 -115602933#4 -115602933#3 -115602933#2 -115602933#1 -115604049 115604049 -115602933#0 819269916#1 -115604057#1
154551772#1 154551772#2 154551772#3 154551772#4 -154551772#4 115604043#0 -115602933#4 -115602933#3 -115602933#2 115604047#1 279952229#5 115604057#1 -115604057#1
" />
<route id="1_0_2" edges="
154551772#1 154551772#2 -154551772#2 115604051#0 -115602933#5 115604043#1 279952229#2 -115604048#1 -115602933#3 115604050#1 279952229#4 279952229#5 115604057#1 -115604057#1
154551772#1 115604051#0 115602933#6 115602920#3 279952229#0 279952229#1 279952229#2 -115604048#1 -115602933#3 -115602933#2 115604047#1 279952229#5 115604057#1 -115604057#1
" />
<route id="0_1_0" edges="
441496282#0 -115604051#2 279952229#1 279952229#2 279952229#3 279952229#4 -279952229#4
" />
<route id="0_1_1" edges="
441496282#0 441496282#1 441496282#2 -115604048#2 279952229#3 279952229#4 -279952229#4
441496282#0 441496282#1 441496282#2 441496282#3 441496282#4 -115604047#2 -279952229#4
" />
<route id="0_1_2" edges="
441496282#0 441496282#1 -441496282#1 -115604051#2 279952229#1 279952229#2 279952229#3 279952229#4 -279952229#4
441496282#0 441496282#1 441496282#2 441496282#3 -115604050#2 279952229#4 -279952229#4
" />
<route id="1_1_0" edges="
154551772#1 154551772#2 154551772#3 154551772#4 154551772#5 154551772#6 154551772#7 115604050#0 -115602933#2 115604047#1 -279952229#4
154551772#1 115604051#0 115604051#1 279952229#1 279952229#2 279952229#3 279952229#4 -279952229#4
" />
<route id="1_1_1" edges="
154551772#1 115604051#0 115604051#1 279952229#1 279952229#2 279952229#3 279952229#4 -279952229#4
154551772#1 154551772#2 154551772#3 115604043#0 -115602933#4 115604048#1 279952229#3 279952229#4 -279952229#4
" />
<route id="1_1_2" edges="
154551772#1 154551772#2 154551772#3 115604043#0 -115602933#4 115604048#1 279952229#3 279952229#4 -279952229#4
154551772#1 154551772#2 154551772#3 115604043#0 115604043#1 279952229#2 279952229#3 279952229#4 -279952229#4
" />
</routes>
68 changes: 22 additions & 46 deletions RouteRL/network_and_config/csomor/det.add.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- Detectors -->
<inductionLoop id="441496282#0_det" lane="441496282#0_0" pos="5" file="NUL"
/>
<inductionLoop id="-115604051#2_det" lane="-115604051#2_0" pos="5" file="NUL"
<inductionLoop id="441496282#1_det" lane="441496282#1_0" pos="5" file="NUL"
/>
<inductionLoop id="279952229#1_det" lane="279952229#1_0" pos="5" file="NUL"
<inductionLoop id="-115604043#2_det" lane="-115604043#2_0" pos="5" file="NUL"
/>
<inductionLoop id="279952229#2_det" lane="279952229#2_0" pos="5" file="NUL"
/>
Expand All @@ -18,84 +18,60 @@
/>
<inductionLoop id="-115604057#1_det" lane="-115604057#1_0" pos="5" file="NUL"
/>
<inductionLoop id="279952229#6_det" lane="279952229#6_0" pos="5" file="NUL"
/>
<inductionLoop id="410338471_det" lane="410338471_0" pos="0" file="NUL"
/>
<inductionLoop id="-819269916#2_det" lane="-819269916#2_0" pos="5" file="NUL"
/>
<inductionLoop id="441496282#1_det" lane="441496282#1_0" pos="5" file="NUL"
/>
<inductionLoop id="441496282#2_det" lane="441496282#2_0" pos="5" file="NUL"
/>
<inductionLoop id="-115604048#2_det" lane="-115604048#2_0" pos="5" file="NUL"
/>
<inductionLoop id="441496282#3_det" lane="441496282#3_0" pos="5" file="NUL"
/>
<inductionLoop id="441496282#4_det" lane="441496282#4_0" pos="5" file="NUL"
<inductionLoop id="-115604050#2_det" lane="-115604050#2_0" pos="5" file="NUL"
/>
<inductionLoop id="-115604047#2_det" lane="-115604047#2_0" pos="5" file="NUL"
<inductionLoop id="-115604047#1_det" lane="-115604047#1_0" pos="5" file="NUL"
/>
<inductionLoop id="115604047#1_det" lane="115604047#1_0" pos="5" file="NUL"
/>
<inductionLoop id="154551772#1_det" lane="154551772#1_0" pos="5" file="NUL"
/>
<inductionLoop id="154551772#2_det" lane="154551772#2_0" pos="0" file="NUL"
/>
<inductionLoop id="154551772#3_det" lane="154551772#3_0" pos="5" file="NUL"
/>
<inductionLoop id="154551772#4_det" lane="154551772#4_0" pos="0" file="NUL"
/>
<inductionLoop id="154551772#5_det" lane="154551772#5_0" pos="5" file="NUL"
/>
<inductionLoop id="154551772#6_det" lane="154551772#6_0" pos="0" file="NUL"
/>
<inductionLoop id="154551772#7_det" lane="154551772#7_0" pos="5" file="NUL"
/>
<inductionLoop id="115604050#0_det" lane="115604050#0_0" pos="5" file="NUL"
/>
<inductionLoop id="-115602933#2_det" lane="-115602933#2_0" pos="5" file="NUL"
/>
<inductionLoop id="115604047#1_det" lane="115604047#1_0" pos="5" file="NUL"
/>
<inductionLoop id="-115601277_det" lane="-115601277_0" pos="5" file="NUL"
/>
<inductionLoop id="115601277_det" lane="115601277_0" pos="5" file="NUL"
/>
<inductionLoop id="-154551772#4_det" lane="-154551772#4_0" pos="0" file="NUL"
/>
<inductionLoop id="115604043#0_det" lane="115604043#0_0" pos="5" file="NUL"
/>
<inductionLoop id="-115602933#4_det" lane="-115602933#4_0" pos="5" file="NUL"
/>
<inductionLoop id="-115602933#3_det" lane="-115602933#3_0" pos="5" file="NUL"
<inductionLoop id="115604048#1_det" lane="115604048#1_0" pos="5" file="NUL"
/>
<inductionLoop id="-115602933#1_det" lane="-115602933#1_0" pos="5" file="NUL"
<inductionLoop id="154551772#4_det" lane="154551772#4_0" pos="0" file="NUL"
/>
<inductionLoop id="-115604049_det" lane="-115604049_0" pos="5" file="NUL"
<inductionLoop id="-154551772#4_det" lane="-154551772#4_0" pos="0" file="NUL"
/>
<inductionLoop id="115604049_det" lane="115604049_0" pos="5" file="NUL"
<inductionLoop id="-115602933#3_det" lane="-115602933#3_0" pos="5" file="NUL"
/>
<inductionLoop id="-115602933#0_det" lane="-115602933#0_0" pos="5" file="NUL"
<inductionLoop id="-115602933#2_det" lane="-115602933#2_0" pos="5" file="NUL"
/>
<inductionLoop id="819269916#1_det" lane="819269916#1_0" pos="5" file="NUL"
<inductionLoop id="115604051#0_det" lane="115604051#0_0" pos="5" file="NUL"
/>
<inductionLoop id="-154551772#2_det" lane="-154551772#2_0" pos="0" file="NUL"
<inductionLoop id="115602933#6_det" lane="115602933#6_0" pos="5" file="NUL"
/>
<inductionLoop id="115604051#0_det" lane="115604051#0_0" pos="5" file="NUL"
<inductionLoop id="115602920#3_det" lane="115602920#3_0" pos="5" file="NUL"
/>
<inductionLoop id="-115602933#5_det" lane="-115602933#5_0" pos="5" file="NUL"
<inductionLoop id="279952229#0_det" lane="279952229#0_0" pos="5" file="NUL"
/>
<inductionLoop id="115604043#1_det" lane="115604043#1_0" pos="5" file="NUL"
<inductionLoop id="279952229#1_det" lane="279952229#1_0" pos="5" file="NUL"
/>
<inductionLoop id="-115604048#1_det" lane="-115604048#1_0" pos="5" file="NUL"
/>
<inductionLoop id="115604050#1_det" lane="115604050#1_0" pos="5" file="NUL"
<inductionLoop id="-115604051#2_det" lane="-115604051#2_0" pos="5" file="NUL"
/>
<inductionLoop id="-279952229#4_det" lane="-279952229#4_0" pos="5" file="NUL"
/>
<inductionLoop id="-115604048#2_det" lane="-115604048#2_0" pos="5" file="NUL"
<inductionLoop id="441496282#4_det" lane="441496282#4_0" pos="5" file="NUL"
/>
<inductionLoop id="-441496282#1_det" lane="-441496282#1_0" pos="5" file="NUL"
<inductionLoop id="-115604047#2_det" lane="-115604047#2_0" pos="5" file="NUL"
/>
<inductionLoop id="115604051#1_det" lane="115604051#1_0" pos="5" file="NUL"
/>
<inductionLoop id="115604048#1_det" lane="115604048#1_0" pos="5" file="NUL"
<inductionLoop id="115604043#1_det" lane="115604043#1_0" pos="5" file="NUL"
/>
</additional>
48 changes: 18 additions & 30 deletions RouteRL/network_and_config/csomor/detectors.csv
Original file line number Diff line number Diff line change
@@ -1,50 +1,38 @@
name
441496282#0
-115604051#2
279952229#1
441496282#1
-115604043#2
279952229#2
279952229#3
279952229#4
279952229#5
115604057#1
-115604057#1
279952229#6
410338471
-819269916#2
441496282#1
441496282#2
-115604048#2
441496282#3
441496282#4
-115604047#2
-115604050#2
-115604047#1
115604047#1
154551772#1
154551772#2
154551772#3
154551772#4
154551772#5
154551772#6
154551772#7
115604050#0
-115602933#2
115604047#1
-115601277
115601277
-154551772#4
115604043#0
-115602933#4
115604048#1
154551772#4
-154551772#4
-115602933#3
-115602933#1
-115604049
115604049
-115602933#0
819269916#1
-154551772#2
-115602933#2
115604051#0
-115602933#5
115604043#1
115602933#6
115602920#3
279952229#0
279952229#1
-115604048#1
115604050#1
-115604051#2
-279952229#4
-115604048#2
-441496282#1
441496282#4
-115604047#2
115604051#1
115604048#1
115604043#1
Binary file modified docs/_build/doctrees/documentation/human_agents.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/documentation/machine_agents.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/documentation/observations.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/documentation/pz_env.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/documentation/simulator.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ <h1>Source code for RouteRL.environment.simulator</h1><div class="highlight"><pr
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Checks if the required paths file for the simulation exists.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">paths_csv_path</span><span class="p">):</span>
<span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;[CONFIRMED] Paths file is ready.&quot;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ <h1>RouteRL<a class="headerlink" href="#routerl" title="Link to this heading">¶
</li>
<li><p>It is compatible with popular RL libraries such as <a class="reference external" href="https://stable-baselines3.readthedocs.io/en/master/guide/examples.html">stable-baselines3</a> and <a class="reference external" href="https://pytorch.org/rl/stable/tutorials/torchrl_demo.html">TorchRL</a>.</p></li>
</ul>
<p>For more details, check the documentation online.</p>
<p>For more details, check the documentation <a class="reference external" href="https://coexistence-project.github.io/RouteRL/">online</a>.</p>
<div class="toctree-wrapper compound">
</div>
<div class="toctree-wrapper compound">
Expand Down
2 changes: 1 addition & 1 deletion path_generation/generate_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def _get_ff(path, network):
def save_paths(routes, ff_times, paths_csv_save_path, routes_xml_save_path, detector_xml_save_path, paths_csv_save_detectors):
""" Save paths and ff times to disk """
# csv file, for us
paths_df = pd.DataFrame(columns = [kc.ORIGIN, kc.DESTINATION, kc.PATH, kc.FREE_FLOW_TIME])
paths_df = pd.DataFrame(columns = [kc.ORIGINS, kc.DESTINATIONS, kc.PATH, kc.FREE_FLOW_TIME])
for od, paths in routes.items():
for path_idx, path in enumerate(paths):
paths_df.loc[len(paths_df.index)] = [od[0], od[1], list_to_string(path, ","), ff_times[od][path_idx]]
Expand Down
Loading

0 comments on commit 35863ac

Please sign in to comment.