Upcoming Games

(UTC times)


Full list
Add a game

Upcoming Events

No events to display

Chaining sims with decisions and choices in the timetable

You are here: Home > Forum > General > Timetabling > Chaining sims with decisions and choices in the timetable

Page 2 of 2

Chaining sims with decisions and choices in the timetable 16/04/2021 at 18:05 #138698
GeoffM
Avatar
6367 posts
Bear in mind I don't have much experience with decisions/choices - that's something Clive implemented with input from the more knowlegeable than I on this thread. That said, I believe the idea is to allow the user to select a set of decisions during the "start new simulation" sequence. I think the author would be able to nominate and group decisions together such that:
- Some decisions are internal (only in the F4 TT editor, as per now)
- The author can list decisions into a group such that zero, one, or multiple can be selected (min/max being at author's choice)
- Some decisions could be mutually exclusive

This way, I believe an end user could either go with the default (no selections made), pretty much as now, or they could drill down and say "I want a Tuesday timetable" and add in "extra coal trains" or suchlike.

All very out-loud-thinking rather than this-is-it kind of thing, so input appreciated.

SimSig Boss
Log in to reply
Chaining sims with decisions and choices in the timetable 16/04/2021 at 18:58 #138702
Jan
Avatar
903 posts
With regards to chaining: For the kinds of major decisions that need to be taken immediately at sim startup that certainly sounds like a reasonable idea, plus it can be useful in single play, too.

For decisions that happen later on at runtime, it'd probably still be preferable if the decision state could somehow be shared across chained simulations, so you don't have to manually specify each and every "alternative train"-type decision across the chain already right at the initial sim startup.

To prevent a decision from being taken simultaneously in multiple chained sims, there'd have to be either some sort of collision detection, or alternatively, it might perhaps make more sense to have a designated master sim responsible for taking all shared decisions across the chain, e.g. by reusing the master-slave relationship that already exists for the purpose of time synchronisation.

So whenever a decision needs to be taken, the sim will ask its designated master neighbour, which in turn might have to forward that request to its own designated master and so on until you reach the master sim at the end of the chain, which will then take the decision and broadcast the result back down the chain.

Two million people attempt to use Birmingham's magnificent rail network every year, with just over a million of them managing to get further than Smethwick.
Log in to reply
Chaining sims with decisions and choices in the timetable 16/04/2021 at 18:58 #138703
jc92
Avatar
3682 posts
So building on the thoughts listed. Maybe in the decisions box for each decision, there's a tick box for "user definable" which will then trigger the decision to be listed in the startup screen and the user can ignore it (default) or pick the decision in the same way as any other startup option.

That way the 270 odd decisions relating to various behind the scenes stuff can be ignored but the 2 for DOTW and (for arguments sake) whether race day extras run or not, will be the only ones offered, keeping things user friendly.

"We don't stop camborne wednesdays"
Log in to reply
Chaining sims with decisions and choices in the timetable 16/04/2021 at 19:18 #138705
GeoffM
Avatar
6367 posts
Jan in post 138702 said:
With regards to chaining: For the kinds of major decisions that need to be taken immediately at sim startup that certainly sounds like a reasonable idea, plus it can be useful in single play, too.
And testing.

Jan in post 138702 said:
For decisions that happen later on at runtime, it'd probably still be preferable if the decision state could somehow be shared across chained simulations, so you don't have to manually specify each and every "alternative train"-type decision across the chain already right at the initial sim startup.

To prevent a decision from being taken simultaneously in multiple chained sims, there'd have to be either some sort of collision detection, or alternatively, it might perhaps make more sense to have a designated master sim responsible for taking all shared decisions across the chain, e.g. by reusing the master-slave relationship that already exists for the purpose of time synchronisation.

So whenever a decision needs to be taken, the sim will ask its designated master neighbour, which in turn might have to forward that request to its own designated master and so on until you reach the master sim at the end of the chain, which will then take the decision and broadcast the result back down the chain.
While that could be done, I'm not sure that's going to be sensible in all cases. It relies on every sim in the entire chain either knowing about the specific decision name, or not caring about it and passing it on. The problem is when the identity is neither of those: it's ambiguous, or otherwise means something different in one or more sims compared to other sims. It's hard enough to ensure all sims in (say) the 2009 Groundhog day timetable are consistent across all sims: to add unique decisions to those (or matching, as appropriate) is another level of complexity - and it's easier when the same authors produce those TTs. Different authors is going to be a nightmare.

SimSig Boss
Log in to reply
Chaining sims with decisions and choices in the timetable 16/04/2021 at 19:19 #138706
GeoffM
Avatar
6367 posts
jc92 in post 138703 said:
So building on the thoughts listed. Maybe in the decisions box for each decision, there's a tick box for "user definable" which will then trigger the decision to be listed in the startup screen and the user can ignore it (default) or pick the decision in the same way as any other startup option.
It's not as simple as that. Unless you want the user to be able to select all seven days of a DOTW-style timetable... Hence my comment about grouping and multi-select.

SimSig Boss
Log in to reply
Chaining sims with decisions and choices in the timetable 16/04/2021 at 19:51 #138707
Jan
Avatar
903 posts
Something like the chaining tool could in principle be extended to also ensure that decisions and their choices are consistently named and applied across all timetables in a chain, couldn't it? Though it might indeed not be possible to automate all the necessary checks, and you're right that it adds some amount of complexity.
Maybe making that feature opt-in, so timetable authors can specifically decide which decisions they want to apply across a whole chain, and which others remain purely local might also make sense and help with this a little?

Unless you decide that the whole problem of coordinating decisions that affect multiple sims (because depending on state of the decision a train e.g. needs to enter either via sim A or else via sim B) is too hard and too much of a corner case to be worth bothering (which I concede is a valid option, too), there isn't a radically different and easier solution for this general sort of problem, though, is there?
I seem to remember that quite some time ago possibly either you yourself or Clive already mentioned the idea of having some sort of helper tool for coordinating that sort of decisions across chains, which in the end would amount to more or less the same thing as I've described above in terms of cross-sim timetable data coordination requirements.

Two million people attempt to use Birmingham's magnificent rail network every year, with just over a million of them managing to get further than Smethwick.
Log in to reply
Chaining sims with decisions and choices in the timetable 16/04/2021 at 21:27 #138711
bill_gensheet
Avatar
1394 posts
Online
GeoffM in post 138706 said:
jc92 in post 138703 said:
So building on the thoughts listed. Maybe in the decisions box for each decision, there's a tick box for "user definable" which will then trigger the decision to be listed in the startup screen and the user can ignore it (default) or pick the decision in the same way as any other startup option.
It's not as simple as that. Unless you want the user to be able to select all seven days of a DOTW-style timetable... Hence my comment about grouping and multi-select.
As decisions do not nest at present, all have to be be independent, so you might get 'THU' and 'THU+GOLF' if 'GOLF' was not fully independent of DOTW. I would say that if the sim can choose a day from 7 (or even more), why not the user ?
So a simple tick might well suffice to offer the decision for 'presetting' at startup.

Easier in images...
Image 1 - added option when creating/editing the decision
Image 2 - in the startup screen, after the timetable is selected.
Image 3 - when clicking 'Set Now' user simply gets a cut down version of the edit box.

Post has attachments. Log in to view them.
Last edited: 16/04/2021 at 21:33 by bill_gensheet
Reason: correct image 3

Log in to reply
Chaining sims with decisions and choices in the timetable 17/04/2021 at 11:10 #138720
clive
Avatar
2781 posts
I’ve been watching this thread for a while and thinking about it, and have concluded that there are actually several different issues involved. The following are just my ideas and aren’t any sort of commitment at this point.

====

Problem 1: it’s not possible to select a choice on a decision at startup (e.g. for testing) because if the choice is involved in seeding then it will be made before the first clock tick and therefore before “Start simulation paused” applies.

Answer: have a “launch hold” option at startup. This pauses things after the scenario and options have been selected, the timetable loaded, and the screen drawn, but before seeding. This gives time for the user to change things in the timetable (including choices) before they affect seeding. It also gives times for chains and clients to be set up. Indeed, there’s an argument to be made that this option should always be on if the user starts up in server mode.

====

Problem 2: the name of a decision and its choices to select (say) day of the week is not consistent between simulations or even between timetables.

There are two answers here: both are, I think, useful.

Answer A: have documented conventions. Some would be global (e.g. “day of the week” decisions would always be called, say, “DOTW” and the choices would always be “M”, “T”, “W”, “Th”, “F”, “S”, and “Su”; please argue about your favourite later) and would be documented on a “global decisions conventions” page. Others would be sim-specific (e.g. “RACEDAY” with choices “Y” and “N” for HongKongEast) and documented somewhere indexed by simulation.

Answer B: have a tool to go through a timetable and rename a decision and all its choices rather than the timetable writer having to do it by hand. This could be part of the Loader but I actually think it would be better as a separate program. The timetable format is not secret and it would mean someone other than Geoff or I could write it, giving us more time for other stuff. Details can be discussed later.

====

Problem 3: it would be nice to be able to select a choice at startup in a more convenient way than digging into the timetable editor.

Answer: add a new feature (perhaps selected from the hamburger menu) that allows the user to enter a decision name and, if it hasn’t already been decided, gives them a set of radio buttons to pick the choice from. It would also be possible to have a way for the timetable writer to flag a decision as “might want to choose this”, with all such decisions offered to the user to think about. Again, details can be discussed later.

====

Problem 4: some decisions need to be co-ordinated among simulations in a chain.

Answer: firstly, “launch hold” means that there’s time to set it up and answer 3 makes it easier. But is there a better way?

I have two ideas on this.

Idea A: there’s a “chain set up” button that appears as soon as a user chains a sim while still in “launch hold”. When all the chains are set up, one user clicks that button. This makes their simulation the “co-ordinator” for the chain. The first thing it does is sends a search out to determine what sims are present and returns a list of sims and decisions in each sim to the co-ordinator (it also disables the buttons on the others, changing them to a “co-ordination in progress” indicator). The co-ordinator presents its user with a list of decisions that appear in more than one simulation (and, optionally, all other decisions as well). The user can select choices for these or can just tell the sim to make a choice and ensure all the simulations using that decision make the same choice. That’s distributed back to the other sims and, once it’s all done, the co-ordination is complete and launch hold can be released.

This idea has advantages but it’s a lot of code and a lot of work by the co-ordinating user each time. So:

Idea B: there’s a way to create a separate co-ordination file that specifies the simulations required, the timetables to be used on each simulation, and how the decisions in these timetables relate to each other (independent or always make the same choice). This could be part of the timetable editor in the Loader or it could be a separate tool; I’d prefer the latter for the same reason as the decision renamer. Then a chain is set up, not by selecting timetables, but by selecting a co-ordination file on each sim, which will organize the details (though the chaining itself still needs to be done by hand).

====

All of these are just initial thoughts. But it seems to me that they’re better than the various hacks being proposed at the moment (such as 6 versions of each timetable).

Feedback is very welcome.

Log in to reply
The following users said thank you: bill_gensheet, postal
Chaining sims with decisions and choices in the timetable 17/04/2021 at 11:14 #138722
clive
Avatar
2781 posts
GeoffM in post 138705 said:

Jan in post 138702 said:
For decisions that happen later on at runtime, it'd probably still be preferable if the decision state could somehow be shared across chained simulations, so you don't have to manually specify each and every "alternative train"-type decision across the chain already right at the initial sim startup.

To prevent a decision from being taken simultaneously in multiple chained sims, there'd have to be either some sort of collision detection, or alternatively, it might perhaps make more sense to have a designated master sim responsible for taking all shared decisions across the chain, e.g. by reusing the master-slave relationship that already exists for the purpose of time synchronisation.

So whenever a decision needs to be taken, the sim will ask its designated master neighbour, which in turn might have to forward that request to its own designated master and so on until you reach the master sim at the end of the chain, which will then take the decision and broadcast the result back down the chain.
While that could be done, I'm not sure that's going to be sensible in all cases. It relies on every sim in the entire chain either knowing about the specific decision name, or not caring about it and passing it on. The problem is when the identity is neither of those: it's ambiguous, or otherwise means something different in one or more sims compared to other sims.
If you're going to use multiple timetables, I think it's reasonable to require a bit of co-ordination between the authors.

Note that my proposals above involve being able to say which decisions are co-ordinated and which aren't, and also provide an easy way to change the decision names after the timetables are written.

Log in to reply
Chaining sims with decisions and choices in the timetable 17/04/2021 at 11:18 #138723
clive
Avatar
2781 posts
postal in post 138651 said:

You don't need seed groups; you can just go back to how it used to be done before decisions came along. The core code was not written to specifically ensure that this method worked so Geoff and Clive always viewed it as an at your own risk strategy. You have a group of seed trains all entering at start time and all with a TD/UID which puts them at the front of the queue alphabetically (so typically 0A00/$0A00MON, 0A00/$0A00TUE etc). You then set up MUTEX rules for all five and add weights to the trains so they all have an equal chance. The core code will read the TT alphanumerically and come to 0A00/$0A00FRI first. As you want that to have a 1 in 5 chance of running you set the entry percentage as 20%. If that does not enter because of the MUTEX rules, the core code next reads 0A00/$0A00MON. You want that to have an equal chance of running as any of the other three remaining days so you set the entry percentage as 25%. It is then rinse and repeat with 0A00/$0A00THU set at 33%, 0A00/$0A00TUE as 50% and 0A00/$0A00WED with the entry set to 100% or left unchecked.
Hey, I added a better way (XOR, I think it's called; can't be bothered to look) where you just say "only one of $0A00* runs, chosen at random").

