AequilibraE / qaequilibrae

Free QGIS add-on for transportation modeling
https://www.aequilibrae.com/qgis/latest/
Other
75 stars 24 forks source link

Assignment via QGIS result in null flow on links and empty skim matrices #226

Closed Art-Ev closed 1 year ago

Art-Ev commented 1 year ago

Hi !

Was doing some tests with new GUI (hoping replace a very old version we were using for projects) and had a little... surprise.

Testing process :

  1. Reinstall QGIS to reset all development/old version interferences (QGIS 3.28, windows 11)
  2. Install qaequilibre plugin with the new "all-packaged" library installation
  3. Create a new project using OSM with "Toulouse, France" request
  4. Convert 5 well-spaced nodes into centroids
  5. Complete network with default/dumb values (capacity, speed, time, ...)
  6. Use "shortest path" menu to check for paths between the nodes (minimised distance & time)
  7. Create a dumb demand matrix on excel
  8. Import the matrix with the help of Renata's fix and PR for #225
  9. Runnning a bfw assignment with BPR (0.15 ; 4) allowing flows throught centroid (PCE=1.00, network mode=car) while computing some skims (time & distance) :
    • Assignment is running "without error" but ends after 250 iterations... (the trouble begins...)
    • Assignment results contain no flow and skim matrices are full of null values... (ok now it's really a potential bug...)

Does anyone have any ideas? No traffic "injected" into the network, given the nulls in the skims matrices, but why? Can somebody try to run my files to check for any "user stupidity" ?

Used files (only 30 days availability) : https://egis-group.fromsmash.com/qaequilibrae-tlse-test

pedrocamargo commented 1 year ago

@r-akemii , can you take a look at this?

pedrocamargo commented 1 year ago

I was able to run this in Python, so the problem is indeed inside QAequilibraE.

The only change I made was to rename the matrix to something proper in the database, as b'' just does not work (need to change that naming behavior in aequilibrae itself)

`from aequilibrae import Project from aequilibrae.paths import TrafficAssignment from aequilibrae.paths.traffic_class import TrafficClass

project = Project.from_path(r"C:\Users\pcamargo\Downloads\test_project_tlse")

project.network.build_graphs() graph = project.network.graphs["c"]

graph.set_graph("travel_time")

graph.set_skimming(["travel_time", "distance"])

graph.set_blocked_centroid_flows(True)

proj_matrices = project.matrices demand = proj_matrices.get_matrix("test_matrix") demand.computational_view(["valeur"])

assig = TrafficAssignment()

assigclass = TrafficClass(name="car", graph=graph, matrix=demand)

assig.add_class(assigclass)

assig.set_vdf("BPR") # This is not case-sensitive

assig.set_vdf_parameters({"alpha": 0.15, "beta": 4.0}) # And its parameters

assig.set_capacity_field("capacity") # The capacity and free flow travel times as they exist in the graph assig.set_time_field("travel_time")

assig.set_algorithm("bfw")

assig.max_iter = 1000 assig.rgap_target = 0.001

assig.execute() # we then execute the assignment `

I get

2023-06-22 21:01:59,468;INFO ; bfw Assignment STATS 2023-06-22 21:01:59,468;INFO ; Iteration, RelativeGap, stepsize 2023-06-22 21:01:59,520;INFO ; 1,inf,1.0 2023-06-22 21:01:59,584;INFO ; 2,0.15258129981732774,0.1855099078881468 2023-06-22 21:01:59,657;INFO ; 3,0.02835260802700194,0.07649263386149968 2023-06-22 21:01:59,737;INFO ; 4,0.008764265629517157,0.15079691491191594 2023-06-22 21:01:59,813;INFO ; 5,0.009547657113350582,0.11344893012146552 2023-06-22 21:01:59,888;INFO ; 6,0.00645650487704951,0.2891818663986017 2023-06-22 21:01:59,967;INFO ; 7,0.01041639408301928,0.20437323560285364 2023-06-22 21:02:00,049;INFO ; 8,0.005634296012878316,0.12986350154865858 2023-06-22 21:02:00,124;INFO ; 9,0.005139529298912883,0.14831917832361605 2023-06-22 21:02:00,200;INFO ; 10,0.004436522812848682,0.22708624078570805 2023-06-22 21:02:00,274;INFO ; 11,0.004800931136729977,0.22883476854458032 2023-06-22 21:02:00,352;INFO ; 12,0.0053657796545468145,0.32026336252847687 2023-06-22 21:02:00,440;INFO ; 13,0.0030983590315238224,0.36347489428643215 2023-06-22 21:02:00,524;INFO ; 14,0.005032999511455224,0.44325120669739176 2023-06-22 21:02:00,603;INFO ; 15,0.0033163375746978266,0.6875520241154497 2023-06-22 21:02:00,686;INFO ; 16,0.0046162495001443185,0.8543365650288796 2023-06-22 21:02:00,775;INFO ; 17,0.0021043682296932485,0.015710822068984186 2023-06-22 21:02:00,851;INFO ; 18,0.001415784058623692,0.0209695661624286 2023-06-22 21:02:00,934;INFO ; 19,0.001402991817087255,0.031425681226894125 2023-06-22 21:02:01,018;INFO ; 20,0.0015736942527476115,0.05206526121240514 2023-06-22 21:02:01,099;INFO ; 21,0.001406740433804103,0.03522427666571443 2023-06-22 21:02:01,183;INFO ; 22,0.0012974071827904197,0.06970713161582483 2023-06-22 21:02:01,265;INFO ; 23,0.0014004480606202786,0.041608132722986496 2023-06-22 21:02:01,345;INFO ; 24,0.001190209222623069,0.05643215897530938 2023-06-22 21:02:01,430;INFO ; 25,0.0013406597502044631,0.11986911739516869 2023-06-22 21:02:01,518;INFO ; 26,0.0014677906065332592,0.05388702450884854 2023-06-22 21:02:01,603;INFO ; 27,0.0009351120591919129,0.12380190640671375 2023-06-22 21:02:01,604;INFO ; bfw Assignment finished. 27 iterations and 0.0009351120591919129 final gap

r-akemii commented 1 year ago

This problem seems to be solved in QAequilibraE's version V.0.9.3.0.