Skip to content
Snippets Groups Projects
Commit d1285b7a authored by Ruben Haag's avatar Ruben Haag
Browse files

Merge branch 'main' of gitlab.gwdg.de:rhaag/ridepooling_simulations into main

parents 0e6af23c 3b92d8a4
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id:3496b943-89c8-4866-ba73-44a7beaea1d7 tags: %% Cell type:code id:6325832e tags:
``` julia ``` julia
import Pkg import Pkg
Pkg.add(url="https://gitlab.gwdg.de/smuehle1/RidePooling/", rev="planned_pickup") Pkg.add(url="https://gitlab.gwdg.de/smuehle1/RidePooling/", rev="planned_pickup")
Pkg.instantiate() #there may be an error here concerning PyCall. The dependencies assume Python to be installed on your system, with package 'matplotlib' installed. Pkg.instantiate() #there may be an error here concerning PyCall. The dependencies assume Python to be installed on your system, with package 'matplotlib' installed.
#Either just run 'conda install -c conda-forge matplotlib' in your system shell, or follow instructions below (after running this cell and getting an error) to solve everything from within Julia. #Either just run 'conda install -c conda-forge matplotlib' in your system shell, or follow instructions below (after running this cell and getting an error) to solve everything from within Julia.
``` ```
%% Output %% Output
 Updating git-repo `https://gitlab.gwdg.de/smuehle1/RidePooling`  Updating git-repo `https://gitlab.gwdg.de/smuehle1/RidePooling`
Username for 'https://gitlab.gwdg.de': rhaag@ds.mpg.de Username for 'https://gitlab.gwdg.de': rhaag@ds.mpg.de
Password for 'https://rhaag@ds.mpg.de@gitlab.gwdg.de': ··········· Password for 'https://rhaag@ds.mpg.de@gitlab.gwdg.de': ···········
 Updating registry at `~/.julia/registries/General`  Updating registry at `~/.julia/registries/General`
 Resolving package versions...  Resolving package versions...
 Updating `~/ridepooling_simulations/Project.toml`  Updating `~/ridepooling_simulations/Project.toml`
 [2a705bf3] ~ RidePooling v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup` ⇒ v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup`  [2a705bf3] ~ RidePooling v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup` ⇒ v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup`
 Updating `~/ridepooling_simulations/Manifest.toml`  Updating `~/ridepooling_simulations/Manifest.toml`
 [2a705bf3] ~ RidePooling v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup` ⇒ v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup`  [2a705bf3] ~ RidePooling v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup` ⇒ v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup`
Precompiling project... Precompiling project...
 ✓ RidePooling  ✓ RidePooling
1 dependency successfully precompiled in 13 seconds (190 already precompiled) 1 dependency successfully precompiled in 13 seconds (190 already precompiled)
1 dependency precompiled but a different version is currently loaded. Restart julia to access the new version 1 dependency precompiled but a different version is currently loaded. Restart julia to access the new version
%% Cell type:code id:76c1dfa3 tags: %% Cell type:code id:1192df61 tags:
``` julia ``` julia
using RidePooling using RidePooling
RP = RidePooling RP = RidePooling
using DataFrames using DataFrames
using CSV using CSV
``` ```
%% Cell type:code id:b828b321 tags: %% Cell type:code id:c39eaef9 tags:
``` julia ``` julia
project_folder = "/project.dcf/poss/datasets/planned_pickup/earliest_pickup_try_2" project_folder = "/project.dcf/poss/datasets/planned_pickup/earliest_pickup_try_2"
model_folder = project_folder*"/models/" model_folder = project_folder*"/models/"
output_file = "results.csv" output_file = "results.csv"
``` ```
%% Output %% Output
"results.csv" "results.csv"
%% Cell type:code id:37246aab-9fb4-4214-9bac-f4b321735878 tags: %% Cell type:code id:b99cf08c tags:
``` julia ``` julia
efficiency(model) = driven_distance(model) / requested_distance(model) efficiency(model) = driven_distance(model) / requested_distance(model)
#TODO quality = #TODO quality =
data_type_functions = Dict( data_type_functions = Dict(
:served_percentage => served_percentage, :served_percentage => served_percentage,
:driven_distance => driven_distance, :driven_distance => driven_distance,
:requested_distance => requested_distance, :requested_distance => requested_distance,
:mean_relative_delay => mean_relative_delay, :mean_relative_delay => mean_relative_delay,
:efficiency => efficiency, :efficiency => efficiency,
:occupancy => mean_occupancy, :occupancy => mean_occupancy,
:mean_relative_delay => mean_relative_delay, :mean_relative_delay => mean_relative_delay,
:mean_relative_waiting_time => mean_relative_waiting_time, :mean_relative_waiting_time => mean_relative_waiting_time,
:served_percentage_no_waiting => served_percentage_no_waiting,
# :mean_occupancy => RP.mean_occupancy, #BUG In Reading TUples from a CSV File # :mean_occupancy => RP.mean_occupancy, #BUG In Reading TUples from a CSV File
) )
``` ```
%% Output %% Output
Dict{Symbol, Function} with 7 entries: Dict{Symbol, Function} with 7 entries:
:mean_relative_delay => mean_relative_delay :mean_relative_delay => mean_relative_delay
:efficiency => efficiency :efficiency => efficiency
:requested_distance => requested_distance :requested_distance => requested_distance
:mean_relative_waiting_time => mean_relative_waiting_time :mean_relative_waiting_time => mean_relative_waiting_time
:driven_distance => driven_distance :driven_distance => driven_distance
:served_percentage => served_percentage :served_percentage => served_percentage
:occupancy => mean_occupancy :occupancy => mean_occupancy
%% Cell type:code id:e0e3a9e4-af4f-423a-bdbd-17d4a8e95bba tags: %% Cell type:code id:6c9b3021 tags:
``` julia ``` julia
model_filenames = readdir(model_folder, join=false) model_filenames = readdir(model_folder, join=false)
``` ```
%% Output %% Output
1901-element Vector{String}: 1901-element Vector{String}:
"1.model" "1.model"
"10.model" "10.model"
"100.model" "100.model"
"1000.model" "1000.model"
"1001.model" "1001.model"
"1002.model" "1002.model"
"1003.model" "1003.model"
"1004.model" "1004.model"
"1005.model" "1005.model"
"1006.model" "1006.model"
"1007.model" "1007.model"
"1008.model" "1008.model"
"1009.model" "1009.model"
"989.model" "989.model"
"99.model" "99.model"
"990.model" "990.model"
"991.model" "991.model"
"992.model" "992.model"
"993.model" "993.model"
"994.model" "994.model"
"995.model" "995.model"
"996.model" "996.model"
"997.model" "997.model"
"998.model" "998.model"
"999.model" "999.model"
%% Cell type:code id:21e549e2-8f49-468f-a642-6d4c3ece02fd tags: %% Cell type:code id:dbde6420 tags:
``` julia ``` julia
model = RP.loadmodel(model_folder*model_filenames[1]) model = RP.loadmodel(model_folder*model_filenames[1])
data = Dict() data = Dict()
data[:frequency] = model.ν data[:frequency] = model.ν
data[:dt_latest_dropoff] = model.random_gens[:pickup][2] data[:dt_latest_dropoff] = model.random_gens[:pickup][2]
for (name, func) in data_type_functions for (name, func) in data_type_functions
data[name] = func(model) data[name] = func(model)
end end
df = DataFrame(data) df = DataFrame(data)
``` ```
%% Output %% Output
\begin{tabular}{r|cccccc} \begin{tabular}{r|cccccc}
& driven\_distance & dt\_latest\_dropoff & efficiency & frequency & mean\_relative\_delay & \\ & driven\_distance & dt\_latest\_dropoff & efficiency & frequency & mean\_relative\_delay & \\
\hline \hline
& Float64 & Float64 & Float64 & Float64 & Float64 & \\ & Float64 & Float64 & Float64 & Float64 & Float64 & \\
\hline \hline
1 & 1.08475e6 & 0.0 & 1.19147 & 0.0882239 & 0.55101 & $\dots$ \\ 1 & 1.08475e6 & 0.0 & 1.19147 & 0.0882239 & 0.55101 & $\dots$ \\
\end{tabular} \end{tabular}
1×9 DataFrame 1×9 DataFrame
 Row │ driven_distance  dt_latest_dropoff  efficiency  frequency  mean_relativ ⋯  Row │ driven_distance  dt_latest_dropoff  efficiency  frequency  mean_relativ ⋯
 │ Float64  Float64  Float64  Float64  Float64  ⋯  │ Float64  Float64  Float64  Float64  Float64  ⋯
