Over 1.2 million people are transported every day on the Swiss railway network in over 10'000 trains with world-leading punctuality.

But traffic is expected to increase even further. As more trains are added, the scheduling complexity quickly explodes.

Your goal is to come up with ingenious ways to tackle this problem. Can you find a suitable algorithm? A powerful heuristic? A promising AI-approach?

Let’s get started!

You are given nine problems of increasing complexity describing a railway system, a list of trains and functional requirements. You need to come up with a viable schedule for each of them.

You can find the full documentation in the Starter Kit here. There’s a lot of information in there, but don’t get intimidated! We will start with an intuitive explanation of the problem, expose the requirements, and show how to submit a first simple submission.

By the end of this article you’ll be getting your first graded results

Trains & Rails

Each problem comes with 4 inputs:

a railway system,

a list of trains that run on it,

timing constraints, eg “this train needs to reach this place by this time”,

resource constraints, eg “only one of these sections can be used at the same time”.

Your goal is to find a schedule for all of the trains that will comply with all of the constraints. In some case it will be easy, in others it may be impossible.

Isn’t this backward? It may be surprising to try to schedule trains while already having timing constraints. This is because we are considering cases where we want to make small modifications to a pre-existing schedule. For example if a major football match starts at 20:00, it would make sense to modify the usual schedule to have a train arrive close to the stadium no later than 19:00. Similarly, the departure of the train that brings the spectators back should have an earliest departure of maybe 22:30.

The Railway Network

The network is modelled as a graph, in the graph theory sense of the word.

It is made of routes, themselves consisting of route sections. Each section is represented as an edge of the graph.

Our example railway network

We assume that each section can only be crossed in a single direction. We also assume that there are no loops in the network. As such, the resulting graph is a directed acyclic graph (DAG).

Requirements

Trains are subject to different kind of timing requirements:

Earliest/latest arrival time, earliest/latest departure time and minimum stopping time, which allow passengers to get in and out of the train.

Connections to other trains, meaning that two trains must coordinate so passengers can pass from one to the other.

A Simple Scenario

Let’s take a look at a sample problem: sample_scenario.json .

It contains two service intentions, which is a fancy name for “train including all its requirements”: