Upcoming Games

(UTC times)


Full list
Add a game

Upcoming Events

No events to display

Having four trains as alternatives

You are here: Home > Forum > General > Timetabling > Having four trains as alternatives

Page 1 of 1

Having four trains as alternatives 20/08/2019 at 23:27 #120148
Underwood
Avatar
748 posts
Hello all,

Stuck on my Derby TT again, using a rule I haven't used before so need some assistance to fully understand how to do it.

Since I'm using Day of the Week decisions, the Test Trains are included as their MO, TO, WO, ThO and FO diagrams, but there is more than one each day but runs as required, depending on what 'cycle' they are on.

So I have 4 Friday's Only 3Qxx's on Friday Morning to Derby, only one of the 4 turns can only appear. I've looked up the Alternatives rule which states in the SimSig guide:

"For example: You specify that "1A01 and 1A02 are alternatives" and "1A03 and 1A02 are alternatives". This means that at runtime, the simulation will pick at random one of 1A01, 1A02 and 1A03 to run."

And suggest's using wildcards such as 1A99-? which will select anything from 1A99-A, 1A99-B etc etc, which sounds easier for more than two trains, but these Test Trains have 4 different headcodes, which are 3Q09, 3Q11, 3Q64 and 3Q06.

It say's you can't rule-chain them (1A01 - 1A02, 1A02 - 1A03) does that mean I can't do 3Q06 - 3Q09, 3Q09 - 3Q11 , 3Q11 - 3Q64?

If not how to I tie all 4 together so that only one of the 4 is randomly chosen?

Any help is most appreciated!


James.

Log in to reply
Having four trains as alternatives 21/08/2019 at 02:07 #120152
postal
Avatar
5265 posts
Long time since I've done this but mutually exclusive rules should work. It works by looking at the trains in order of their scheduled entry to the sim. If they are all due to enter at the same time it reads them alphabetically (i.e. the same order as you have listed them).

Set up three "are mutually exclusive" rules rather than the "are alternatives" rules. Then we need to weight the entry of the trains. The first train scheduled to enter is one of four so needs a 25% chance of entry. If that train does not run, then the sim looks at the second train to enter. As this is now one of three (the first train is now out of contention) it needs a 33% chance of entry. Similarly if that does not run the sim looks at the third train to enter; as this is now one of two it needs a 50% chance. Finally if none of the first three run, then the fourth train must enter so does not need a probability set.

The maths gives a near enough even chance of entry; things can get skewed if a train enters late but by and large you will get a roughly one in four chance of each train entering.

Mini-TT for Royston attached which has the same four TDs as you want to use and a few quick tests have given an even spread of entries.

Post has attachments. Log in to view them.
“In life, there is always someone out there, who won’t like you, for whatever reason, don’t let the insecurities in their lives affect yours.” – Rashida Rowe
Log in to reply
Having four trains as alternatives 21/08/2019 at 10:18 #120154
bfcmik
Avatar
100 posts
But wouldn't that allow train 1 AND train 3 or 4 to enter? Wouldn't you need to mutually exclusive the whole round robin of possibilities?
Log in to reply
Having four trains as alternatives 21/08/2019 at 10:44 #120156
postal
Avatar
5265 posts
bfcmik in post 120154 said:
But wouldn't that allow train 1 AND train 3 or 4 to enter? Wouldn't you need to mutually exclusive the whole round robin of possibilities?
Indeed so; it was too late last night! While you were typing I was doing more work on the TT.

In regard to the MutEx TT, rather than entering the rules individually, the easiest way is to use the "Add XOR list" button on the rules tab (which I missed last night). This adds all 6 MutEx rules rather than the 3 entered. Revised TT uploaded.

However, I've also been looking at the "are alternatives" rules and think I now have a handle on that. You can set up a pool of alternatives having rules of the format "train 1 and train 2 are alternatives". You can have more than two trains in the pool if you set up a list of "are alternatives" provided there is one train common to all of the rules. However, I think the order of the trains in the rule is important. Rules of the form "train 1 and train 2 are alternatives", "train 1 and train 3 are alternatives" etc. seems to weight things in favour of train 1. Rules of the form "train 2 and train 1 are alternatives", "train 3 and train 1 are alternatives" etc. seems to give equal weighting. You also don't need the percentage chances of running using the "are alternatives".

I've uploaded two "are alternatives" TTs with the common train first and second in the rules. Running 20 tests on each TT, the trains entering were:

MutEx: 3Q06, 4 entries; 3Q09, 6 entries: 3Q11, 7 entries: 3Q64, 3 entries
3Q06 first: 3Q06, 10 entries; 3Q09, 4 entries; 3Q11. 4 entries; 3Q64, 2 entries
3Q06 second: 3Q06, 3 entries; 3Q09, 5 entries; 3Q11, 5 entries; 3Q64 7 entries

On that basis, setting up three "are alternatives" rules of the form:

1) 3Q09 and 3Q06 are alternatives
2) 3Q11 and 3Q06 are alternatives
3) 3Q64 and 3Q06 are alternatives

would seem to be the easiest way forward.

Post has attachments. Log in to view them.
“In life, there is always someone out there, who won’t like you, for whatever reason, don’t let the insecurities in their lives affect yours.” – Rashida Rowe
Last edited: 21/08/2019 at 10:47 by postal
Reason: None given

Log in to reply
Having four trains as alternatives 21/08/2019 at 10:56 #120157
postal
Avatar
5265 posts
postal in post 120156 said:
However, I think the order of the trains in the rule is important. Rules of the form "train 1 and train 2 are alternatives", "train 1 and train 3 are alternatives" etc. seems to weight things in favour of train 1.
I knew I'd read it somewhere!. Verified in this thread by Clive. Actual quote is:

