The International Simutrans Forum


Author Topic: [passenger-generation] are onward/return trips worth it?  (Read 866 times)

0 Members and 1 Guest are viewing this topic.

Offline Philip

  • *
  • Posts: 90
  • Languages: EN
[passenger-generation] are onward/return trips worth it?
« on: September 20, 2013, 06:28:52 PM »
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.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18755
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [passenger-generation] are onward/return trips worth it?
« Reply #1 on: September 20, 2013, 11:04:02 PM »
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.