There is a correct solution to the trolley problem.
It is this: you design the system with positive train control. You make it so the trolley cannot enter a section where there are people, and you make it so the trolley can be stopped quickly if something goes wrong.
I've been told that this is cheating, a cop-out, or avoiding the "interesting" aspects of the question. I don't think it is. Framing the world as a series of individual can't-win situations and lose-lose decisions _is_ the problem.
Don't do that.