"You can weight a train by making it appear first in more than one rule."

I'll add a note to the "Are alternatives" page of the Wiki to make the point.

“In life, there is always someone out there, who won’t like you, for whatever reason, don’t let the insecurities in their lives affect yours.” – Rashida Rowe
Last edited: 21/08/2019 at 11:24 by postal
Reason: None given

Log in to reply
Having four trains as alternatives 21/08/2019 at 11:47 #120158
Meld
Avatar
1111 posts
Surely one decision will sort all this out

Decision 3Qxx

Choices 3Q06,3Q09,3Q11 & 3Q64, which can be weighted for entry, the only rules then required would be for any re-entry

Passed the age to be doing 'Spoon Feeding' !!!
Log in to reply
Having four trains as alternatives 21/08/2019 at 11:52 #120159
Meld
Avatar
1111 posts
postal in post 120157 said:
postal in post 120156 said:
However, I think the order of the trains in the rule is important. Rules of the form "train 1 and train 2 are alternatives", "train 1 and train 3 are alternatives" etc. seems to weight things in favour of train 1.
I knew I'd read it somewhere!. Verified in this thread by Clive. Actual quote is:

"You can weight a train by making it appear first in more than one rule."

I'll add a note to the "Are alternatives" page of the Wiki to make the point.
I thought you could only apply a weight to a decision or am I missing something here ???

Passed the age to be doing 'Spoon Feeding' !!!
Log in to reply
Having four trains as alternatives 21/08/2019 at 13:59 #120161
postal
Avatar
5265 posts
Meld in post 120159 said:
I thought you could only apply a weight to a decision or am I missing something here ???
The TT writer is not applying a weight; the core code is doing it. IIRC it works from the first train in the "are alternatives" rule. It counts all instances for the first train so if you have 3 rules all starting "T1 is alternative to" it counts that as 3 x T1. However, it only counts each TD once if the TD occurs multiple times as the second train.

If you have T1 is alternative to T2, T1 is alternative to T3 and T1 is alternative to T4, then it counts up and has 3 x T1, 1 x T2, 1 x T3 and 1 x T4 so you would see 3 entries of T1 for each of T2,T3 and T4. This is backed up by the test I did which gave 10 x T1, 4 x T2, 4 x T3 and 2 x T4. Conversely if you have T2 is alternative to T1, T3 is alternative to T1 and T4 is alternative to T1 you only get the code counting 1 x T1, 1 x T2, 1 x T3 and 1 x T4 so equal chances of entry which again tested out.

It does mean that you can play with the set up the rules to induce a weighting. Suppose you had T1, T2, T3 and T4 as alternatives and you wanted T1 to enter twice as often; you would then set up 3 rules, T1 is alternative to T2, T1 is alternative to T3 and T4 is alternative to T1. I think the code would then count that as 2 x T1, 1 x T2, 1 x T3 and 1 x T4 but that would need testing.

“In life, there is always someone out there, who won’t like you, for whatever reason, don’t let the insecurities in their lives affect yours.” – Rashida Rowe
Last edited: 21/08/2019 at 19:11 by postal
Reason: None given

Log in to reply
Having four trains as alternatives 21/08/2019 at 14:00 #120162
postal
Avatar
5265 posts
Meld in post 120158 said:
Surely one decision will sort all this out

Decision 3Qxx

Choices 3Q06,3Q09,3Q11 & 3Q64, which can be weighted for entry, the only rules then required would be for any re-entry
Not if those trains are already subject to a DotW decision.

“In life, there is always someone out there, who won’t like you, for whatever reason, don’t let the insecurities in their lives affect yours.” – Rashida Rowe
Last edited: 21/08/2019 at 14:01 by postal
Reason: None given

Log in to reply
Having four trains as alternatives 21/08/2019 at 14:56 #120163
postal
Avatar
5265 posts
Another option if there is a FO train that enters before any of the 3Qxx's would be to take out the DotW decision and use the 3Qxx decision then set up rules that each of the 3Qxx's must enter 0 minutes after the nominated FO train. That is subject to the risk that the nominated FO train enters late and potentially delays any of the possible 3Qxx entries.
“In life, there is always someone out there, who won’t like you, for whatever reason, don’t let the insecurities in their lives affect yours.” – Rashida Rowe
Last edited: 21/08/2019 at 19:12 by postal
Reason: None given

Log in to reply
Having four trains as alternatives 26/08/2019 at 22:45 #120217
clive
Avatar
2789 posts
postal in post 120161 said:


The TT writer is not applying a weight; the core code is doing it. IIRC it works from the first train in the "are alternatives" rule. It counts all instances for the first train so if you have 3 rules all starting "T1 is alternative to" it counts that as 3 x T1. However, it only counts each TD once if the TD occurs multiple times as the second train.
[...]

That's right; I deliberately designed it that way.

Log in to reply
The following user said thank you: postal
Having four trains as alternatives 29/08/2019 at 13:50 #120253
Underwood
Avatar
748 posts
Thank you for the help! Postal, that Royston TT was very helpful much more clearer having an example. I am going through testing now having tried to tie these up, so hopefully it will work.

Interesting that the only one I didn't rule was 3Z03 which is Tuesdays Excluded, when required, to Old Dalby (calibrating I believe is done there) I'm sure I set it to 50% probability and it appeared, I checked the timetable and the box is unchecked, along with some others I'm sure I set to % probability of appearing and they all have appeared and all unchecked boxes, Its early time in the sim so I might not have set it I'll keep an eye on the others.

Thank you once again for your replies and help

Log in to reply
The following user said thank you: postal