From 7ebe20ab7bf01dddb25bf8961f9722da541047c7 Mon Sep 17 00:00:00 2001
From: rhaag <rhaag@ds.mpg.de>
Date: Mon, 29 Nov 2021 15:01:39 +0100
Subject: [PATCH] V0.1

---
 Project.toml                                               | 1 +
 .../ruben/example_map/delays_wt1reldelta1/dispatcher.jl    | 3 +--
 example/ruben/scripts/script_fmax.sh                       | 5 ++---
 initialize.jl                                              | 6 +++---
 sim.jl                                                     | 7 ++++---
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Project.toml b/Project.toml
index b150e1a..663c2ca 100644
--- a/Project.toml
+++ b/Project.toml
@@ -24,3 +24,4 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
 Agents = "= 4.1.3"
 OpenStreetMapX = "= 0.2.3"
 julia = "1.5"
+RidePooling = "0.9"
diff --git a/example/ruben/example_map/delays_wt1reldelta1/dispatcher.jl b/example/ruben/example_map/delays_wt1reldelta1/dispatcher.jl
index 00e2e08..eae2b6e 100644
--- a/example/ruben/example_map/delays_wt1reldelta1/dispatcher.jl
+++ b/example/ruben/example_map/delays_wt1reldelta1/dispatcher.jl
@@ -3,6 +3,5 @@ max_relative_detour=1.0
 
 dispatcher=(;
         cost=:delays,
-        rejection_criterion=((:any_waiting_time,max_waiting_time),
-                             (:any_relative_detour,max_relative_detour))
+        rejection_criterion=((:any_relative_detour,max_relative_detour))
         )
diff --git a/example/ruben/scripts/script_fmax.sh b/example/ruben/scripts/script_fmax.sh
index 255cfc7..9ef2373 100644
--- a/example/ruben/scripts/script_fmax.sh
+++ b/example/ruben/scripts/script_fmax.sh
@@ -4,12 +4,11 @@
 #$ -cwd
 #$ -q titan.q
 #$ -j yes
-#$ -N $SGE_TASK_ID
+#$ -N earliest_pickup
 #$ -t 1-100
 
 N=20
 SAVE_PATH="./example/ruben/"
-INDEX=1
 
 
-julia sim.jl $N $SAVE_PATH $INDEX
+julia sim.jl $N $SAVE_PATH $SGE_TASK_ID
diff --git a/initialize.jl b/initialize.jl
index b75d93c..4e41a7d 100644
--- a/initialize.jl
+++ b/initialize.jl
@@ -5,7 +5,6 @@ include("../RidePooling/src/RidePooling.jl") #How can I use using instead
 RP = RidePooling
 using DataFrames
 using DelimitedFiles
-RP = RidePooling
 
 
 
@@ -39,7 +38,7 @@ end
 """
  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
     #TODO Make Random gens
@@ -49,11 +48,12 @@ function simulate_rp(paths,N, x, t0, specs)
     data[:frequency] = x
     data[:dt_earliest_pickup] = y
     for (name, func) in data_type_functions
-        data[name] = [func(model),]
+        data[name] = func(model)
     end
 
     # Save the calculated Data
     data = DataFrame(data)
+
     #CSV.write(paths[:data]*"$(x)_$(y).csv", data) #QUESTION what savepath
     open(paths[:data]*"$index.csv", "w") do io
         writedlm(io, Iterators.flatten(([names(data)], eachrow(data))), ',')
diff --git a/sim.jl b/sim.jl
index 9a6ad67..0f31812 100644
--- a/sim.jl
+++ b/sim.jl
@@ -51,13 +51,14 @@ end
 end
 
 
+
 # Set the Filepaths
 paths = Dict(:data => "data/",
             :model => "model/",
             :map => "example_map/map/",
             :dispatcher => "example_map/delays_wt1reldelta1/")
 
-
+#TODO Gucke ob die Ordner existieren
 
 for (name, path) in paths
     paths[name] = save_path * path
@@ -68,7 +69,7 @@ map_folder = paths[:map]
 requested = 20 * N
 served = 20 * N
 
-include(paths[:map]*"map.jl")
+include(paths[:map]*"map.jl") #
 include(paths[:dispatcher]*"dispatcher.jl")
 
 
@@ -89,4 +90,4 @@ specs=(;
 
 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)
-- 
GitLab