For this model, I chose to use Utilitarianism. I primarily chose this framework due to it prioritising the greatest good for the greatest amount of people. This means that the model will heavily prioritise saftey of the people in the towns over the saftey of the driver. As a result of this, the model is more likely to chose a route that is longer but safer over a route that is shorter and more dangerous.
Furthermore, as this framework is a form of consequentialism, it is the only model that is able to partially predict the outcome of a route. This is because the model is able to weight the outcome of a route based on the danger it will incur. When compared to the other proposed ethical frameworks, utilitarianism is the only framework that is able to be applied algorithmically, making it the only suibtable framework for this project.
Flowchart of the algorithm
The algorithm is very simple. It takes a prepared graph and the start and end node. From the start node, it will traverse each edge and multiply the weight of that edge by the saftey of that weight. This is done to encourage the algorithm to take safer routes as opposed to shorter routes, because longer but safer routes are more likely to have a lower total score than shorter but more dangerous routes. The algoroithm will then add each of the total scores and the distance from the next edge to encourage the algorithm to only take routes that are relavant to it Finally the algorithm will check to see if the new node is the end node and repeat if not. As a result, this algorithm is highly scalable and can be used on any size graph in a time efficient manner.
Importantly, distance is not a factor in this algorithm. This is because overall distance will become a constant rather than a variable as the distances will all be relative to each other. To counter this, the algorithm Instead takes the time it would take to travel an edge as a factor. This is because the time it takes to travel an edge will depend on the length, speed limit, traffic flow and traffic light timings. As a result, the algorithm requires less preperation and is more scalable. This algorithm heavily relies on the utilitarianism ethical framework, as explained to the left due to it's priorities, saftey over speed. This is because the algorithm will prioritise the saftey of the people in the towns over the drivers time.
Because of the nature of the algorithm, it can only take in a graph that is both directionalised and weighted. As we've already established, each edge takes it's weight from the saftey of the road, rather than the length of it. This means the, although the graph is directionalised, it does not need to include the length of each edge in it's preperation as this can be calculated at runtime. Overall, this leads to less preperation of each graph leading to a more efficient process. Below is an example of what some graphs may look like after they have been prepared
A weighted graph of Portsmouth
A route across town A. The route follows the red line. This is the most optimal route across this town according to the algorithm. This is due to the multiplication of the saftey weighting. The hot pink line gives a weighting of (8 * 2) + (7*2) = 30 (assuming each road takes 2 minutes), wheras the red line gives a total of (7 * 2) + (4 * 2) = 22 .The green line gives (22 * 2) + (4 * 2) = 52 as it is the most dangerous route. The red line is therefore the most optimal as it keeps the most people safe whilst keeping the driver happy.
A route across town B. This time, the hot pink line represents the most optimal route. Assuming a weighting of 2 minutes per road, the red line has a weighting of (8 * 2) + (5 * 2) = 26 and the green line has a weighting of (1*2) + (2*2) + (20*2) + (5*2) = 60, wheras the hot pink line has a weighting of (5*2) + (2*2) + (2*6) = 24.