p-ortmann / dyntapy Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
Hi there. Firstly, thank you for making this incredible repo - it has all sorts of neat stuff!
As a total beginner in this space, I'm trying to set up a super basic traffic assignment problem and solve it with Algorithm B ("dial_b") - but I think I'm getting a bit confused on (what I perceive as) the need for centroids and/or connectors in my simple problem.
I just wanted to load up a toy network...
# make the transport graph
g = dyntapy.supply_data.get_toy_network('cascetta')
# add required node attributes https://dyntapy.readthedocs.io/en/latest/dyntapy.html#module-dyntapy.assignments
nx.set_node_attributes(g,{i:i-1 for i in range(len(g.nodes)+1)},name="node_id")
# add required edge attributes
nx.set_edge_attributes(g,{(u,v):u-1 for u,v in g.edges},name="from_node_id")
nx.set_edge_attributes(g,{(u,v):v-1 for u,v in g.edges},name="to_node_id")
nx.set_edge_attributes(g,{(u,v):idx for idx,(u,v) in enumerate(g.edges)},name="link_id")
nx.draw(g,with_labels=True)
And (this might be where I'm going wrong), I can set up an od_graph (effectively a flow of 3000 from 1->4):
od_graph = nx.DiGraph()
od_graph.add_nodes_from(g.nodes(data=True))
od_graph.add_edges_from([(1,4,{'flow':3000.0})])
I can then successfully set up the StaticAssignment
object:
sa = dyntapy.assignments.StaticAssignment(g, od_graph)
But when I try to run:
result = sa.run(method='dial_b')
I get:
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\dyntapy\sta\equilibrate_bush.py:775, in _update_trees()
771 """
772 k
773 """
774 assert k >= 0
--> 775 assert k <= len(topological_order) - 1
776 assert n > 0
777 assert n <= len(topological_order)
AssertionError:
Am I misunderstanding the od_graph
requirements? Am I actively mis-numbering something? Apologies for the confusion but appreciate any help...
I'm happy to make a PR on a fork of the repo with a simple notebook example once this is done (if that makes helping inexperienced folks any more palatable)...
Just kidding! All is good. My mistake.
I am able to install the package from conda-forge perfectly. However, I also tried following the "from this repository" instructions, and ran into issues. I cloned the repo and created the conda environment using the environment.yml file. After activating the environment, I ran the code python -m pip install -e path-to-folder
but received the following error: ERROR: path-to-folder is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).
Did I interpret the instruction incorrectly?
Hi Paul:
I susscessfully ran DTA on Sioux Falls network. The link flow results seem correct for me since it looks similar to my demand model. However, the link cost seems not corret. It show as the following figure .
Then, I print np.min(link cost) , it appears "nan" values as the figure below. Is it normal?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.