Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with introducing a new routed mode #1142

Open
ArezHK opened this issue Jun 28, 2024 · 7 comments
Open

Problem with introducing a new routed mode #1142

ArezHK opened this issue Jun 28, 2024 · 7 comments

Comments

@ArezHK
Copy link

ArezHK commented Jun 28, 2024

Hi,

I tried adding a new travel mode, named Bicycle, which is routed on the network. To explain further: I introduced a new mode called Bicycle, defined a new vehicle type for it, and added this mode to the allowed modes for some of my network links. I also implemented a strategy to allow agents to change modes.

However, I am encountering an issue. Although some agents choose Bicycle, they seem to get stuck and do not move. There is also no walking involved. Should I manually add the walking mode to the allowed modes so agents can walk to nearest link with alowed mode for Bicycle?

Could you please help me with this issue?

Thank you.

@kainagel
Copy link
Member

There should be something like accessEgressType=accessEgressModeToLink in the routing config. That inserts automatic walk links between activity locations and the network. Could you please try and report back?

You also need to make sure that your Bicycle network is connected (i.e. there are no dead ends, and there are no two disconnected clusters). Running NetworkCleaner helps.

@ArezHK
Copy link
Author

ArezHK commented Jun 28, 2024

Dear Prof. @kainagel ,

Thank you for your response. Indeed, it helped me solve the issue. Now I have other issues:

  1. Some agents just jump onto the link (near the origin) and jump off the link (near the destination) within almost 1 second, which is not realistic!
  2. Some agents jump onto the link and travel in the opposite direction of the destination but then appear at the other end of the link and walk to the destination!

I have attached an image of my network here. (I added a two-directional, triangle-shaped network (blue-colored) which is only allowed for bicycles (as a newly defined routed mode).)

image

Link attributes are almost like below:

	<link id="1000001010" from="100162699" to="7437807472" length="4000" freespeed="10" capacity="600.0" permlanes="1.0" oneway="1" modes="bicycle" >
		<attributes>
			<attribute name="osm:way:highway" class="java.lang.String">residential</attribute>
			<attribute name="osm:way:name" class="java.lang.String">BicycleToNorth</attribute>
		</attributes>
	</link>	

@kainagel
Copy link
Member

Hello, next time could you please open a new issue with a new question? From what you write, this is probably expected behavior:

  • Locations are attached to nearest links, and if that means that they need to make a U-term right after departure or right before arrival, than that is what they will do.
  • The "walk" between the network mode and the activity location is not terribly well defined. I can't remember what the current implementation is, but it may compute beeline distance to the shortest point on the link and use that for the walk time, and then teleport the person forward to the downstream end of the link. Reason for this (if this is indeed what is implemented) is that all arrivals/departures on the link are aggregated at the downstream end. Arrivals/departures at arbitrary positions along the link are not possible since the qsim does not have that spatial resolution. In general we assume that it cancels out since whatever they teleport forward at departure then need to additional drive at arrival.

@JWJoubert
Copy link
Contributor

A contributing factor can also be that the two links of a road (one in either direction) are seen as equally far away from the point. So, which one is the agent supposed to pick? Well, you and I have real intelligence and figure that out. But in artificial intelligence, you have to come up with your own heuristic or, as is the case in MATSim (I may be wrong, but that's my understanding), live with its implementation: pick one at random. That might be why you see an agent taking off in the opposite direction.

@ArezHK
Copy link
Author

ArezHK commented Jul 1, 2024

Dear Prof. @kainagel @JWJoubert ,

Thank you for your responses.

Indeed, I used the previously existing nodes for creating my new links. To illustrate the situation more clearly, I have included an image below:
At first, the agent jumps to the nearest link (1), disappears, and then reappears at the end of the link, moving in the opposite direction (2 & 3). Finally, it pops up again at the other end of the link and proceeds to work (4).

@kainagel , sorry for any confusion. I will make sure to follow your advice next time!

image

Output events + network:
output_events.xml.gz
output_network.xml.gz

@jingjunL
Copy link

Hi @ArezHK , I am also trying to add bicycle mode into my network and encountered this issue. Have you figured out how to add a new bicycle link? I think adding new bicycle link manually will be time consuming and I am also trying to simulate bicycle movement (instead of classic teleportation) in MATSim :)

@ArezHK
Copy link
Author

ArezHK commented Oct 1, 2024

Hi @jingjunL instead of adding links manually, another possible approach is adjusting the OSM network file and then convert that to MATsim network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants