Unique IDs questions

You are here: Home > Forum > General > General questions, comments, and issues > Unique IDs questions

Page 2 of 2

Unique IDs questions 19/02/2015 at 00:10 #69330
Finger
Avatar
220 posts
" said:
" said:
For an example, see the attached timetable with such chain.
It would be helpful if you could identify which sim should be used to run your timetable. Until then all we have is one reported set of results which may or may not be replicated when someone else uses the same source data.

It's King's Cross, sorry for omitting that.

Log in to reply
Unique IDs questions 19/02/2015 at 15:47 #69349
clive
Avatar
1951 posts
" said:
Clive wrote:
Quote:
You only need one of those rules, not both.

I'm not convinced that is correct Clive.
...
I've just checked the code. One rule will definitely work.

Log in to reply
The following user said thank you: 58050
Unique IDs questions 19/02/2015 at 15:57 #69350
clive
Avatar
1951 posts
" said:

" said:
Unlike "mutually exclusive", "are alternatives" is transitive and so you can do it with N-1 rules for N trains.

That is not true, I just tested it.
You are right; I misremembered how it works.

I think I've written this up before, but I'll do it again. Here's how it works.

When a train is being considered to enter, the code does the following:

  1. Make a list of "AreAlternatives" rules that match either the headcode or the UID in either position.

  2. For every train that hasn't yet entered or been cancelled, go through this list of rules twice.
    [ol]
    [li]The first time, if the train matches the first headcode or UID in a rule, add it to the list even if it's already there.

  3. The second time, if the train matches the second headcode or UID in a rule, add it to the list if it's not already there.


[/li]
  • Pick an entry from the resulting list of trains at random.

  • Cancel all the other trains in the list.

  • [/ol]
    Comparisons of headcodes are done using wildcards, while comparisons of UIDs (currently) aren't.

    Assuming we have one train 1A11 and one train 1A12, then a rule "1A11 and 1A12 are alternatives" will put each of them in the list once, making them equally likely. If you have two copies of that rule, 1A11 will be put in the list twice but 1A12 once, so 1A11 will appear twice as often.
    Quote:

    Moreover, any given train should probably not be in more than one AA rule (SimSig can't, as yet, solve sudoku, so it will have strange results).
    Not strange results, but ones you need to think through.

    Last edited: 19/02/2015 at 16:15 by clive
    Log in to reply
    Unique IDs questions 19/02/2015 at 16:03 #69351
    clive
    Avatar
    1951 posts
    " said:
    " said:
    Or you can use the wildcard feature whose exact syntax I've forgotten and do it all with one rule.
    Doesn't work with UIDs, only TDs for the "are alternatives" rule. I queried this and was told it was something which has been specifically written into the core code.

    Syntax is "1A00??? are alternatives". One "?" for each character and all in the group must have the same number of characters.
    This is correct, thanks. I don't know why UIDs aren't allowed to have wildcards. Mantis 12518.

    Last edited: 19/02/2015 at 16:04 by clive
    Log in to reply
    Unique IDs questions 19/02/2015 at 16:07 #69353
    clive
    Avatar
    1951 posts
    " said:

    The "are alternative" rules are written in the form "Train A and Train B are alternatives", "Train B and Train C are alternatives", "Train C and Train D are alternatives" and "Train D and Train A are alternatives" so 4 rules rather than 6 using the XOR method.
    Hmm, I don't think that works. If train A gets considered for entry first, then one of A, B, and D will selected and the other two cancelled, but C will still be able to enter.

    Log in to reply
    Unique IDs questions 19/02/2015 at 16:12 #69354
    clive
    Avatar
    1951 posts
    " said:
    " said:
    based on this info im writing at timetable where a train could be a class 158/142/144/150/2 x 153/155 or 3 car 144 any ideas how i could randomize this to replicate deviation from the "booked" unit?
    You'd have to duplicate the schedule as many times as required, and set up 'are alternatives' rules. You can differentiate the schedules either by using the traditional 1A00-1, 1A00-2 etc. method, or by setting all their headcodes to 1A00 and setting the UIDs to [whatever]-1, [whatever]-2 etc.
    In both cases you only need one "are alternatives" rule; the first case would use a wildcard.

    Quote:

    I'm not sure if the 'Are alternatives' can be given a weighting (so the booked unit turns up 90% of the time, for example), a different way to do is to have the booked unit schedule running 90% of the time and another schedule running all the time, but with the rule "[other schedule] must not run if [booked unit] runs"
    You can weight a train by making it appear first in more than one rule. So in this case you'd need 9 copies of the rule "[booked unit] and [other schedule] are alternatives". This case is probably better done with the weighting you suggest, though it's important that [booked unit] gets considered for entry first (e.g. by having an earlier entry time).

    Log in to reply
    Unique IDs questions 19/02/2015 at 21:36 #69367
    postal
    Avatar
    3856 posts
    " said:
    " said:

    The "are alternative" rules are written in the form "Train A and Train B are alternatives", "Train B and Train C are alternatives", "Train C and Train D are alternatives" and "Train D and Train A are alternatives" so 4 rules rather than 6 using the XOR method.
    Hmm, I don't think that works. If train A gets considered for entry first, then one of A, B, and D will selected and the other two cancelled, but C will still be able to enter.
    Failed to understand this crucial point from the Wiki:

    "Note however that rule-chains in the style of “1A01 and 1A02 are alternatives”, “1A02 and 1A03 are alternatives” and “1A03 and 1A04 are alternatives” don't work, as there is no common train linking all of them together. "

    Looks like I've got a TT or 2 to re-write. The problem is how to do it. For the 4 train situation, can anyone point me to how the "are alternatives" rules should be set up so that each train has the same chance of entering?

    Apologies to those who have taken a bum steer from me and thanks to Clive for the information.

    "Besides the noble art of getting things done, there is a nobler art of leaving things undone. The wisdom of life consists in the elimination of nonessentials." - Lin Yutang (10/10/1895 – 26/03/1976), Chinese writer, translator, linguist, philosopher and inventor.
    Log in to reply
    Unique IDs questions 19/02/2015 at 22:13 #69369
    Sacro
    Avatar
    1019 posts
    " said:
    " said:
    Looks like I've got a TT or 2 to re-write. The problem is how to do it. For the 4 train situation, can anyone point me to how the "are alternatives" rules should be set up so that each train has the same chance of entering?
    Quick answer, remove them all (0% chance of entering), or don't use any rules (100% chance of entering).

    Other than that, I guess A and B, A and C, A and D, B and C, B and D, C and D are alternatives.

    Last edited: 19/02/2015 at 22:14 by Sacro
    Reason: Stupid nested quotes

    Log in to reply
    Unique IDs questions 19/02/2015 at 22:37 #69370
    clive
    Avatar
    1951 posts
    " said:
    " said:
    " said:
    Looks like I've got a TT or 2 to re-write. The problem is how to do it. For the 4 train situation, can anyone point me to how the "are alternatives" rules should be set up so that each train has the same chance of entering?
    Quick answer, remove them all (0% chance of entering), or don't use any rules (100% chance of entering).

    Other than that, I guess A and B, A and C, A and D, B and C, B and D, C and D are alternatives.
    Find a way to do it with wildcards.

    Otherwise, it's not going to trivial to give them all the same chance. I've just spent 10 minutes and haven't been able to work out a way.

    Last edited: 19/02/2015 at 22:37 by clive
    Log in to reply
    Unique IDs questions 19/02/2015 at 23:50 #69374
    postal
    Avatar
    3856 posts
    " said:


    1. The first time, if the train matches the first headcode or UID in a rule, add it to the list even if it's already there.

    2. The second time, if the train matches the second headcode or UID in a rule, add it to the list if it's not already there.


    I've done a bit of testing and think there may be a way based on those two bits of the logic.

    I set up a TT with 4 seed trains entering at different locations so that duplicate entries would be spotted. I then set up 3 rules of the form Train B and Train A are alternatives, Train C and Train A are alternatives, Train D and Train A are alternatives.

    Tested with 20 loads of the sim. There were no duplicate entries and the breakdown of the entered trains was:

    Train A 7
    Train B 6
    Train C 3
    Train D 4

    Empirically it seems to work so are there any flaws in my logic?

    "Besides the noble art of getting things done, there is a nobler art of leaving things undone. The wisdom of life consists in the elimination of nonessentials." - Lin Yutang (10/10/1895 – 26/03/1976), Chinese writer, translator, linguist, philosopher and inventor.
    Last edited: 20/02/2015 at 00:36 by postal
    Log in to reply
    Unique IDs questions 20/02/2015 at 10:48 #69384
    Jan
    Avatar
    657 posts
    " said:
    "Note however that rule-chains in the style of “1A01 and 1A02 are alternatives”, “1A02 and 1A03 are alternatives” and “1A03 and 1A04 are alternatives” don't work, as there is no common train linking all of them together. "
    Although that wiki entry might need a bit of updating based on the information supplied by Clive.
    E.g. I never realised that "You can weight a train by making it appear first in more than one rule.", which actually means that the bit about all trains having an equal probability to run isn't correct if there are more than two trains, unless you're using wildcards.

    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
    Unique IDs questions 06/03/2015 at 16:22 #69845
    clive
    Avatar
    1951 posts
    " said:
    " said:
    " said:
    Or you can use the wildcard feature whose exact syntax I've forgotten and do it all with one rule.
    Doesn't work with UIDs, only TDs for the "are alternatives" rule. I queried this and was told it was something which has been specifically written into the core code.

    Syntax is "1A00??? are alternatives". One "?" for each character and all in the group must have the same number of characters.
    This is correct, thanks. I don't know why UIDs aren't allowed to have wildcards. Mantis 12518.
    UIDs will be allowed to have wildcards in Loader 4.4.

    Log in to reply
    The following user said thank you: postal
    Unique IDs questions 06/03/2015 at 18:49 #69846
    GeoffM
    Avatar
    4620 posts
    " said:
    I don't know why UIDs aren't allowed to have wildcards.
    For the benefit of everyone, the reason they weren't was because they would have been pointless had Network Rail UIDs been used since there is no pattern to UIDs beyond an initial letter being a sort of regional office code.

    However, it turns out that some people are not using NR UIDs but instead 2R02-X and 2R02-Y, for example, which does make wildcards in UIDs helpful, which is why it has now been implemented.

    However, if the real UID is available - and NR do publish this information these days - then please use them. There is some tolerance between chained sims if one sim's timetable has UIDs and the other doesn't - but not so much tolerance if both have UIDs which are completely different. After all, if sim 1 says to sim 2 "here's train 1A01 with UID G12345" and sim 2 has two 1A01s with UIDs of 1A01-1 and 1A01-2, what's it to do? There's only so much fuzzy logic matching that can be done.

    SimSig Boss
    Log in to reply
    Unique IDs questions 07/03/2015 at 10:24 #69869
    TimTamToe
    Avatar
    576 posts
    " said:


    However, it turns out that some people are not using NR UIDs but instead 2R02-X and 2R02-Y, for example, which does make wildcards in UIDs helpful, which is why it has now been implemented. However, if the real UID is available - and NR do publish this information these days....
    I think it's also because a lot of the timetables being written aren't for the current period and so when the tt writers compiled their data, a) UIDs weren't in SimSig so writers didn't know they needed that info and b) NR also weren't necessarily freely publishing them either depending on tt era.

    Log in to reply
    Unique IDs questions 07/03/2015 at 11:48 #69870
    58050
    Avatar
    2362 posts
    TimTamToe wrote:
    Quote:
    I think it's also because a lot of the timetables being written aren't for the current period and so when the tt writers compiled their data, a) UIDs weren't in SimSig so writers didn't know they needed that info and b) NR also weren't necessarily freely publishing them either depending on tt era.

    My sentiments exactly. I don't write timetables for the modern era. All of the timetables I'm currently working on for developers as well as myself are for the BR era & as a result the easiest format for UIDs for me is the TD of the train involved plus associated letters referring to the days of the week run or consecutive numbers or letters if there are more than 1 train with the same TD. The majority of Cl.2 trains in the 1970s & early 1980s had per-determined TDs referring to the route the trains were booked to run as laid down in the WTT. Therefore there wasn't any NR UIDs around during this period which means you have to invent your own.

    Log in to reply
    Unique IDs questions 07/03/2015 at 13:34 #69872
    postal
    Avatar
    3856 posts
    " said:
    " said:
    I don't know why UIDs aren't allowed to have wildcards.
    For the benefit of everyone, the reason they weren't was because they would have been pointless had Network Rail UIDs been used since there is no pattern to UIDs beyond an initial letter being a sort of regional office code.

    However, it turns out that some people are not using NR UIDs but instead 2R02-X and 2R02-Y, for example, which does make wildcards in UIDs helpful, which is why it has now been implemented.

    However, if the real UID is available - and NR do publish this information these days - then please use them. There is some tolerance between chained sims if one sim's timetable has UIDs and the other doesn't - but not so much tolerance if both have UIDs which are completely different. After all, if sim 1 says to sim 2 "here's train 1A01 with UID G12345" and sim 2 has two 1A01s with UIDs of 1A01-1 and 1A01-2, what's it to do? There's only so much fuzzy logic matching that can be done.
    I think you may be underestimating the diligence and attention to detail that goes into the creation of many of the TTs that use UIDs in a way that was not envisaged when the capability was added. I would certainly not wish to have my name linked to a TT which had not been thoroughly checked to make sure that it was totally compatible with other TTs to which it could be chained.

    "Besides the noble art of getting things done, there is a nobler art of leaving things undone. The wisdom of life consists in the elimination of nonessentials." - Lin Yutang (10/10/1895 – 26/03/1976), Chinese writer, translator, linguist, philosopher and inventor.
    Log in to reply
    Unique IDs questions 07/03/2015 at 13:36 #69873
    postal
    Avatar
    3856 posts
    " said:
    UIDs will be allowed to have wildcards in Loader 4.4.
    Clive

    To test understanding, if you have 3 trains 1A01-1, 1A01-2 and 1A02 which you want to have as alternatives with equal chance of entering, would a rule of the format 1A01?? and 1A02 are alternatives be appropriate?

    "Besides the noble art of getting things done, there is a nobler art of leaving things undone. The wisdom of life consists in the elimination of nonessentials." - Lin Yutang (10/10/1895 – 26/03/1976), Chinese writer, translator, linguist, philosopher and inventor.
    Log in to reply
    Unique IDs questions 07/03/2015 at 17:01 #69878
    GeoffM
    Avatar
    4620 posts
    " said:
    " said:
    " said:
    I don't know why UIDs aren't allowed to have wildcards.
    For the benefit of everyone, the reason they weren't was because they would have been pointless had Network Rail UIDs been used since there is no pattern to UIDs beyond an initial letter being a sort of regional office code.

    However, it turns out that some people are not using NR UIDs but instead 2R02-X and 2R02-Y, for example, which does make wildcards in UIDs helpful, which is why it has now been implemented.

    However, if the real UID is available - and NR do publish this information these days - then please use them. There is some tolerance between chained sims if one sim's timetable has UIDs and the other doesn't - but not so much tolerance if both have UIDs which are completely different. After all, if sim 1 says to sim 2 "here's train 1A01 with UID G12345" and sim 2 has two 1A01s with UIDs of 1A01-1 and 1A01-2, what's it to do? There's only so much fuzzy logic matching that can be done.
    I think you may be underestimating the diligence and attention to detail that goes into the creation of many of the TTs that use UIDs in a way that was not envisaged when the capability was added. I would certainly not wish to have my name linked to a TT which had not been thoroughly checked to make sure that it was totally compatible with other TTs to which it could be chained.
    Did you reply to the wrong post? I asked that UIDs be used if available and you've replied about underestimating the work which - to me - are completely unrelated issues.

    SimSig Boss
    Log in to reply
    Unique IDs questions 07/03/2015 at 17:57 #69880
    postal
    Avatar
    3856 posts
    " said:
    Did you reply to the wrong post? I asked that UIDs be used if available and you've replied about underestimating the work which - to me - are completely unrelated issues.
    I was responding to the comment "There is some tolerance between chained sims if one sim's timetable has UIDs and the other doesn't - but not so much tolerance if both have UIDs which are completely different. After all, if sim 1 says to sim 2 "here's train 1A01 with UID G12345" and sim 2 has two 1A01s with UIDs of 1A01-1 and 1A01-2, what's it to do? There's only so much fuzzy logic matching that can be done."

    Certainly for any TT where I have been involved in the testing and editing, I would be disappointed if a situation such as you postulate occurred.

    "Besides the noble art of getting things done, there is a nobler art of leaving things undone. The wisdom of life consists in the elimination of nonessentials." - Lin Yutang (10/10/1895 – 26/03/1976), Chinese writer, translator, linguist, philosopher and inventor.
    Log in to reply
    Unique IDs questions 07/03/2015 at 18:43 #69881
    GeoffM
    Avatar
    4620 posts
    " said:
    " said:
    Did you reply to the wrong post? I asked that UIDs be used if available and you've replied about underestimating the work which - to me - are completely unrelated issues.
    I was responding to the comment "There is some tolerance between chained sims if one sim's timetable has UIDs and the other doesn't - but not so much tolerance if both have UIDs which are completely different. After all, if sim 1 says to sim 2 "here's train 1A01 with UID G12345" and sim 2 has two 1A01s with UIDs of 1A01-1 and 1A01-2, what's it to do? There's only so much fuzzy logic matching that can be done."

    Certainly for any TT where I have been involved in the testing and editing, I would be disappointed if a situation such as you postulate occurred.
    That still doesn't explain why I'm being accused of underestimating the work involved. Two people can work equally efficiently and productively on adjacent areas and both can be perfectly correct. But if one author used, for example, numerical suffixes and the other alphabetical suffixes then we have a compatibility problem. I am speaking from experience where this has already happened, and a compromise had to be made to ensure the TTs were compatible across the sims before release.

    SimSig Boss
    Log in to reply
    Unique IDs questions 07/03/2015 at 19:14 #69883
    Danny252
    Avatar
    1461 posts
    Even if they both used the same form of suffix (alphabetical or numerical), surely they still would've had to change a large proportion simply as they wouldn't have the same suffix? If a train leaves Sim A as 1C01-3, the chances of it also being 1C01-3 on Sim B seem low.
    Last edited: 07/03/2015 at 19:15 by Danny252
    Log in to reply
    Unique IDs questions 07/03/2015 at 20:49 #69887
    clive
    Avatar
    1951 posts
    " said:
    " said:
    UIDs will be allowed to have wildcards in Loader 4.4.
    Clive

    To test understanding, if you have 3 trains 1A01-1, 1A01-2 and 1A02 which you want to have as alternatives with equal chance of entering, would a rule of the format 1A01?? and 1A02 are alternatives be appropriate?
    Correct (assuming there are no other 1A01 trains). In fact, 1A01-? would also do.

    If you have 3 trains 1A01-1, 1A01-2, and 1B23 with UID $ABCDE, then the rule could be 1A01-? and $ABCDE are alternatives.

    In Loader 4.4, if you have 3 trains 1A01, 1B23, and 1C98, you can give them UIDs $ABC-1, $ABC-2, and $ABC-3 and make the rule "$ABC-? are alternatives".

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