Shortest Path Binary Formulation¶
Definition¶
A shortest path binary formulation assigns if a directed edge is selected. For the undirected course network, create both directed orientations of each edge. With origin , destination , and edge lengths , use
Sums include only existing directed orientations.
Interpretation¶
The formulation writes the shortest path problem as a binary integer program. Each variable says whether the route uses edge , and the balance equations force the selected edges to carry one unit from origin to destination; the objective then picks the cheapest such route.
The selected edges have and the grey edges have . At the origin one selected edge leaves and none enters (out in ), at the destination one enters and none leaves (), and at an intermediate vertex such as one enters and one leaves ().
Each undirected edge becomes two directed edges because the route may use it in either direction. The balance equations do not by themselves rule out a closed loop of selected edges, since such a loop also has out in at each of its vertices. With strictly positive lengths a loop only adds cost, so an optimal solution contains none; with zero-length edges an optimal solution may contain one, and removing it leaves a shortest path of the same cost.
The shortest path algorithm solves the same problem directly; the formulation is useful because, as an ordinary integer program, it accepts further constraints. The same balance equations reappear in the project longest path model, with the objective maximized, and at the intermediate vertices they are the flow-conservation constraints of the maximum flow LP.
Key Results¶
- With strictly positive lengths as in the exercise, an optimum contains no unnecessary cycle.
- If zero-cost edges are allowed, an optimal binary solution may contain removable zero-cost cycles.
- The balances alone must not be claimed to prohibit every possible cycle.
Examples¶
For a feasible network with nonnegative edge lengths, the unit-flow LP relaxation admits an integral optimal solution. Removing any zero-cost cycles leaves a shortest path; arbitrary optimal flow representations need not themselves be cycle-free.
- In the course exercise network (not the figure), the route selects its five directed edges and has cost 12.
- At on that route, balances one incoming and one outgoing edge.
Prerequisites¶
Related Concepts¶
Sources¶
- OR Modelling · Week 5
Symbols: element of, sum
Last updated: 20 October 2026 03:02
Shortest Path Binary FormulationProject Longest Path ModelShortest Path ProblemBinary Integer ProgramMaximum Flow Linear Program