Skip to content
Snippets Groups Projects
Commit 7ebe20ab authored by rhaag's avatar rhaag
Browse files

V0.1

parent 044a2369
No related branches found
No related tags found
No related merge requests found
...@@ -24,3 +24,4 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" ...@@ -24,3 +24,4 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Agents = "= 4.1.3" Agents = "= 4.1.3"
OpenStreetMapX = "= 0.2.3" OpenStreetMapX = "= 0.2.3"
julia = "1.5" julia = "1.5"
RidePooling = "0.9"
...@@ -3,6 +3,5 @@ max_relative_detour=1.0 ...@@ -3,6 +3,5 @@ max_relative_detour=1.0
dispatcher=(; dispatcher=(;
cost=:delays, cost=:delays,
rejection_criterion=((:any_waiting_time,max_waiting_time), rejection_criterion=((:any_relative_detour,max_relative_detour))
(:any_relative_detour,max_relative_detour))
) )
...@@ -4,12 +4,11 @@ ...@@ -4,12 +4,11 @@
#$ -cwd #$ -cwd
#$ -q titan.q #$ -q titan.q
#$ -j yes #$ -j yes
#$ -N $SGE_TASK_ID #$ -N earliest_pickup
#$ -t 1-100 #$ -t 1-100
N=20 N=20
SAVE_PATH="./example/ruben/" SAVE_PATH="./example/ruben/"
INDEX=1
julia sim.jl $N $SAVE_PATH $INDEX julia sim.jl $N $SAVE_PATH $SGE_TASK_ID
...@@ -5,7 +5,6 @@ include("../RidePooling/src/RidePooling.jl") #How can I use using instead ...@@ -5,7 +5,6 @@ include("../RidePooling/src/RidePooling.jl") #How can I use using instead
RP = RidePooling RP = RidePooling
using DataFrames using DataFrames
using DelimitedFiles using DelimitedFiles
RP = RidePooling
...@@ -39,7 +38,7 @@ end ...@@ -39,7 +38,7 @@ end
""" """
Function for Running a RidePooling simulation with the normalized Frequency x Function for Running a RidePooling simulation with the normalized Frequency x
""" """
function simulate_rp(paths,N, x, t0, specs) function simulate_rp(paths,N, x, y, t0, specs, served = 10*N, requested=10*N)
#Make Model #Make Model
#TODO Make Random gens #TODO Make Random gens
...@@ -49,11 +48,12 @@ function simulate_rp(paths,N, x, t0, specs) ...@@ -49,11 +48,12 @@ function simulate_rp(paths,N, x, t0, specs)
data[:frequency] = x data[:frequency] = x
data[:dt_earliest_pickup] = y data[:dt_earliest_pickup] = y
for (name, func) in data_type_functions for (name, func) in data_type_functions
data[name] = [func(model),] data[name] = func(model)
end end
# Save the calculated Data # Save the calculated Data
data = DataFrame(data) data = DataFrame(data)
#CSV.write(paths[:data]*"$(x)_$(y).csv", data) #QUESTION what savepath #CSV.write(paths[:data]*"$(x)_$(y).csv", data) #QUESTION what savepath
open(paths[:data]*"$index.csv", "w") do io open(paths[:data]*"$index.csv", "w") do io
writedlm(io, Iterators.flatten(([names(data)], eachrow(data))), ',') writedlm(io, Iterators.flatten(([names(data)], eachrow(data))), ',')
......
...@@ -51,13 +51,14 @@ end ...@@ -51,13 +51,14 @@ end
end end
# Set the Filepaths # Set the Filepaths
paths = Dict(:data => "data/", paths = Dict(:data => "data/",
:model => "model/", :model => "model/",
:map => "example_map/map/", :map => "example_map/map/",
:dispatcher => "example_map/delays_wt1reldelta1/") :dispatcher => "example_map/delays_wt1reldelta1/")
#TODO Gucke ob die Ordner existieren
for (name, path) in paths for (name, path) in paths
paths[name] = save_path * path paths[name] = save_path * path
...@@ -68,7 +69,7 @@ map_folder = paths[:map] ...@@ -68,7 +69,7 @@ map_folder = paths[:map]
requested = 20 * N requested = 20 * N
served = 20 * N served = 20 * N
include(paths[:map]*"map.jl") include(paths[:map]*"map.jl") #
include(paths[:dispatcher]*"dispatcher.jl") include(paths[:dispatcher]*"dispatcher.jl")
...@@ -89,4 +90,4 @@ specs=(; ...@@ -89,4 +90,4 @@ specs=(;
specs = merge(specs, dispatcher) specs = merge(specs, dispatcher)
data = simulate_rp(paths,N, x, t0, specs) data = simulate_rp(paths,N, x, y, t0, specs, served=served, requested=requested)
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