News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

[passenger-generation] are onward/return trips worth it?

Started by Philip, September 20, 2013, 06:28:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Philip

The new function generate_passengers_or_mail is very long, and some of its length and complexity can, I think, be attributed to the creation of more than one trip/leg at the same time: return and onward journeys. I don't understand what the advantage is of having those at all, and therefore I can't judge whether we should actually keep them. A comment hints at performance reasons, but I think that doesn't apply anymore, in most cases—we're running the route finder anyway. A preliminary git diff --stat suggests we'd save some 250 lines of code.

Maybe it'd even be easier to re-add return/onward journeys (or either one of the two) if we got rid of them now and cleaned up the code a little. Easier than making changes to the code as it stands now, I mean. That's not meant to be derogatory: the code works and the matter it deals with is complicated, even without multi-leg trips, so it's understandable the code is complicated as well.

I understand that the priority right now might be to get things working again and distributing, rather than making more changes, so feel free to reject the patch either permanently or for now.

jamespetts

Thank you for this suggestion. Returning passengers are from Standard; onward journeys I have added in the passenger-generation branch. The idea of returning passengers in Standard and versions of Experimental up to and including 11.x is twofold: firstly, one does not have to run the full passenger generation code so often, so it saves some computational effort, and secondly, it balances the numbers of people going to and from places.

In the passenger-generation branch it serves a further and even more important function: because passengers are only generated from residential buildings, the returning passengers code is necessary to prevent all passenger journeys being one way only (from residential buildings to commercial and industrial buildings but never the other way around). Similarly with onward journeys: without that code, all journeys would start or end with residential buildings, which is not how passengers behave in reality. To achieve realistic passenger behaviour, therefore, the returning and onward passenger journey code is necessary.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.