─────┼────────────────────────────────────────────────────────────────────────── ─────┼──────────────────────────────────────────────────────────────────────────
1 │ 1.08475e6 0.0 1.19147 0.0882239 ⋯ 1 │ 1.08475e6 0.0 1.19147 0.0882239 ⋯
 5 columns omitted  5 columns omitted
%% Cell type:code id:67a6f69e-21d3-4df7-a34c-33369ec89dbe tags: %% Cell type:code id:bde0a846 tags:
``` julia ``` julia
for name in model_filenames[2:end] for name in model_filenames[2:end]
model = RP.loadmodel(model_folder*name) model = RP.loadmodel(model_folder*name)
data = Dict() data = Dict()
data[:frequency] = model.ν data[:frequency] = model.ν
data[:dt_latest_dropoff] = model.random_gens[:pickup][2] data[:dt_latest_dropoff] = model.random_gens[:pickup][2]
for (name, func) in data_type_functions for (name, func) in data_type_functions
data[name] = func(model) data[name] = func(model)
end end
data = DataFrame(data) data = DataFrame(data)
append!(df, data) append!(df, data)
end end
``` ```
%% Cell type:code id:5f3b4143-97ce-44b5-ade9-eaaa812ff168 tags: %% Cell type:code id:11ab8779 tags:
``` julia ``` julia
println("Saving Combined Dataframe to $output_file") println("Saving Combined Dataframe to $output_file")
CSV.write(output_file, df) CSV.write(output_file, df)
``` ```
%% Output %% Output
Saving Combined Dataframe to results.csv Saving Combined Dataframe to results.csv
"results.csv" "results.csv"
%% Cell type:code id:eb42ea02-baad-492a-925d-d4163914135b tags: %% Cell type:code id:ce8a0f5c tags:
``` julia ``` julia
``` ```
%% Output %% Output
\begin{tabular}{r|cccccc} \begin{tabular}{r|cccccc}
& driven\_distance & dt\_latest\_dropoff & efficiency & frequency & mean\_relative\_delay & \\ & driven\_distance & dt\_latest\_dropoff & efficiency & frequency & mean\_relative\_delay & \\
\hline \hline
& Float64 & Float64 & Float64 & Float64 & Float64 & \\ & Float64 & Float64 & Float64 & Float64 & Float64 & \\
\hline \hline
1 & 1.08475e6 & 0.0 & 1.19147 & 0.0882239 & 0.55101 & $\dots$ \\ 1 & 1.08475e6 & 0.0 & 1.19147 & 0.0882239 & 0.55101 & $\dots$ \\
2 & 9.81811e5 & 0.0 & 1.0784 & 0.366129 & 0.669109 & $\dots$ \\ 2 & 9.81811e5 & 0.0 & 1.0784 & 0.366129 & 0.669109 & $\dots$ \\
3 & 8.97935e5 & 1.66244 & 0.986272 & 0.674913 & 0.658836 & $\dots$ \\ 3 & 8.97935e5 & 1.66244 & 0.986272 & 0.674913 & 0.658836 & $\dots$ \\
4 & 6.20502e5 & 26.599 & 0.681547 & 1.29248 & 1.49626 & $\dots$ \\ 4 & 6.20502e5 & 26.599 & 0.681547 & 1.29248 & 1.49626 & $\dots$ \\
5 & 1.99027e6 & 26.599 & 2.18608 & 0.0882239 & 0.314684 & $\dots$ \\ 5 & 1.99027e6 & 26.599 & 2.18608 & 0.0882239 & 0.314684 & $\dots$ \\
6 & 1.94318e6 & 26.599 & 2.13434 & 0.119102 & 0.287703 & $\dots$ \\ 6 & 1.94318e6 & 26.599 & 2.13434 & 0.119102 & 0.287703 & $\dots$ \\
7 & 1.90231e6 & 26.599 & 2.08946 & 0.149981 & 0.281236 & $\dots$ \\ 7 & 1.90231e6 & 26.599 & 2.08946 & 0.149981 & 0.281236 & $\dots$ \\
8 & 1.86081e6 & 26.599 & 2.04387 & 0.180859 & 0.266526 & $\dots$ \\ 8 & 1.86081e6 & 26.599 & 2.04387 & 0.180859 & 0.266526 & $\dots$ \\
9 & 1.8224e6 & 26.599 & 2.00169 & 0.211737 & 0.255786 & $\dots$ \\ 9 & 1.8224e6 & 26.599 & 2.00169 & 0.211737 & 0.255786 & $\dots$ \\
10 & 1.77929e6 & 26.599 & 1.95434 & 0.242616 & 0.231513 & $\dots$ \\ 10 & 1.77929e6 & 26.599 & 1.95434 & 0.242616 & 0.231513 & $\dots$ \\
11 & 1.73854e6 & 26.599 & 1.90958 & 0.273494 & 0.243714 & $\dots$ \\ 11 & 1.73854e6 & 26.599 & 1.90958 & 0.273494 & 0.243714 & $\dots$ \\
12 & 1.69903e6 & 26.599 & 1.86618 & 0.304372 & 0.243598 & $\dots$ \\ 12 & 1.69903e6 & 26.599 & 1.86618 & 0.304372 & 0.243598 & $\dots$ \\
13 & 1.65626e6 & 26.599 & 1.8192 & 0.335251 & 0.226241 & $\dots$ \\ 13 & 1.65626e6 & 26.599 & 1.8192 & 0.335251 & 0.226241 & $\dots$ \\
14 & 888659.0 & 1.66244 & 0.976084 & 0.705791 & 0.685847 & $\dots$ \\ 14 & 888659.0 & 1.66244 & 0.976084 & 0.705791 & 0.685847 & $\dots$ \\
15 & 1.60601e6 & 26.599 & 1.764 & 0.366129 & 0.246303 & $\dots$ \\ 15 & 1.60601e6 & 26.599 & 1.764 & 0.366129 & 0.246303 & $\dots$ \\
16 & 1.55996e6 & 26.599 & 1.71343 & 0.397008 & 0.248892 & $\dots$ \\ 16 & 1.55996e6 & 26.599 & 1.71343 & 0.397008 & 0.248892 & $\dots$ \\
17 & 1.51036e6 & 26.599 & 1.65895 & 0.427886 & 0.269992 & $\dots$ \\ 17 & 1.51036e6 & 26.599 & 1.65895 & 0.427886 & 0.269992 & $\dots$ \\
18 & 1.4603e6 & 26.599 & 1.60396 & 0.458764 & 0.275677 & $\dots$ \\ 18 & 1.4603e6 & 26.599 & 1.60396 & 0.458764 & 0.275677 & $\dots$ \\
19 & 1.40943e6 & 26.599 & 1.54808 & 0.489643 & 0.295027 & $\dots$ \\ 19 & 1.40943e6 & 26.599 & 1.54808 & 0.489643 & 0.295027 & $\dots$ \\
20 & 1.35862e6 & 26.599 & 1.49228 & 0.520521 & 0.334636 & $\dots$ \\ 20 & 1.35862e6 & 26.599 & 1.49228 & 0.520521 & 0.334636 & $\dots$ \\
21 & 1.31165e6 & 26.599 & 1.44069 & 0.551399 & 0.348903 & $\dots$ \\ 21 & 1.31165e6 & 26.599 & 1.44069 & 0.551399 & 0.348903 & $\dots$ \\
22 & 1.26507e6 & 26.599 & 1.38952 & 0.582278 & 0.362135 & $\dots$ \\ 22 & 1.26507e6 & 26.599 & 1.38952 & 0.582278 & 0.362135 & $\dots$ \\
23 & 1.2188e6 & 26.599 & 1.3387 & 0.613156 & 0.367302 & $\dots$ \\ 23 & 1.2188e6 & 26.599 & 1.3387 & 0.613156 & 0.367302 & $\dots$ \\
24 & 1.17416e6 & 26.599 & 1.28967 & 0.644034 & 0.412239 & $\dots$ \\ 24 & 1.17416e6 & 26.599 & 1.28967 & 0.644034 & 0.412239 & $\dots$ \\
25 & 875625.0 & 1.66244 & 0.961768 & 0.73667 & 0.693409 & $\dots$ \\ 25 & 875625.0 & 1.66244 & 0.961768 & 0.73667 & 0.693409 & $\dots$ \\
26 & 1.13104e6 & 26.599 & 1.24231 & 0.674913 & 0.46405 & $\dots$ \\ 26 & 1.13104e6 & 26.599 & 1.24231 & 0.674913 & 0.46405 & $\dots$ \\
27 & 1.09364e6 & 28.2614 & 1.20123 & 0.705791 & 0.476762 & $\dots$ \\ 27 & 1.09364e6 & 28.2614 & 1.20123 & 0.705791 & 0.476762 & $\dots$ \\
28 & 1.05296e6 & 28.2614 & 1.15655 & 0.73667 & 0.538486 & $\dots$ \\ 28 & 1.05296e6 & 28.2614 & 1.15655 & 0.73667 & 0.538486 & $\dots$ \\
29 & 1.01717e6 & 28.2614 & 1.11724 & 0.767548 & 0.558567 & $\dots$ \\ 29 & 1.01717e6 & 28.2614 & 1.11724 & 0.767548 & 0.558567 & $\dots$ \\
30 & 981447.0 & 28.2614 & 1.078 & 0.798426 & 0.596046 & $\dots$ \\ 30 & 981447.0 & 28.2614 & 1.078 & 0.798426 & 0.596046 & $\dots$ \\
$\dots$ & $\dots$ & $\dots$ & $\dots$ & $\dots$ & $\dots$ & \\ $\dots$ & $\dots$ & $\dots$ & $\dots$ & $\dots$ & $\dots$ & \\
\end{tabular} \end{tabular}
1901×9 DataFrame 1901×9 DataFrame
 Row │ driven_distance  dt_latest_dropoff  efficiency  frequency  mean_relati  Row │ driven_distance  dt_latest_dropoff  efficiency  frequency  mean_relati
 │ Float64  Float64  Float64  Float64  Float64   │ Float64  Float64  Float64  Float64  Float64 
