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

New script for genrating CSV Files

parent 11bb71cc
No related branches found
No related tags found
No related merge requests found
import Pkg
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.
#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.
using RidePooling
RP = RidePooling
using DataFrames
using CSV
project_folder = "/project.dcf/poss/datasets/planned_pickup/earliest_pickup_try_2"
model_folder = project_folder*"/models/"
output_file = "results.csv"
efficiency(model) = driven_distance(model) / requested_distance(model)
#TODO quality =
data_type_functions = Dict(
:served_percentage => served_percentage,
:driven_distance => driven_distance,
:requested_distance => requested_distance,
:mean_relative_delay => mean_relative_delay,
:efficiency => efficiency,
:occupancy => mean_occupancy,
:mean_relative_delay => mean_relative_delay,
: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
)
model_filenames = readdir(model_folder, join=false)
model = RP.loadmodel(model_folder*model_filenames[1])
data = Dict()
data[:frequency] = model.ν
data[:dt_latest_dropoff] = model.random_gens[:pickup][2]
for (name, func) in data_type_functions
data[name] = func(model)
end
df = DataFrame(data)
for name in model_filenames[2:end]
model = RP.loadmodel(model_folder*name)
data = Dict()
data[:frequency] = model.ν
data[:dt_latest_dropoff] = model.random_gens[:pickup][2]
for (name, func) in data_type_functions
data[name] = func(model)
end
data = DataFrame(data)
append!(df, data)
end
\ No newline at end of file
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