Cargodist routing algorithm

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
Bigboss
Engineer
Engineer
Posts: 18
Joined: 11 Nov 2011 22:13
Location: France

Cargodist routing algorithm

Post by Bigboss »

Hello everyone,

I could not find an answer to this question in existing threads...

I'm currently using Chill's patchpack, which notably includes cargodist. In order to best organize my tranport network, i'd like to understand better the routing algorithm used in cargodist that allocates passengers to the various transport modes and routes available to go from one point to an other. Is there (like there was in cargodest) a "cost" or "penalty" applied to each transport mode and to potential stops under way, and the passengers finally select the optimum route (up to saturation) instead of alternative more "costly" routes?

This question because i've noticed that passengers going from one city to others tend to prefer bus+train+bus (or even bus+train+train+bus) over bus+train+plane+train+bus, even when those cities are very far away.

- what are the respective penalties applied to each transport mode ?
- is there also a consideration of vehicle max speed, ie is the cost penalty the same for a steam loco and for a TGV? for a DC3 and a Concorde?
- what's the penalty applied to an intermediate stop when passengers can stay in the vehicle up to next station? is it the same than that of a stop requiring to change vehicle?
- is there a possibility to change those penalty settings?

Many thanks in advance for your answers, and sorry if they were already existing in an other thread...

Keep up the good work, it's really amazing how this game has progressed from the original TT...

Regards
Eddi
Tycoon
Tycoon
Posts: 8273
Joined: 17 Jan 2007 00:14

Re: Cargodist routing algorithm

Post by Eddi »

as far as i know, all configurable settings are in the linkgraph section of the advanced settings.

there are some non-configurable penalties that are calculated depending on frequency of service, capacity and speed of vehicles, and length of connection.

in my experience, plane routes tend to get overcrowded very quickly, so people search for alternate routes.
Arie-
Director
Director
Posts: 593
Joined: 20 Jan 2009 16:07

Re: Cargodist routing algorithm

Post by Arie- »

IIRC: CargoDist will appoint a greater portion of the cargo to the shortest route. Short here, can have several meanings, short as in distance (e.g. KM between two points), shorter as in time (ticks it takes a single trip between two points) and shorter as in bigger capacity/time. CargoDist uses capacity of links to determine routing. While planes may get your clients somewhere fast, a long train with several coaches has a far greater than a plane which makes the overall capacity of a link greater.
As far as these settings go, IIRC the only thing you can change is the saturation of the shortest route before CD starts assigning passengers to longer routes. This I am not sure of however, I haven't played with CD in a while.
Bigboss
Engineer
Engineer
Posts: 18
Joined: 11 Nov 2011 22:13
Location: France

Re: Cargodist routing algorithm

Post by Bigboss »

Many thanks Eddi & Arie. It seems indeed that playing with the saturation setting has some effect.

I'd be happy though to have a more quantitative understanding of how this algorithm works, so if anyone knows...

cheers
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Cargodist routing algorithm

Post by Alberth »

Does this help?
http://wiki.openttd.org/Cargodist

Otherwise, you can always read the source ;)
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargodist routing algorithm

Post by fonso »

Eddi and Arie are mostly right. Cargodist doesn't give penalties to transport modes. It only regards the capacity of a link as described by Arie and its length. The whole route is also penalized a bit by the number of links it's composed of. So a train that stops at 5 stations before reaching a destination will get less passengers for that destination than a train that only stops once. As the added length of the 6 links the first train creates is most likely higher than the added length of the two links the second one creates this doesn't make much of a difference most of the time (link length is only measured as manhattan distance between the involved stations). The description of the capacity setting is also right and indeed this is the only way to influence the routing algorithm.
The guy on the picture is not me, it's Alonso.
Bigboss
Engineer
Engineer
Posts: 18
Joined: 11 Nov 2011 22:13
Location: France

Re: Cargodist routing algorithm

Post by Bigboss »

Thanks Fonso - that's v clear.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 5 guests