Railway routing between sets of platforms

To get more sensible routes in and out of termini and large stations, and also to support multiple gauges, I need to calculate a set of candidate platforms, i.e the closest vertex on each way within a given radius or box, and then ask what’s the best way to get between each set of candidates.
I can work out the sub-stations, can the “problem solver” do the job of calculating the best route given sets of sub-stations/platforms ?

You want the one best route between N start locations and M destinations? You can initialize Dijkstra with many sources with weight==0 and loop until you find the first node of the M destinations.

I have N sets of points. S1 , S2,… SN
I want to find the best route between any point in S1, to any in S2, to any in S3 … to any in SN
The shortest between S1 and S2 may result in a point in S2 which is not then optimal for S3, e.g. we shunt out of the station and back again because we mistakenly drove into the terminus at Munich instead of using the through platforms.

In most cases we wont have a contradiction, or we have just two options, e.g. an up line and a down line.
I can work out the best initial choice between each Set, then if we have a contradiction, iterate through all the other options. It could potentially fail obviously if we have consecutive contradictions (different points being chosen for in and then out of the station) but it will fix the Munich case example.
Note that this is for offline processing, not on demand, I am just trying to render maps based on timetables, so it can hurt a little. Graphhopper is so blindingly fast and this is only for fixed rail stuff. For buses, i.e. roads, this isn’t an issue.