Log in to reply
The following user said thank you: postal
Chaining sims with decisions and choices in the timetable 17/04/2021 at 14:03 #138738
broodje
Avatar
184 posts
How hard would it be to make it possible to make 1 timetable that can be read by all sims? I mean you make one file that holds the TT for an certain region. That way you eliminate the trouble of having different decision names. This also makes it easier to have the same train types and TD/uid.
The SIM only 'reads' the locations it has in the area, but it can 'read' all already used TD/uid, train types and decisions. It could even pick up the entry location and time of all trains to pre-fill the TT for the area.

Last edited: 17/04/2021 at 14:04 by broodje
Reason: None given

Log in to reply
Chaining sims with decisions and choices in the timetable 17/04/2021 at 14:09 #138740
KymriskaDraken
Avatar
963 posts
broodje in post 138738 said:
How hard would it be to make it possible to make 1 timetable that can be read by all sims? I mean you make one file that holds the TT for an certain region. That way you eliminate the trouble of having different decision names. This also makes it easier to have the same train types and TD/uid.
The SIM only 'reads' the locations it has in the area, but it can 'read' all already used TD/uid, train types and decisions. It could even pick up the entry location and time of all trains to pre-fill the TT for the area.
That could work for timetables which are largely based on a CIF file from Network Rail.

