{ "cells": [ { "cell_type": "code", "execution_count": 14, "id": "6325832e", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m git-repo `https://gitlab.gwdg.de/smuehle1/RidePooling`\n" ] }, { "name": "stdin", "output_type": "stream", "text": [ "Username for 'https://gitlab.gwdg.de': rhaag@ds.mpg.de\n", "Password for 'https://rhaag@ds.mpg.de@gitlab.gwdg.de': ···········\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m registry at `~/.julia/registries/General`\n", "\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n", "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m `~/ridepooling_simulations/Project.toml`\n", " \u001b[90m [2a705bf3] \u001b[39m\u001b[93m~ RidePooling v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup` ⇒ v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup`\u001b[39m\n", "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m `~/ridepooling_simulations/Manifest.toml`\n", " \u001b[90m [2a705bf3] \u001b[39m\u001b[93m~ RidePooling v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup` ⇒ v0.9.0 `https://gitlab.gwdg.de/smuehle1/RidePooling/#planned_pickup`\u001b[39m\n", "\u001b[32m\u001b[1mPrecompiling\u001b[22m\u001b[39m project...\n", "\u001b[33m ✓ \u001b[39mRidePooling\n", " 1 dependency successfully precompiled in 13 seconds (190 already precompiled)\n", " \u001b[33m1\u001b[39m dependency precompiled but a different version is currently loaded. Restart julia to access the new version\n" ] } ], "source": [ "import Pkg\n", "Pkg.add(url=\"https://gitlab.gwdg.de/smuehle1/RidePooling/\", rev=\"planned_pickup\")\n", "Pkg.instantiate() #there may be an error here concerning PyCall. The dependencies assume Python to be installed on your system, with package 'matplotlib' installed.\n", " #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.\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "1192df61", "metadata": {}, "outputs": [], "source": [ "using RidePooling\n", "RP = RidePooling\n", "using DataFrames\n", "using CSV" ] }, { "cell_type": "code", "execution_count": 2, "id": "c39eaef9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"results.csv\"" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "project_folder = \"/project.dcf/poss/datasets/planned_pickup/earliest_pickup_try_2\"\n", "model_folder = project_folder*\"/models/\"\n", "output_file = \"results.csv\"" ] }, { "cell_type": "code", "execution_count": 3, "id": "b99cf08c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Dict{Symbol, Function} with 7 entries:\n", " :mean_relative_delay => mean_relative_delay\n", " :efficiency => efficiency\n", " :requested_distance => requested_distance\n", " :mean_relative_waiting_time => mean_relative_waiting_time\n", " :driven_distance => driven_distance\n", " :served_percentage => served_percentage\n", " :occupancy => mean_occupancy" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "efficiency(model) = driven_distance(model) / requested_distance(model)\n", "#TODO quality = \n", "data_type_functions = Dict(\n", " :served_percentage => served_percentage,\n", " :driven_distance => driven_distance,\n", " :requested_distance => requested_distance,\n", " :mean_relative_delay => mean_relative_delay,\n", " :efficiency => efficiency,\n", " :occupancy => mean_occupancy,\n", " :mean_relative_delay => mean_relative_delay,\n", " :mean_relative_waiting_time => mean_relative_waiting_time,\n", " :served_percentage_no_waiting => served_percentage_no_waiting,\n", " # :mean_occupancy => RP.mean_occupancy, #BUG In Reading TUples from a CSV File\n", ")" ] }, { "cell_type": "code", "execution_count": 4, "id": "6c9b3021", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1901-element Vector{String}:\n", " \"1.model\"\n", " \"10.model\"\n", " \"100.model\"\n", " \"1000.model\"\n", " \"1001.model\"\n", " \"1002.model\"\n", " \"1003.model\"\n", " \"1004.model\"\n", " \"1005.model\"\n", " \"1006.model\"\n", " \"1007.model\"\n", " \"1008.model\"\n", " \"1009.model\"\n", " ⋮\n", " \"989.model\"\n", " \"99.model\"\n", " \"990.model\"\n", " \"991.model\"\n", " \"992.model\"\n", " \"993.model\"\n", " \"994.model\"\n", " \"995.model\"\n", " \"996.model\"\n", " \"997.model\"\n", " \"998.model\"\n", " \"999.model\"" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model_filenames = readdir(model_folder, join=false)" ] }, { "cell_type": "code", "execution_count": 5, "id": "dbde6420", "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div class=\"data-frame\"><p>1 rows × 9 columns (omitted printing of 4 columns)</p><table class=\"data-frame\"><thead><tr><th></th><th>driven_distance</th><th>dt_latest_dropoff</th><th>efficiency</th><th>frequency</th><th>mean_relative_delay</th></tr><tr><th></th><th title=\"Float64\">Float64</th><th title=\"Float64\">Float64</th><th title=\"Float64\">Float64</th><th title=\"Float64\">Float64</th><th title=\"Float64\">Float64</th></tr></thead><tbody><tr><th>1</th><td>1.08475e6</td><td>0.0</td><td>1.19147</td><td>0.0882239</td><td>0.55101</td></tr></tbody></table></div>" ], "text/latex": [ "\\begin{tabular}{r|cccccc}\n", "\t& driven\\_distance & dt\\_latest\\_dropoff & efficiency & frequency & mean\\_relative\\_delay & \\\\\n", "\t\\hline\n", "\t& Float64 & Float64 & Float64 & Float64 & Float64 & \\\\\n", "\t\\hline\n", "\t1 & 1.08475e6 & 0.0 & 1.19147 & 0.0882239 & 0.55101 & $\\dots$ \\\\\n", "\\end{tabular}\n" ], "text/plain": [ "\u001b[1m1×9 DataFrame\u001b[0m\n", "\u001b[1m Row \u001b[0m│\u001b[1m driven_distance \u001b[0m\u001b[1m dt_latest_dropoff \u001b[0m\u001b[1m efficiency \u001b[0m\u001b[1m frequency \u001b[0m\u001b[1m mean_relativ\u001b[0m ⋯\n", "\u001b[1m \u001b[0m│\u001b[90m Float64 \u001b[0m\u001b[90m Float64 \u001b[0m\u001b[90m Float64 \u001b[0m\u001b[90m Float64 \u001b[0m\u001b[90m Float64 \u001b[0m ⋯\n", "─────┼──────────────────────────────────────────────────────────────────────────\n", " 1 │ 1.08475e6 0.0 1.19147 0.0882239 ⋯\n", "\u001b[36m 5 columns omitted\u001b[0m" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model = RP.loadmodel(model_folder*model_filenames[1])\n", "data = Dict()\n", "data[:frequency] = model.ν\n", "data[:dt_latest_dropoff] = model.random_gens[:pickup][2]\n", "for (name, func) in data_type_functions\n", " data[name] = func(model)\n", "end\n", "df = DataFrame(data)" ] }, { "cell_type": "code", "execution_count": 8, "id": "bde0a846", "metadata": {}, "outputs": [], "source": [ "\n", "for name in model_filenames[2:end]\n", " model = RP.loadmodel(model_folder*name)\n", " data = Dict()\n", " data[:frequency] = model.ν\n", " data[:dt_latest_dropoff] = model.random_gens[:pickup][2]\n", " for (name, func) in data_type_functions\n", " data[name] = func(model)\n", " end\n", " data = DataFrame(data)\n", " append!(df, data)\n", "end" ] }, { "cell_type": "code", "execution_count": 11, "id": "11ab8779", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Saving Combined Dataframe to results.csv\n" ] }, { "data": { "text/plain": [ "\"results.csv\"" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "println(\"Saving Combined Dataframe to $output_file\")\n", "CSV.write(output_file, df)" ] }, { "cell_type": "code", "execution_count": 12, "id": "ce8a0f5c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div class=\"data-frame\"><p>1,901 rows × 9 columns (omitted printing of 4 columns)</p><table class=\"data-frame\"><thead><tr><th></th><th>driven_distance</th><th>dt_latest_dropoff</th><th>efficiency</th><th>frequency</th><th>mean_relative_delay</th></tr><tr><th></th><th title=\"Float64\">Float64</th><th title=\"Float64\">Float64</th><th title=\"Float64\">Float64</th><th title=\"Float64\">Float64</th><th title=\"Float64\">Float64</th></tr></thead><tbody><tr><th>1</th><td>1.08475e6</td><td>0.0</td><td>1.19147</td><td>0.0882239</td><td>0.55101</td></tr><tr><th>2</th><td>9.81811e5</td><td>0.0</td><td>1.0784</td><td>0.366129</td><td>0.669109</td></tr><tr><th>3</th><td>8.97935e5</td><td>1.66244</td><td>0.986272</td><td>0.674913</td><td>0.658836</td></tr><tr><th>4</th><td>6.20502e5</td><td>26.599</td><td>0.681547</td><td>1.29248</td><td>1.49626</td></tr><tr><th>5</th><td>1.99027e6</td><td>26.599</td><td>2.18608</td><td>0.0882239</td><td>0.314684</td></tr><tr><th>6</th><td>1.94318e6</td><td>26.599</td><td>2.13434</td><td>0.119102</td><td>0.287703</td></tr><tr><th>7</th><td>1.90231e6</td><td>26.599</td><td>2.08946</td><td>0.149981</td><td>0.281236</td></tr><tr><th>8</th><td>1.86081e6</td><td>26.599</td><td>2.04387</td><td>0.180859</td><td>0.266526</td></tr><tr><th>9</th><td>1.8224e6</td><td>26.599</td><td>2.00169</td><td>0.211737</td><td>0.255786</td></tr><tr><th>10</th><td>1.77929e6</td><td>26.599</td><td>1.95434</td><td>0.242616</td><td>0.231513</td></tr><tr><th>11</th><td>1.73854e6</td><td>26.599</td><td>1.90958</td><td>0.273494</td><td>0.243714</td></tr><tr><th>12</th><td>1.69903e6</td><td>26.599</td><td>1.86618</td><td>0.304372</td><td>0.243598</td></tr><tr><th>13</th><td>1.65626e6</td><td>26.599</td><td>1.8192</td><td>0.335251</td><td>0.226241</td></tr><tr><th>14</th><td>888659.0</td><td>1.66244</td><td>0.976084</td><td>0.705791</td><td>0.685847</td></tr><tr><th>15</th><td>1.60601e6</td><td>26.599</td><td>1.764</td><td>0.366129</td><td>0.246303</td></tr><tr><th>16</th><td>1.55996e6</td><td>26.599</td><td>1.71343</td><td>0.397008</td><td>0.248892</td></tr><tr><th>17</th><td>1.51036e6</td><td>26.599</td><td>1.65895</td><td>0.427886</td><td>0.269992</td></tr><tr><th>18</th><td>1.4603e6</td><td>26.599</td><td>1.60396</td><td>0.458764</td><td>0.275677</td></tr><tr><th>19</th><td>1.40943e6</td><td>26.599</td><td>1.54808</td><td>0.489643</td><td>0.295027</td></tr><tr><th>20</th><td>1.35862e6</td><td>26.599</td><td>1.49228</td><td>0.520521</td><td>0.334636</td></tr><tr><th>21</th><td>1.31165e6</td><td>26.599</td><td>1.44069</td><td>0.551399</td><td>0.348903</td></tr><tr><th>22</th><td>1.26507e6</td><td>26.599</td><td>1.38952</td><td>0.582278</td><td>0.362135</td></tr><tr><th>23</th><td>1.2188e6</td><td>26.599</td><td>1.3387</td><td>0.613156</td><td>0.367302</td></tr><tr><th>24</th><td>1.17416e6</td><td>26.599</td><td>1.28967</td><td>0.644034</td><td>0.412239</td></tr><tr><th>25</th><td>875625.0</td><td>1.66244</td><td>0.961768</td><td>0.73667</td><td>0.693409</td></tr><tr><th>26</th><td>1.13104e6</td><td>26.599</td><td>1.24231</td><td>0.674913</td><td>0.46405</td></tr><tr><th>27</th><td>1.09364e6</td><td>28.2614</td><td>1.20123</td><td>0.705791</td><td>0.476762</td></tr><tr><th>28</th><td>1.05296e6</td><td>28.2614</td><td>1.15655</td><td>0.73667</td><td>0.538486</td></tr><tr><th>29</th><td>1.01717e6</td><td>28.2614</td><td>1.11724</td><td>0.767548</td><td>0.558567</td></tr><tr><th>30</th><td>981447.0</td><td>28.2614</td><td>1.078</td><td>0.798426</td><td>0.596046</td></tr><tr><th>⋮</th><td>⋮</td><td>⋮</td><td>⋮</td><td>⋮</td><td>⋮</td></tr></tbody></table></div>" ], "text/latex": [ "\\begin{tabular}{r|cccccc}\n", "\t& driven\\_distance & dt\\_latest\\_dropoff & efficiency & frequency & mean\\_relative\\_delay & \\\\\n", "\t\\hline\n", "\t& Float64 & Float64 & Float64 & Float64 & Float64 & \\\\\n", "\t\\hline\n", "\t1 & 1.08475e6 & 0.0 & 1.19147 & 0.0882239 & 0.55101 & $\\dots$ \\\\\n", "\t2 & 9.81811e5 & 0.0 & 1.0784 & 0.366129 & 0.669109 & $\\dots$ \\\\\n", "\t3 & 8.97935e5 & 1.66244 & 0.986272 & 0.674913 & 0.658836 & $\\dots$ \\\\\n", "\t4 & 6.20502e5 & 26.599 & 0.681547 & 1.29248 & 1.49626 & $\\dots$ \\\\\n", "\t5 & 1.99027e6 & 26.599 & 2.18608 & 0.0882239 & 0.314684 & $\\dots$ \\\\\n", "\t6 & 1.94318e6 & 26.599 & 2.13434 & 0.119102 & 0.287703 & $\\dots$ \\\\\n", "\t7 & 1.90231e6 & 26.599 & 2.08946 & 0.149981 & 0.281236 & $\\dots$ \\\\\n", "\t8 & 1.86081e6 & 26.599 & 2.04387 & 0.180859 & 0.266526 & $\\dots$ \\\\\n", "\t9 & 1.8224e6 & 26.599 & 2.00169 & 0.211737 & 0.255786 & $\\dots$ \\\\\n", "\t10 & 1.77929e6 & 26.599 & 1.95434 & 0.242616 & 0.231513 & $\\dots$ \\\\\n", "\t11 & 1.73854e6 & 26.599 & 1.90958 & 0.273494 & 0.243714 & $\\dots$ \\\\\n", "\t12 & 1.69903e6 & 26.599 & 1.86618 & 0.304372 & 0.243598 & $\\dots$ \\\\\n", "\t13 & 1.65626e6 & 26.599 & 1.8192 & 0.335251 & 0.226241 & $\\dots$ \\\\\n", "\t14 & 888659.0 & 1.66244 & 0.976084 & 0.705791 & 0.685847 & $\\dots$ \\\\\n", "\t15 & 1.60601e6 & 26.599 & 1.764 & 0.366129 & 0.246303 & $\\dots$ \\\\\n", "\t16 & 1.55996e6 & 26.599 & 1.71343 & 0.397008 & 0.248892 & $\\dots$ \\\\\n", "\t17 & 1.51036e6 & 26.599 & 1.65895 & 0.427886 & 0.269992 & $\\dots$ \\\\\n", "\t18 & 1.4603e6 & 26.599 & 1.60396 & 0.458764 & 0.275677 & $\\dots$ \\\\\n", "\t19 & 1.40943e6 & 26.599 & 1.54808 & 0.489643 & 0.295027 & $\\dots$ \\\\\n", "\t20 & 1.35862e6 & 26.599 & 1.49228 & 0.520521 & 0.334636 & $\\dots$ \\\\\n", "\t21 & 1.31165e6 & 26.599 & 1.44069 & 0.551399 & 0.348903 & $\\dots$ \\\\\n", "\t22 & 1.26507e6 & 26.599 & 1.38952 & 0.582278 & 0.362135 & $\\dots$ \\\\\n", "\t23 & 1.2188e6 & 26.599 & 1.3387 & 0.613156 & 0.367302 & $\\dots$ \\\\\n", "\t24 & 1.17416e6 & 26.599 & 1.28967 & 0.644034 & 0.412239 & $\\dots$ \\\\\n", "\t25 & 875625.0 & 1.66244 & 0.961768 & 0.73667 & 0.693409 & $\\dots$ \\\\\n", "\t26 & 1.13104e6 & 26.599 & 1.24231 & 0.674913 & 0.46405 & $\\dots$ \\\\\n", "\t27 & 1.09364e6 & 28.2614 & 1.20123 & 0.705791 & 0.476762 & $\\dots$ \\\\\n", "\t28 & 1.05296e6 & 28.2614 & 1.15655 & 0.73667 & 0.538486 & $\\dots$ \\\\\n", "\t29 & 1.01717e6 & 28.2614 & 1.11724 & 0.767548 & 0.558567 & $\\dots$ \\\\\n", "\t30 & 981447.0 & 28.2614 & 1.078 & 0.798426 & 0.596046 & $\\dots$ \\\\\n", "\t$\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & \\\\\n", "\\end{tabular}\n" ], "text/plain": [ "\u001b[1m1901×9 DataFrame\u001b[0m\n", "\u001b[1m Row \u001b[0m│\u001b[1m driven_distance \u001b[0m\u001b[1m dt_latest_dropoff \u001b[0m\u001b[1m efficiency \u001b[0m\u001b[1m frequency \u001b[0m\u001b[1m mean_relati\u001b[0m ⋯\n", "\u001b[1m \u001b[0m│\u001b[90m Float64 \u001b[0m\u001b[90m Float64 \u001b[0m\u001b[90m Float64 \u001b[0m\u001b[90m Float64 \u001b[0m\u001b[90m Float64 \u001b[0m ⋯\n", "──────┼─────────────────────────────────────────────────────────────────────────\n", " 1 │ 1.08475e6 0.0 1.19147 0.0882239 ⋯\n", " 2 │ 9.81811e5 0.0 1.0784 0.366129\n", " 3 │ 8.97935e5 1.66244 0.986272 0.674913\n", " 4 │ 6.20502e5 26.599 0.681547 1.29248\n", " 5 │ 1.99027e6 26.599 2.18608 0.0882239 ⋯\n", " 6 │ 1.94318e6 26.599 2.13434 0.119102\n", " 7 │ 1.90231e6 26.599 2.08946 0.149981\n", " 8 │ 1.86081e6 26.599 2.04387 0.180859\n", " 9 │ 1.8224e6 26.599 2.00169 0.211737 ⋯\n", " 10 │ 1.77929e6 26.599 1.95434 0.242616\n", " 11 │ 1.73854e6 26.599 1.90958 0.273494\n", " ⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋱\n", " 1892 │ 8.08813e5 26.599 0.888383 0.983696\n", " 1893 │ 7.85319e5 26.599 0.862578 1.01457 ⋯\n", " 1894 │ 7.63e5 26.599 0.838062 1.04545\n", " 1895 │ 741804.0 26.599 0.814782 1.07633\n", " 1896 │ 7.21872e5 26.599 0.792889 1.10721\n", " 1897 │ 702890.0 26.599 0.772039 1.13809 ⋯\n", " 1898 │ 6.84599e5 26.599 0.751949 1.16897\n", " 1899 │ 6.67232e5 26.599 0.732873 1.19984\n", " 1900 │ 6.51009e5 26.599 0.715055 1.23072\n", " 1901 │ 6.35248e5 26.599 0.697743 1.2616 ⋯\n", "\u001b[36m 5 columns and 1880 rows omitted\u001b[0m" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "da1f71f8", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.6.2", "language": "julia", "name": "julia-1.6" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.6.2" } }, "nbformat": 4, "nbformat_minor": 5 }