{"id":29165314,"url":"https://github.com/michael-markl/dynamic-prediction-equilibria","last_synced_at":"2025-10-09T16:07:03.464Z","repository":{"id":49047345,"uuid":"359830069","full_name":"michael-markl/dynamic-prediction-equilibria","owner":"michael-markl","description":"Computation of dynamic selfish flows using predicted travel times ","archived":false,"fork":false,"pushed_at":"2022-04-06T07:52:44.000Z","size":28541,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-01-26T23:37:23.141Z","etag":null,"topics":["dynamic-flow","equilibrium","game-theory","machine-learning","optimization","traffic-forecasting","traffic-simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michael-markl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-20T13:41:39.000Z","updated_at":"2022-03-22T19:14:20.000Z","dependencies_parsed_at":"2022-09-06T22:13:52.450Z","dependency_job_id":null,"html_url":"https://github.com/michael-markl/dynamic-prediction-equilibria","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michael-markl/dynamic-prediction-equilibria","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-markl%2Fdynamic-prediction-equilibria","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-markl%2Fdynamic-prediction-equilibria/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-markl%2Fdynamic-prediction-equilibria/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-markl%2Fdynamic-prediction-equilibria/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michael-markl","download_url":"https://codeload.github.com/michael-markl/dynamic-prediction-equilibria/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-markl%2Fdynamic-prediction-equilibria/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262916695,"owners_count":23383891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dynamic-flow","equilibrium","game-theory","machine-learning","optimization","traffic-forecasting","traffic-simulation"],"created_at":"2025-07-01T07:10:58.722Z","updated_at":"2025-10-09T16:06:58.440Z","avatar_url":"https://github.com/michael-markl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prediction Equilibrium for Dynamic Traffic Assignment\n\nThis file descibes how the results in the computational study can be reproduced.\n\n## Getting Started\n\nTo start working:\n\n* Install Python 3.8 (if not already)\n* Install pipenv (if not already) `python3 -m pip install --user pipenv`\n* Run `pipenv install`\n* Run `pipenv shell` to create a shell session with an activated pipenv environment\n\nAssertions are used extensively throughout the code and therefore slow down the computation a lot.\nOften, we use the environment variable `PYTHONOPTIMIZE` to deactivate assert statements.\nRun the following code, to disable assertions for a bash session:\n```\nexport PYTHONOPTIMIZE=TRUE\n```\n\n## Generate Training Data for the Linear Regression Predictor\n\nGenerating training data is done in two steps:\n* First, flows are generated using an extension based procedure where all commodities have a random inflow rate.\n* Then, we take samples of the queue lengths of the generated flows.\n\nTo generate flows, run the following command inside an active pipenv shell:\n```\npython predictor/src/main.py generate_flows /path/to/network.arcs /path/to/network.demands /path/to/output-folder\n```\nThis can take several hours, so it is helpful to run multiple processes with the same command.\n\n\nTo take the samples, run\n```\npython predictor/src/main.py take_samples /path/to/output-folder\n```\n\nTo train the Linear Regression Predictor, samples were taken from the tokyo_small network.\nThese are included in the Supplementary Material.\nAfter merging all queue lengths into a single file while removing lines with only zeros,\nlinear regression was applied using the tool [Weka](https://www.cs.waikato.ac.nz/ml/weka/).\nThe resulting parameters were hardcoded in the corresponding python file.\n\n## Evaluation\n\n### Evaluating the Sample Network\n\nThis section shows how to deduce the results for the following sample network:\n\n![Sample Network](sample_network.png)\n\nHere, we have a single source s and a single sink t.\nWe introduce one commodity for each predictor and have the total inflow split equally between them.\nThis means that we measure, how the average travel times behave\nwhen the different predictors compete in real-time with each other.\nAs the instance is so small, we can have multiple runs very easily.\nHence, we measure how the average travel times behave when increasing the total network inflow.\n\nTo run the experiment, use the following command:\n```\npython predictor/src/main.py evaluate_sample\n```\nThis generates a file `./avg_times_sample.json` with a json array `arr` of the following structure:\n* `arr[0]` contains samples for the constant predictor\n* `arr[1]` contains samples for the Zero-Predictor\n* `arr[2]` contains samples for the Linear Regression Predictor\n* `arr[3]` contains samples for the Linear Predictor\n* `arr[4]` contains samples for the Regularized Linear Predictor\n\nFurthermore, `arr[i]` is an array of 30/0.25=120 samples with `arr[i][j]` being\nthe measured average travel time of predictor `i`\nin a network with total inflow `j*0.25`.\n\n\n### Evaluating a Large Network\n\nThis section explains how to reproduce the results for the tokyo network.\nIn this example, we measure the performance of the different predictors for each existing commodity.\nMore specifically, for each commodity with source-sink-pair `(s, t)`, we introduce \nadditional commodities - one for each predictor - with the same source-sink-pair and\na very small network inflow (here: 0.125).\n\nAfter extending the flow for one focused commodity, the program saves a json file in the\nspecified output folder.\nOne such a json file contains besides the id of the observed commodity and other information,\nthe computed average travel times of the predictors in the order as in the section above. \n\nIn some cases, the travel times of all predictors are the same.\nThis can happen, if there is only a single (reasonable) path to the sink or if no flow did not arrive\nduring the observed time horizon.\nThese entries were removed when creating the boxplot in the paper.\n\nIn the paper, the `tokyo_tiny` network was chosen for evaluation.\nTo run the experiment, use the following command:\n```\npython predictor/src/main.py evaluate_network /path/to/network.arcs /path/to/network.demands /path/to/output-folder\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael-markl%2Fdynamic-prediction-equilibria","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichael-markl%2Fdynamic-prediction-equilibria","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael-markl%2Fdynamic-prediction-equilibria/lists"}