{"id":31752082,"url":"https://github.com/filippoairaldi/sym-metanet","last_synced_at":"2025-10-09T16:55:43.569Z","repository":{"id":63897701,"uuid":"446827680","full_name":"FilippoAiraldi/sym-metanet","owner":"FilippoAiraldi","description":"Symbolic Modelling of Highway Traffic Networks with METANET","archived":false,"fork":false,"pushed_at":"2025-05-27T10:14:33.000Z","size":624,"stargazers_count":10,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"dev","last_synced_at":"2025-09-07T08:23:57.835Z","etag":null,"topics":["highway-network","highway-traffic","modelling-framework"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/sym-metanet/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FilippoAiraldi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-01-11T13:16:16.000Z","updated_at":"2025-05-27T10:14:31.000Z","dependencies_parsed_at":"2023-01-14T12:30:13.878Z","dependency_job_id":"c1989af7-3f52-4e91-b982-59ed679fb6e3","html_url":"https://github.com/FilippoAiraldi/sym-metanet","commit_stats":{"total_commits":231,"total_committers":2,"mean_commits":115.5,"dds":"0.32900432900432897","last_synced_commit":"3090c4e972b1b66dd085cb71e2301299373e1124"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/FilippoAiraldi/sym-metanet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FilippoAiraldi%2Fsym-metanet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FilippoAiraldi%2Fsym-metanet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FilippoAiraldi%2Fsym-metanet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FilippoAiraldi%2Fsym-metanet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FilippoAiraldi","download_url":"https://codeload.github.com/FilippoAiraldi/sym-metanet/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FilippoAiraldi%2Fsym-metanet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001778,"owners_count":26083173,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["highway-network","highway-traffic","modelling-framework"],"created_at":"2025-10-09T16:55:39.857Z","updated_at":"2025-10-09T16:55:43.563Z","avatar_url":"https://github.com/FilippoAiraldi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Symbolic Modelling of Highway Traffic Networks with METANET\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/FilippoAiraldi/sym-metanet/dev/resources/example.jpg\" alt=\"network-example\" height=\"180\"\u003e\n\u003c/div\u003e\n\n**sym-metanet** is a Python package to model traffic networks with the METANET framework, a collection of tools to mathematically model the macroscopic behaviour of traffic in highway systems (see [[1]](#1) and [[2]](#2) for more details).\n\n[![PyPI version](https://badge.fury.io/py/sym-metanet.svg)](https://badge.fury.io/py/sym-metanet)\n[![Source Code License](https://img.shields.io/badge/license-MIT-blueviolet)](https://github.com/FilippoAiraldi/casadi-nlp/blob/release/LICENSE)\n![Python 3.9](https://img.shields.io/badge/python-\u003e=3.9-green.svg)\n\n[![Tests](https://github.com/FilippoAiraldi/sym-metanet/actions/workflows/ci.yml/badge.svg)](https://github.com/FilippoAiraldi/sym-metanet/actions/workflows/ci.yml)\n[![Downloads](https://static.pepy.tech/badge/sym-metanet)](https://www.pepy.tech/projects/sym-metanet)\n[![Maintainability](https://api.codeclimate.com/v1/badges/c2725b1b8012a72db289/maintainability)](https://codeclimate.com/github/FilippoAiraldi/sym-metanet/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/c2725b1b8012a72db289/test_coverage)](https://codeclimate.com/github/FilippoAiraldi/sym-metanet/test_coverage)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n---\n\n## Installation\n\nTo install the package, run\n\n```bash\npip install sym-metanet\n```\n\n**sym-metanet** has the following dependencies\n\n- Python 3.8 or higher\n- [NetworkX](https://networkx.org/)\n\nand optionally\n\n- [NumPy](https://pypi.org/project/numpy/)\n- [CasADi](https://pypi.org/project/casadi/).\n\nFor playing around with the source code instead, run\n\n```bash\ngit clone https://github.com/FilippoAiraldi/sym-metanet.git\n```\n\n---\n\n## Usage\n\nIn METANET, a highway network is represented as a directed graph whose edges are stretches of highways, a.k.a. links. Each link bridges between nodes (that have no physical meaning), which in turn can host origins (sources of traffic flow) and destinations (sinks of flow). For instance, to create a very simple network consisting of a single link connecting an origin to a destination, we can do as follows:\n\n```python\nimport sym_metanet as metanet\n\n...\n\nN1 = metanet.Node(name=\"N1\")\nN2 = metanet.Node(name=\"N2\")\nL1 = metanet.Link(segments, lanes, L, rho_max, rho_crit, v_free, a, name=\"L1\")\nO1 = metanet.Origin(C[0], name=\"O1\")\nD3 = metanet.Destination(name=\"D3\")\n\nnet = metanet.Network().add_path(origin=O1, path=(N1, L1, N2, L2, N3), destination=D3)\n```\n\nOnce the network is built, we can validate it and use, e.g., [CasADi](https://pypi.org/project/casadi/), to symbolically construct a function that represents the dynamics governing this network (according to METANET).\n\n```python\nnet.is_valid(raises=True)\n\nT = 10 / 3600  # sampling time\nmetanet.engines.use(\"casadi\", sym_type=\"SX\")\nF = metanet.engine.to_function(net=net, T=T)\n```\n\nFunction `F` can be then used to simulate the state transitions of the network in the context of, e.g., highway traffic control (see [[2]](#2) for more details).\n\n## Examples\n\nOur [examples](examples) folder contains an example on how to get started with this package.\n\n## Extensions\n\nThis code is symbolic-engine-agnostic, in the sense that it does not rely on a particular implementation of the underlying engine for symbolic computations. In other words, it is relatively easy to create a new engine for modelling networks with a new specific symbolic library (e.g., [SimPy](https://www.sympy.org/en/index.html)) by implementing the abstract class [`sym_metanet.engines.core.EngineBase`](src\\sym_metanet\\engines\\core.py#EngineBase). An engine implemented in [CasADi](https://pypi.org/project/casadi/) is already shipped but requires the symbolic library to be installed. Additionally, the engine is also implemented in [NumPy](https://pypi.org/project/numpy/) (does not allow symbolic computations though).\n\n---\n\n## License\n\nThe repository is provided under the MIT License. See the LICENSE file included with this repository.\n\n---\n\n## Author\n\n[Filippo Airaldi](https://www.tudelft.nl/staff/f.airaldi/), PhD Candidate [f.airaldi@tudelft.nl | filippoairaldi@gmail.com]\n\n\u003e [Delft Center for Systems and Control](https://www.tudelft.nl/en/3me/about/departments/delft-center-for-systems-and-control/) in [Delft University of Technology](https://www.tudelft.nl/en/)\n\nCopyright (c) 2023 Filippo Airaldi.\n\nCopyright notice: Technische Universiteit Delft hereby disclaims all copyright interest in the program “sym-metanet” (Symbolic Modelling of Highway Traffic Networks with METANET) written by the Author(s). Prof. Dr. Ir. Fred van Keulen, Dean of 3mE.\n\n---\n\n## References\n\n\u003ca id=\"1\"\u003e[1]\u003c/a\u003e\nA. Messmer and Papageorgiou, “METANET: a macroscopic simulation program for motorway networks,” Traffic Engineering and Control, vol. 31, pp. 466–470, 1990.\n\n\u003ca id=\"2\"\u003e[2]\u003c/a\u003e\nHegyi, A., 2004. Model predictive control for integrating traffic control measures. Netherlands TRAIL Research School.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilippoairaldi%2Fsym-metanet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilippoairaldi%2Fsym-metanet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilippoairaldi%2Fsym-metanet/lists"}