News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

[11.24] Passengers/cargo make sub-optimal decisions about which convoy to board

Started by Sarlock, April 13, 2014, 06:45:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Sarlock

Moderator note: topic split from this thread to discuss this bug specifically.

An example I just built to demonstrate:

Circle Route Test

There are two lines, one running clockwise and one running counter-clockwise.  When you first open the save file, click on the train on the screen.  Notice that there are passengers for 7 of the 8 cities on the map... including some for stations that the train had just visited the stop previous.  The passengers, in theory, should be waiting for the next train on the opposite direction line so that they just take a one stop journey, rather than travelling around the entire map to their destination (unless they really, really like train travel).

EDIT:  Probably should be moved to a separate bug report thread.
I think what might be happening is in the station there is data for the distance to the next station and the waiting time... but perhaps it doesn't know anything about which line is the most efficient way to achieve this.  Cargo just seems to hop on the next convoy travelling to where it wants to go without knowledge of the route it takes to get there.

jamespetts

Thank you for the report and the example. Is it only on circular routes that you notice issues, or are there difficulties in any other cases?

ӔO

wasn't this a persistent problem from 10.x?

at least I remember previous loops not working as intended, not that it really mattered in the end.

jamespetts

It may well be a rather older problem - but it would be useful for me to know more detail about it. There might be a new way of fixing this, but it will need to wait for the next major release; however, I need information to know whether the problem is simply sub-optimal choices or whether there is something more fundamentally wrong.

Sarlock

It's hard to say... a complex game like the server game, it's really difficult to know what is and isn't choosing the most optimal path for delivery as the sheer volume of routes and cargo makes it nearly impossible to track unless one was very meticulous about charting this stuff.

For the most part things seem to be running fine, at least at first glance.  I don't notice anything particularly crazy with routing.

I've avoided using circular routes in Simutrans, both Standard and Exp, because of this problem, and instead choose network patterns that produce a more optimal result.  This particular problem seems to just exist when a piece of cargo can go either forwards or backwards on a route to arrive at the same destination (even if one path is much longer than the other).

If you take that map and chop out a segment between two cities to make the network a "C" shape and loop the track back at the points of the "C", then cargo will take the efficient path.  Probably because the train going past doesn't actually go to their desired destination until it loops back and goes the right way... whereas with a circle, they can always get to where they want to go, if they are willing to ride for a long time.

Carl

For what it's worth, any route of which part forms a circle will exhibit this issue, I think. In my experience, versions of the Circle Line and the T&W Metro are prone to this despite not being precise circles.

Simon Small

Re: "Cargo just seems to hop on the next convoy travelling to where it wants to go without knowledge of the route it takes to get there"

A similar thing happens in Standard. I was playing the Pharmacy Scenario from Pak64. Ship Oil to the Chemical plant to make Chemicals

Use a freighter to move Chemicals from the Chemical plant to the Pharmacy, and to the Packaging plant. Return Medicines to the Pharmacy, then go back to the Chemical plant. Set the wait limit to 50% on the Packaging plant

Now, use a lorry to move Chemicals to the Packaging plant, then return to the Chemical plant; only two stops

Let the game run. The freighter goes to the Packaging plant and waits for the minimum load of Medicines. The lorry comes to the Packaging plant and takes the next batch of Medicines to the Chemical plant. Presumably this is because the lorry is leaving first, and a route exists from the Chemical plant to the Pharmacy using the freighter. The freighter is stuck at the Packaging plant awaiting goods to fulfil the minimum load, which are taken by the lorry

I did not continue the game once this had happened, so I don't know how or if this corrects itself (or this might have a completely different reason)

jamespetts

Although I have yet to undertake any detailed testing on these matters, there are two distinct but related issues here: firstly, the actual routing used to determine which path between stops to get from the ultimate origin and ultimate destination that mail/goods/passengers should use; and, secondly, once the mail/goods/passengers are at a stop and know which stop to which to travel next, how those mail/goods/passengers decide which convoy to board.

I have some thoughts about how to improve both (I know that Carl has reported problems with routing previously with non-linear schedules, which is the same as the first issue), but this will have to be in the next major version, as it requires changing the saved game format. It may require some somewhat fundamental changes to certain aspects of routing, including possibly abolishing the idea of a "best" line or convoy and making all decisions as to which convoy to board on the fly, as well as storing each time in a schedule that a certain stop appears (in the case of a reversed schedule, once for each direction) rather than simply storing the stop and not distinguishing between different calls at that stop at different points in the schedule, which is the ultimate cause of the difficulties here. The complex issue is how to relate that additional complexity to the actual path finding, which needs simply to know the halt to halt timings, without greatly increasing the computational load of routing by having to search through all the timings on each line and line-less convoy to find the ones that pertain to the halt in question.

jamespetts

After a very large amount of work, I think that I have a fix for this (both aspects of the problem) on the way-improvements branch. Because it involves a significant change to the saved game format, it will not be in a release version until the next major release. It also has the happy side effect of putting much more accurate data in the departure boards (a new feature from Standard; see the latest Standard RC for an example) than would otherwise have been possible.