Dynamic Programming: Stages, States and Shortest or Longest Routes | Edexcel A Level Further Maths notes

Free preview: Dynamic Programming: Stages, States and Shortest or Longest Routes

Big Decisions as a Chain of Small Ones

Year 2 (A level): this is on Edexcel's A level Decision Mathematics 2 paper (9FM0/4D). Check your own specification if you are unsure when it is taught.

Let's start with a journey from S to T through a network. Every route passes through one of A, B, C and then one of D, E, F. We want the shortest route, and we will find it by working backwards from T.

  • Why backwards? Think about planning a road trip. If you already know the quickest way home from every town on the last leg, choosing the leg before is easy: just add on.
  • Working forwards is risky: the cheapest first road might lead somewhere that is expensive to leave.

A staged network: S joins A (4), B (6) and C (4); A joins D (7) and E (5); B joins D (3), E (4) and F (7); C joins E (8) and F (9); D, E and F join T with weights 6, 7 and 3. The route S-B-D-T is highlighted, total 15

Following the diagram

  • The vertices are in columns. Each column is a stage: stage 1 is the last step into T, stage 2 the step before, and stage 3 the first step out of S.
  • The vertex you are at is the state. At stage 2 the states are A, B and C.
  • The arc you choose next is the action. From B the actions are BD, BE and BF.
  • The number on each arc is its length (say kilometres).
  • The thick route S-B-D-T is the shortest: 6 + 3 + 6 = 15. We will show why.

What dynamic programming does

  • Dynamic programming breaks a big decision into a chain of small ones, one per stage.
  • We record, for every state, the best value from there to the end. Then we step back one stage and reuse those answers.
  • Each small decision only compares a few arcs, however big the network.

💡 Bellman's principle

Any part of an optimal path, from some state to the end, is itself optimal. So the best route from S must use the best route from whichever vertex it goes to next.

  • That is why working backwards works: once we know the best route from D, E and F, the best route from A only needs one comparison per arc.
  • In everyday words: if the best trip from London to Edinburgh passes through York, then its York-to-Edinburgh part must be the best York-to-Edinburgh trip. Otherwise you could swap in the better one.

✏️ YOUR TURN 1

Try this first:

A network has arcs S to A (3), S to B (5), A to C (4), A to D (6), B to C (2), B to D (3), C to T (7) and D to T (4). Label the stages, and list the states and actions at each stage.

Answer:

  • Stage 1 (last step into T): states C and D; actions CT, DT.
  • Stage 2: states A and B; actions AC, AD from A and BC, BD from B.
  • Stage 3: state S; actions SA, SB.

Working Backwards in a Table

The recipe: the stage and state table

  1. Label the stages, starting with stage 1 next to the end.
  2. Stage 1: for each state, the value is just the arc into T.
  3. Each earlier stage: for each state and each action, value = arc length + best value of the state it leads to. Why: Bellman says the rest of the route should be the best from there.
  4. Mark the best value for each state (the minimum for shortest routes).
  5. Read the route forwards from S, following the best action at each state.

The table has five columns.

StageStateActionValueBest value
1DDT66
EET77
FFT33
2AAD7 + 6 = 13
AE5 + 7 = 1212
BBD3 + 6 = 99
BE4 + 7 = 11
BF7 + 3 = 10
CCE8 + 7 = 15
CF9 + 3 = 1212
3SSA4 + 12 = 16
SB6 + 9 = 1515
SC4 + 12 = 16

Unlock the full note: start 7 days free.

Log in or subscribe to read the rest of this note. Members also get the AI tutor, practice quizzes, mock exams and flashcards for this topic.

Log in · Subscribe · Start free trial

All notes in Dynamic Programming

  1. Dynamic Programming: Stages, States and Shortest or Longest Routes
  2. Dynamic Programming: Minimax, Maximin and Production Planning

What's inside for this topic

2 teacher notes, 61 practice questions, 41 flashcards, 2 quizzes.

Get the full notes, every practice question, flashcards, quizzes and mock papers.

Start your free 7-day trial

Questions? Chat with us on WhatsApp · Try one live lesson

Next note: Dynamic Programming: Minimax, Maximin and Production Planning

All Edexcel A Level Further Maths topics · A Level Further Maths