UNIHIVE

Study Hub UNIPORT ENG 401

ENG 401 · Engineering Mathematics VI (Mathematical Modelling and Operation Research)

Dynamic programming and shortest routes

Breaking decisions into stages, Bellman's principle, and finding shortest paths.

Our notes

2 min read

Dynamic programming (DP)

Solves problems that can be split into stages, each with a decision, linked by states.

Bellman's principle of optimality: an optimal policy has the property that, whatever the first decision, the remaining decisions form an optimal policy for the state that results.

The method

  1. Define stages, states and decisions.
  2. Write the recursive relation: f(state) = best over decisions of [cost of decision + f(next state)].
  3. Solve backward (or forward) from a known end.

Routing: the shortest path problem

Find the least-cost route through a network: pipelines, roads, cables.

Worked example

A pipeline route from node 1 to node 6 (lengths in km):

LinkLength
1-27
1-33
3-22
2-42
3-46
3-59
4-51
4-65
5-62

Dijkstra's algorithm (forward, permanent labels):

  1. Node 1: 0.
  2. From 1: node 2 = 7, node 3 = 3. Smallest: 3 (3).
  3. From 3: node 2 = min(7, 3 + 2) = 5; node 4 = 9; node 5 = 12. Smallest: 2 (5).
  4. From 2: node 4 = min(9, 5 + 2) = 7. Smallest: 4 (7).
  5. From 4: node 5 = min(12, 7 + 1) = 8; node 6 = 12. Smallest: 5 (8).
  6. From 5: node 6 = min(12, 8 + 2) = 10.

Shortest route: 1 → 3 → 2 → 4 → 5 → 6 = 10 km.

Check with backward DP: f(6) = 0; f(5) = 2; f(4) = min(5 + 0, 1 + 2) = 3; f(2) = 2 + 3 = 5; f(3) = min(2 + 5, 6 + 3, 9 + 2) = 7; f(1) = min(7 + 5, 3 + 7) = 10. Same answer.

Other network problems

ProblemFindsMethod
Minimum spanning treeCheapest way to connect all nodes (a cable network)Kruskal's or Prim's algorithm
Maximum flowMost flow from source to sink (water, gas)Ford-Fulkerson
Travelling salesmanShortest tour visiting every node once (a maintenance round)Heuristics, branch and bound

DP for resource allocation

Allocating a budget among projects stage by stage: each stage is a project, the state is the money left, and the recursion picks the best amount for each. DP also handles equipment replacement and production planning over time.

Sequencing

Ordering jobs on machines. For n jobs on two machines in the same order, Johnson's rule minimises the total time: list the shortest times; if on machine 1, schedule that job as early as possible; if on machine 2, as late as possible; repeat.

Exams usually ask

  • Find a shortest route by Dijkstra's method or DP.
  • State Bellman's principle of optimality.

Common mistake

Picking the cheapest link at each step (greedy) without keeping the running totals. Dijkstra compares total distances, not single links.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All ENG 401 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.