Kev

Log in to reply
Chaining sims with decisions and choices in the timetable 18/04/2021 at 06:33 #138759
Meld
Avatar
1111 posts
clive in post 138723 said:
postal in post 138651 said:

You don't need seed groups; you can just go back to how it used to be done before decisions came along. The core code was not written to specifically ensure that this method worked so Geoff and Clive always viewed it as an at your own risk strategy. You have a group of seed trains all entering at start time and all with a TD/UID which puts them at the front of the queue alphabetically (so typically 0A00/$0A00MON, 0A00/$0A00TUE etc). You then set up MUTEX rules for all five and add weights to the trains so they all have an equal chance. The core code will read the TT alphanumerically and come to 0A00/$0A00FRI first. As you want that to have a 1 in 5 chance of running you set the entry percentage as 20%. If that does not enter because of the MUTEX rules, the core code next reads 0A00/$0A00MON. You want that to have an equal chance of running as any of the other three remaining days so you set the entry percentage as 25%. It is then rinse and repeat with 0A00/$0A00THU set at 33%, 0A00/$0A00TUE as 50% and 0A00/$0A00WED with the entry set to 100% or left unchecked.
Hey, I added a better way (XOR, I think it's called; can't be bothered to look) where you just say "only one of $0A00* runs, chosen at random").
If you use UIDs as opposed to TIDs I don't think you could use XOR, for example any of the 3Sxx services on Three Bridges which re enter numerous times as a UID would be A12345A A12345B etc to set up re-entry rules. Then you have duplicated headcodes with different UIDS on passenger work x hours apart (Cardiff Bay for example). So you could be at 8am and the decision selects the 6pm version.

We've had decisions now for nearly 5 years, there's still no examples, especially of the more complicated decisions you could make on the wiki.

Passed the age to be doing 'Spoon Feeding' !!!
Log in to reply