The Trolley Problem is a thought experiment in the field of ethics. The hypothetical scenario says that there is a runaway trolley barrelling down the railway tracks. Ahead on the tracks, there are five people tied up and unable to move. The trolley is headed straight for them. You, the decision-maker in the story, are standing some distance off in the train yard, next to a lever. If you pull the lever, the trolley will switch to a different set of tracks on which one person tied up. There is a never-ending dilemma over which is the most ethical thing to do: nothing, and the trolley kills the five people on the main track. Or, pull the lever, diverting the trolley onto the side track where it will kill one person.

The runaway trolley is often invoked in conversations around autonomous vehicles (AVs). And since the Trolley Problem is ultimately a question of ethics and choice, a group of philosophers from University of Massachusetts (UMass) Lowell  are working to code such ethical theories into a language that can be read by computers.

Their project is supported by a $556,000 grant from the National Science Foundation, allowing them to create various Trolley Problem scenarios, and show how an AV would respond according to the ethical theory it follows.

“It’s not just about how many people die but which people die or whose lives are saved,” says Nicholas Evans, a philosophy professor at UMass Lowell, who is working with two other philosophers and an engineer to write the theory-based algorithms. “The difference between theory A and theory B is that the people who die in the first theory are mostly over 50 and the people who die in the second theory are mostly under 30. Then we have to have a discussion as a society about not just how much risk we’re willing to take but who we’re willing to expose to risk.”

While he is neither taking sides yet nor collaborating with automobile companies, after their work is done, Evans looks forward to working with manufacturers to see how their results can be applied to deal with real life Trolley Problem situations.

Ethics in AVs have long been debated and discussed. In a 2015 study conducted by MIT, researchers concluded six online surveys of 1,928 people between June and November, questioning participants about the moral behavior of AVs. When asked whether AVs should swerve to avoid hitting a group of pedestrians – even if swerving would result in the death of the car’s occupant – respondents mostly said that the greater good was more important than the life of the individual. However, none of the respondents wanted to be in the car at the time that the choice was made, making for a difficult moral quandary. When respondents were asked a number of the question, in which a family member or child was in the car, they still replied that they would want the car to save the most number of people – but again, not if they or their child was in the car.