Shortest Path: LP Formulation
Formulate the shortest path problem on a directed graph as a linear program: set up the decision variables and objective, write the per-node flow conservation constraints, and express the LP in compact matrix form using the node-arc incidence matrix.
Tutorial
Decision Variables and Objective
Given a directed graph with a cost on each arc the shortest path problem asks for a minimum-cost path from a source node to a sink node
We model this as a linear program by sending one unit of flow from to For each arc introduce a decision variable
representing the amount of flow on arc The total cost of the flow is
and this is the quantity we minimize.
For example, consider a network with nodes and arcs with costs Taking and the objective is
This objective alone is not enough. Without constraints, gives cost at zero flow. We need constraints that force one unit of flow to travel from to Those come next.