Nicolas Dulex
17 November 2026 · Agents · Simulation · Open data Draft preview

I gave an AI Switzerland's trains

One frontier model as the manager, a team of cheap workers, and an open railway simulation that barely ran. Three days later, every train arrived.

Olten · same hour, both runs
Before7 of 612 trains arrive
0 waiting
After612 of 612 trains arrive
0 waiting
MovingStation stopWaiting
Recorded train positions around Olten from 23:00 to 24:00, before and after the repairs. One hour plays in 15 seconds; train symbols are enlarged. Data: matsim-switzerland-railway ↗, CC BY 4.0.
01 / Project

Why I did this

On Tuesday 10 November, Anthropic released Fable 5.2. I wanted to test two things with it. First: how good is it at a hard, messy, real problem? Second: how good is it as a manager? Could it direct a team of much cheaper models, in this case DeepSeek V4.1 Flash, and get real work out of them?

I needed a problem that was hard, open and measurable. I found one in an open-source railway simulation of Switzerland.

02 / Project

The problem: the timetable doesn't say which track

The scenario is a public project that simulates the Swiss railway network with MATSim and railsim, a train simulation made for MATSim. It is built entirely from open data: the tracks come from OpenStreetMap and the timetable from GTFS, the open timetable format.

The catch: a timetable tells you when a train is at each station. It doesn't tell you which physical track it uses in between. The conversion tool guesses a path for every train, and many of those guesses are wrong: trains on the wrong side of a double track, two trains on the same platform, head-on meetings on single track. In the simulation, trains block each other and stay blocked.

The guess · both trains on the same trackPlatformStuckThe router · each train on its own sidePlatform
Illustration The timetable gives times, not tracks. If the conversion sends two trains onto the same track, they meet and neither can move. The router keeps each train on its own side of the line.

In the Olten case, only 7 of 612 trains reached their destination. The national case crashed around six in the morning.

My brief to Fable was short: make all the trains arrive, with as little delay as possible, and as close to reality as possible. And a few hard rules: don't delete or retime trains, the timetable is the truth, and don't invent tracks or give a track unlimited capacity. A real timetable works in reality, so in theory every train can arrive on time.

03 / Project

The setup: one manager, a team of workers

Fable was only the orchestrator. It planned the work, wrote a task for each worker, and decided what to do with the results. The workers were DeepSeek V4.1 Flash sessions, running on a $10-a-month OpenCode Go subscription, all in T3 Code on an old Mac I use as a home server.

The first half hour showed what that looks like. Within 30 minutes of my brief, Fable had sent out 25 tasks: research on how railsim handles deadlocks, how Swiss tracks are tagged in OpenStreetMap, which side Swiss trains run on, realistic acceleration for Swiss rolling stock, what open data says about platforms. The workers came back with notes and sources, and Fable turned them into the next round: build a track router, write a deadlock check, test it on Olten, find the hotspots in Bern, Lucerne and Zurich.

Fable 5.2OrchestratorDeepSeek V4.1 Flash workersTasks done104Round 1Round 2Round 3
Illustration Fable hands out tasks (yellow) and reads the reports (turquoise). The counter follows the three rounds: 56, 20 and 28 completed tasks.

Over three days, that came to 104 completed tasks, in three rounds.

04 / Project

Where I had to step in

The AI did the investigating and the building. But the turns that mattered most came from knowing how real trains work.

Speeds. Early on, the trains ran at speeds like a flat 100 km/h, which looked wrong to me. I asked Fable to check the Swiss standards. Later, some legs still couldn't be driven in the published time, and with a real timetable that means something in the model is wrong, so I sent it back to check the track and train speeds.

Driving just in time. railsim drives every train at full speed and then waits at the next station. Real drivers don't. I asked for trains that drive to arrive just in time. The team built a "punctual" driving profile: each train picks the cruising speed that gets it to the next station at the published time.

Default · full speed, then waitStation AStation BPunctual · arrive at the published timeStation AStation BDeparturePublished arrival
Illustration Not recorded data. The default profile arrives early and waits at the platform; the punctual profile picks the cruising speed that reaches the next station on time.

On time means on time. Measuring delay isn't enough: a train that arrives two minutes early isn't on time either, and one that leaves early is a problem for passengers. So I made the rule explicit: "being on time means being on time. Not early and not late." That changed what the team measured and optimised for.

