The International Simutrans Forum

 

Author Topic: New industry just in time model  (Read 500 times)

0 Members and 1 Guest are viewing this topic.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
New industry just in time model
« on: August 16, 2020, 12:34:18 AM »
I recall that there has been some discussion recently with respect to the industry demand model, and Ranran had posted a number of detailed examples - unfortunately, I cannot seem to find that thread.
In any event, I have spent some time to-day working on an alternative demand model. I have now implemented it in the code, and it is available if one sets the just in time mode to 4. If this be not changed, the current behaviour will remain.
What this mode does is to demand goods and cause them to be put in transit whenever the consumer industry calculates that its warehouse will become empty before the next delivery if more goods be not put in transit now (plus a margin of error if the base maximum in transit percentage be set to > 100% as is recommended).

The idea is that this will cause industries to operate in a pattern of demanding shipments of enough goods to fill their internal storage entirely and then not demanding any more until their internal storage is running low enough that the industry will run out if it does not order some more.
The intention of this is to prevent industries demanding such small quantities of goods be delivered at once so as to make transport uneconomic, as had been complained of on the Bridgewater-Brunel server, especially with agricultural industries, and to allow the extent to which the industry operates a just in time system to be configurable by the pakset author by setting the ratio of the input storage to the consumption rate.

Before I modify the server's configuration to enable this mode, I should be grateful if people could test it and post feedback here. Thank you in advance.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 386
  • Languages: EN
Re: New industry just in time model
« Reply #1 on: August 16, 2020, 02:35:25 AM »
I tested this change with an offline save of bridgewater-brunel for a long time with just in time set to 4, and unfortunately I didn't notice any improvement over the original - all the irrational behaviour of the original seems to have remained.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: New industry just in time model
« Reply #2 on: August 16, 2020, 10:15:10 AM »
I tested this change with an offline save of bridgewater-brunel for a long time with just in time set to 4, and unfortunately I didn't notice any improvement over the original - all the irrational behaviour of the original seems to have remained.

Can I ask you to clarify precisely what problematic behaviour that you observe with just in time set to 4?

Offline freddyhayward

  • Devotee
  • *
  • Posts: 386
  • Languages: EN
Re: New industry just in time model
« Reply #3 on: August 16, 2020, 10:48:41 AM »
Can I ask you to clarify precisely what problematic behaviour that you observe with just in time set to 4?
The same behaviour as before the change, described in a number of threads. Generally, producers are overstocked while consumers are undersupplied, too few goods are going into transit, the slowest routes are preferred over the fastest, and most freight transport is generally not viable. It's possible that the changes have effects that I haven't noticed, however.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: New industry just in time model
« Reply #4 on: August 16, 2020, 11:35:44 AM »
The same behaviour as before the change, described in a number of threads. Generally, producers are overstocked while consumers are undersupplied, too few goods are going into transit, the slowest routes are preferred over the fastest, and most freight transport is generally not viable. It's possible that the changes have effects that I haven't noticed, however.

As stated in the original post, I have had trouble finding the other thread discussing this in detail. Can you elaborate on what you mean by "overstocked" and "undersupplied"? The only thing that I found in testing was that there were cases where a producer which was part way through producing 1 unit would show that it had 1 unit in the UI (owing to different rounding used in the UI and in the simulation code) and it would appear that it was not sending that unit to the consumer for no good reason whereas in fact it had simply not finished producing that unit.

Were you able to identify any issues that could not be explained by the above in your testing? If so, it would be very helpful to know the details.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: New industry just in time model
« Reply #5 on: August 18, 2020, 10:08:35 PM »
I have done some testing of the just in time 4 model myself, and have found that it does make a significant difference. See the below screenshots:







I am therefore having trouble following the suggestion that the new version is no different. Can anyone elaborate on or explain this statement? If not, I will have to assume that it was an error and will set the just in time model to 4 on the Bridgewater-Brunel server.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 386
  • Languages: EN
Re: New industry just in time model
« Reply #6 on: August 18, 2020, 10:51:21 PM »
Those tests look promising, so it is possible that I may not have correctly set it or that the industries I observed were less affected than others. In any case, there seems to be no harm to setting bridgewater-brunel to model 4, so that should go ahead.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: New industry just in time model
« Reply #7 on: August 18, 2020, 10:55:03 PM »
Those tests look promising, so it is possible that I may not have correctly set it or that the industries I observed were less affected than others. In any case, there seems to be no harm to setting bridgewater-brunel to model 4, so that should go ahead.

I have modified the default just in time mode in the pakset, so this change should take effect from to-morrow's nightly build.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: New industry just in time model
« Reply #8 on: August 27, 2020, 11:40:29 AM »
I have modified the default just in time mode in the pakset, so this change should take effect from to-morrow's nightly build.

I should note that this did not work as expected, and, as of now, the just in time model on the server remains at 2. I have now modified the server's simuconf.tab file so that the server's pakset settings override saved game settings, so this should in fact be applied from to-morrow's nightly build.

I should be grateful if people could re-test how industries work on the server from to-morrow. Thank you.

Offline Ranran

  • Devotee
  • *
  • Posts: 1161
  • Languages: ja
Re: New industry just in time model
« Reply #9 on: August 28, 2020, 03:22:38 AM »
I noticed this from a CI warning mail from Github. (´・ω・`)

https://github.com/jamespetts/simutrans-extended/blob/adbba1241255a82e2d757cd46a2760dcd115787c/dataobj/settings.cc#L1885

I think this should be as follows:

Code: [Select]
if (file->get_extended_version() >= 15 || (file->get_extended_version() == 14 && file->get_extended_revision() >= 30))

Offline Freahk

  • Devotee
  • *
  • Posts: 1257
  • Languages: DE, EN
Re: New industry just in time model
« Reply #10 on: August 28, 2020, 09:12:09 AM »
Both codes are eqivalent. It's arguable which one is more readable.
« Last Edit: September 23, 2020, 12:58:46 PM by Freahk »