──────┼───────────────────────────────────────────────────────────────────────── ──────┼─────────────────────────────────────────────────────────────────────────
1 1.08475e6 0.0 1.19147 0.0882239 1 1.08475e6 0.0 1.19147 0.0882239
2 9.81811e5 0.0 1.0784 0.366129 2 9.81811e5 0.0 1.0784 0.366129
3 8.97935e5 1.66244 0.986272 0.674913 3 8.97935e5 1.66244 0.986272 0.674913
4 6.20502e5 26.599 0.681547 1.29248 4 6.20502e5 26.599 0.681547 1.29248
5 1.99027e6 26.599 2.18608 0.0882239 5 1.99027e6 26.599 2.18608 0.0882239
6 1.94318e6 26.599 2.13434 0.119102 6 1.94318e6 26.599 2.13434 0.119102
7 1.90231e6 26.599 2.08946 0.149981 7 1.90231e6 26.599 2.08946 0.149981
8 1.86081e6 26.599 2.04387 0.180859 8 1.86081e6 26.599 2.04387 0.180859
9 1.8224e6 26.599 2.00169 0.211737 9 1.8224e6 26.599 2.00169 0.211737
10 1.77929e6 26.599 1.95434 0.242616 10 1.77929e6 26.599 1.95434 0.242616
11 1.73854e6 26.599 1.90958 0.273494 11 1.73854e6 26.599 1.90958 0.273494
1892 8.08813e5 26.599 0.888383 0.983696 1892 8.08813e5 26.599 0.888383 0.983696
1893 7.85319e5 26.599 0.862578 1.01457 1893 7.85319e5 26.599 0.862578 1.01457
1894 7.63e5 26.599 0.838062 1.04545 1894 7.63e5 26.599 0.838062 1.04545
1895 741804.0 26.599 0.814782 1.07633 1895 741804.0 26.599 0.814782 1.07633
1896 7.21872e5 26.599 0.792889 1.10721 1896 7.21872e5 26.599 0.792889 1.10721
1897 702890.0 26.599 0.772039 1.13809 1897 702890.0 26.599 0.772039 1.13809
1898 6.84599e5 26.599 0.751949 1.16897 1898 6.84599e5 26.599 0.751949 1.16897
1899 6.67232e5 26.599 0.732873 1.19984 1899 6.67232e5 26.599 0.732873 1.19984
1900 6.51009e5 26.599 0.715055 1.23072 1900 6.51009e5 26.599 0.715055 1.23072
1901 6.35248e5 26.599 0.697743 1.2616 1901 6.35248e5 26.599 0.697743 1.2616
 5 columns and 1880 rows omitted  5 columns and 1880 rows omitted
%% Cell type:code id:708a864a-f09f-416b-ade5-2c0055708301 tags: %% Cell type:code id:da1f71f8 tags:
``` julia ``` julia
``` ```
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment