Upcoming Games

No games to display

Full list
Add a game

Upcoming Events

No events to display

Who's Online

Alternatives and Seeds

You are here: Home > Forum > General > Timetabling > Alternatives and Seeds

Page 2 of 2

Alternatives and Seeds 31/12/2013 at 23:10 #53511
clive
Avatar
2738 posts
I wrote:

" said:

(4) "1A2? are alternatives" or "1B2? and 1C45 are alternatives" (in the first case the second train is blank, in the second case it isn't). Again, either ID can use ? as a wildcard. These rules affect both trains about to enter (after the first three kinds of rules have been checked) *AND* trains about to be seeded. The process for these is a bit more complicated.

...
I've just spotted that some text somehow got left out. Here is what it should have said.

Suppose train T is about to enter or to be seeded. The core code first makes a list of all the "are alternatives" rules that match train T. These are the "relevant rules". It then goes through the entire list of trains that haven't yet entered or been cancelled and builds up a list of potential alternative trains. For each train A that hasn't yet entered or been cancelled, the code first checks to see if A matches the first ID of a relevant rule; if it does, it's added to the list. If it matches more than one relevant rule, it gets added more than once. (So if there are relevant rules "1A2? are alternatives" and "1A?3 are alternatives", then 1A23 will be added to the list twice.) If the train doesn't match any first ID, but does match the second ID of any relevant rule, it is added to the list once, no matter how many second IDs it matches. Of course, since train T matches every relevant rule, it will appear on the list.

When this list has been built, a train is chosen at random from it - that train will enter or be seeded, and *ALL* the other trains on the list will be cancelled (including train T if that isn't the one chosen). If a train is on the list twice, it therefore has twice the chance of being chosen, and so on.

So if you have trains 1A23-M, 1A23-T, 1A23-W, 1A23-H, 1A23-F, 1A23-S, 1A23-U (for Monday to Sunday), then you can have exactly one chosen at random by having a rule "1A23-? are alternatives". If you want weekends to occur twice as often as weekdays, you can add two more rules "1A23-S are alternatives" and "1A23-U are alternatives".

Log in to reply
Alternatives and Seeds 23/01/2014 at 14:12 #54147
postal
Avatar
5190 posts
" said:
1. Set up the day-of-the-week seeds using a single group of TDs e.g. 0A00MON, 0A00TUE etc rather than 0A00, 1A01,2A02 etc.). The seeds must also have the same number of characters (so 0A00MO, 0A00TO . . . . 0A00THO would not work). The code appears to read the TDs of seed trains in alphanumeric order so 0A00 is read before 0B00 or 1A00. The day-of-the-week seeds must be read before any seed trains which are ruled to be dependent on them so if you require to seed 1A00 only on Monday, the day-of-the-week seeds must be earlier than 1A00 in an alphanumeric list. If you are not sure whether you have got the alphanumeric listing right, go into the TT and look at the list of trains sorted by Identity.
2. Set up a rule that "0A00??? are alternatives". The ? is a wild-card character so you need one ? for each of the differentiated characters in the TD. The "are alternatives" rule treats all trains in the list equally so you do not need the 20/25/33/50%ages checked.
3. Seed the other trains at the appropriate locations and add rules that they must not run if such-and-such a seed train runs (or for trains entering only on 1 day of the week rule that they must enter 0 mins after the relevant day-of-the-week seed enters).
4. Save the TT, re-start the sim and hopefully everything will appear (or not) as expected.
One loophole in the process. In certain circumstances, if you have a seed train only entering on one day of the week and have set a rule for it to enter 0 minutes after the day seed has entered then the rule is being ignored and the train is entering on other days of the week.

To avoid this, you need to delete the 0 minutes after rule and add 4 rules that the one-day-of-the-week train must not enter if each of the other 4 day seeds enter.

“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