A fresh pair of eyes. When I shared the results, a colleague who knows these simulations noticed two trains lying on top of each other at Olten. They weren't really there twice: railsim never announces that a finished train has left the network, so viewers keep drawing every finished train where it stopped. That gap has been in railsim since 2023. Nobody had noticed, because in the old runs almost no train ever finished. It became visible only once every train arrived, and it led to a fix in railsim itself.

Fresh conversations. As the conversation between Fable and its workers grew, it sent more and more context with every turn and burned through my limit very fast. Starting a new conversation gave better results. The project ran as three main conversations, one per round.

05 / Project

What came out

In the end, all 612 trains in the Olten case and all 2,541 long-distance trains in the national case reach their final stop. Of the 18,702 national arrivals, 98.5% are within 30 seconds of the timetable and 87% within one second. No train leaves before its published departure.

Explore · the national run

Every long-distance train, one day

All 2,541 trains of the final national run. Press play, zoom into a station, or tap a train to see its stops.

Trains that finish2,541 / 2,541
Arrivals within 30 s98.5%
Arrivals within 1 s87.0%
Early departures0
National replay · about 7 MB

The whole country, every train, one day.

About 7 MB
00:0012:0024:00
MovingAt a stationWaitingTrack not modelled in detail
Tap a train on the mapIts route, and its published and simulated arrival at every stop, appear here.
Wheel or pinch to zoom, drag to move. Recorded positions from the final national run, every five seconds, drawn within 3 m; train symbols are enlarged. Dashed lines are stretches the model doesn't detail. Data: matsim-switzerland-railway ↗, CC BY 4.0.

What changed to get there:

  • A track router. Every train gets a drivable path, on the right side of the line, onto a real platform, with legal turns.
  • The timetable, restored. The original conversion had erased the time trains spend standing at stations. That time is back, and a check stops the pipeline if the timetable changes in any way.
  • Fixes in the simulation engine. Trains now release tracks they no longer hold, and several bugs in how a train moves from one piece of track to the next are fixed.
  • Smarter dispatching. A train only locks the stretch of single track it really needs, so trains can meet and pass at stations instead of blocking each other.
  • Punctual driving, as above.
  • A few local repairs, each written down: five real passing loops that were missing from the model, a long tunnel split into sections so trains can follow each other through it, and stopping positions moved so long trains fit on their platform.

And it stays honest about its limits. This is a model, not the real railway. There is no switch-by-switch signalling, some platforms are too short, and about a third of national trains use stretches of track that aren't modelled in detail. The before and after also differ in more than one way, so this isn't a clean benchmark.

06 / Project

What I learned

A frontier model can manage. Fable planned, split the work, checked results and changed course, over three days and 104 tasks. Most of the work was done by a model that costs a fraction of the price.

Cheap workers are not free. DeepSeek's workers processed about 3.7 billion tokens, mostly re-reading the same context, against about 115 million for Fable. And long conversations get expensive for the orchestrator too.

Domain knowledge steers. The AI found the bugs. Knowing what a real train does is what told it which results were wrong.

Working is not the same as right. A simulation where every train arrives can still have trains arriving early or overlapping. You need checks, and people who look.

The result is ordinary software. Once the decisions were made, they became code, rules and correction files. You can rerun the cases without any AI in the loop.

07 / Project

What's next

Everything I changed is now organised into pull requests: six for the Swiss scenario and seven for railsim itself. They're now open for the maintainers to review. They may accept them, change them or decline them; that's how open source works.

Read the code:

08 / Project

Sources and method

  • Scenario: matsim-switzerland-railway ↗ by Merlin Unterfinger, Thomas Hettinger and Ihab Kaddoura. Scenario code AGPL-3.0; simulation data and visualisations CC BY 4.0.
  • Data: Swiss GTFS timetable snapshot of March 2024 (opentransportdata.swiss) and OpenStreetMap railway data. Long-distance trains only (IC, IR, EC, RE, ICE), one service day; the run is extended to 36 hours so late trains can finish.
  • Results come from the final runs' scoring files. First stops aren't scored, since there is no arrival to judge: 21,243 scheduled stops − 2,541 starts = 18,702 judged arrivals.
  • Team figures come from the local T3 Code records for the three main conversations and every task they delegated, 10–13 November 2026. Tokens are reported usage, including cached context, not a bill. 104 tasks are completed task records, not 104 agents running at once. Some later turns used Opus 5.5.
  • This is a personal AI experiment, not an operational assessment by any railway.
← Back to all projects