# Shortest path resolution with Excel

Contenus

## Formulate the shortest path problem with Excel

To formulate this problem of shortest way with Excel, let's answer the following three questions.

• What are the decisions to be made? For this problem, we need Excel to find out if an arc is on the shortest path or not (Yes = 1, No = 0). For example, if SB is part of the shortest path, cell F5 is equal to 1. Otherwise, cell F5 is equal to 0. (in yellow)
• What are the constraints on these decisions? The net flow (Outbound - Inbound) of each node must equal the supply - demand at that node. Node S should only have one outgoing arc (net flow = 1). Node T must have only one incoming arc (net flow = -1). All other nodes must have an outgoing arc and an incoming arc if the node is on the shortest path (net flow = 0) or without flow (net flow = 0). (in light blue)
• What is the overall measure of performance for these decisions? The overall measure of performance is the total distance of the shortest path, so the goal is to minimize this amount. (in dark blue)

Let's name the following ranges:

And let's insert the following functions:

## Solve the model

Let’s enter the solver parameters:

The optimal solution is: FR FR EN RU ES