Dynamic Programming

Your progress
0 of 26 done
Ticks are kept only in this browser: clearing your browsing data or changing device loses them. · ·

Edexcel

Edexcel · Old spec

A2 June 2025 Q5

EdexcelCurrent spec13 marksDynamic Programming

5. Anvi makes boats during the winter months. She can make up to five boats each month.

If she builds more than three boats in any one month, she must hire an assistant at a cost of £400 for that month.

In any month in which boats are made, the overhead costs are £60 for each boat made that month.

A maximum of three boats can be held in storage at the end of each month, at a cost of £70 per boat per month.

Boats must be delivered at the end of each month.

The order schedule for boats is

MonthNovemberDecemberJanuaryFebruaryMarch
Number ordered25643

There are no boats in storage at the beginning of November.
Anvi plans to have no boats left in storage after the end of the March delivery.

(a) Use dynamic programming to determine the production schedule that minimises the costs given above. Complete the working in the table provided in the answer book and state the minimum cost. (12)

[The table in the answer book begins as follows.]

StageStateActionDestinationValue
March300210 = 210*
210140 + 60 = 200*
12070 + 120 = 190*
030180 = 180*

The assistant asks to work in November, and Anvi agrees.

(b) Given that more than three boats are now made in November, state the minimum additional cost of producing all the required boats to the schedule shown above. (1)

A2 June 2024 Q6

EdexcelCurrent spec10 marksDynamic Programming

6.

Figure 2: staged directed network from S to T with arcs SA 3, SB 2, AC 4, AE 5, BC 4, BD 7, BE 4, CF 3, CG 4, DF 3, DG 1, EG 2, FH 5, FI 4, FJ 6, GH 5, GI 3, HT 2, IT 3, JT 4
Figure 2

The staged, directed network in Figure 2 represents the roads that connect 12 towns, S, A, B, C, D, E, F, G, H, I, J and T. The number on each arc shows the time, in hours, it takes to drive between these towns.

Elena plans to drive from S to T. She must arrive at T by 9 pm.

(a) By completing the table in the answer book, use dynamic programming to find the latest time that Elena can start her journey from S to arrive at T by 9 pm. (9)

[The table in the answer book has columns headed Stage, State, Action, Destination and Value.]

(b) Hence write down the route that Elena should take. (1)

A2 June 2023 Q6

EdexcelCurrent spec13 marksDynamic Programming

6. Polly is a motivational speaker who is planning her engagements for the next four weeks.

Polly will

  • visit four different countries in these four weeks
  • visit just one country each week
  • leave from her home, S, and return there only after visiting the four countries
  • travel directly from one country to the next

Polly wishes to determine a schedule of four countries to visit.

Table 1 shows the countries Polly could visit each week.

Week1234
Possible countries to visitA or BC, D or EF or GH, I or J

Table 1

Table 2 shows the speaker fee, in £100s, Polly would expect to earn in each country.

CountryABCDEFGHIJ
Earnings in £100s47454847494445474948

Table 2

Table 3 shows the cost, in £100s, of travelling between the countries.

ABCDEFGHIJ
S52788
A345
B546
C75
D67
E76
F678
G786

Table 3

Polly’s expected income is the value of the speaker fee minus the cost of travel.

She wants to find a schedule that maximises her total expected income for the four weeks.

Use dynamic programming to determine the optimal schedule. Complete the table provided in the answer book and state the maximum expected income. (13)

[The table in the answer book has columns headed Stage, State, Action, Destination and Value.]

A2 June 2022 Q6

EdexcelCurrent spec14 marksDynamic Programming

6. Bernie makes garden sheds. He can build up to four sheds each month.

If he builds more than two sheds in any one month, he must hire an additional worker at a cost of £250 for that month.

In any month in which sheds are made, the overhead costs are £35 for each shed made that month.

A maximum of three sheds can be held in storage at the end of any one month, at a cost of £80 per shed per month.

Sheds must be delivered at the end of the month.

The order schedule for sheds is

MonthJanuaryFebruaryMarchAprilMay
Number ordered13352

There are no sheds in storage at the beginning of January and Bernie plans to have no sheds left in storage after the May delivery.

Use dynamic programming to determine the production schedule that minimises the costs given above. Complete the working in the table provided below and state the minimum cost. (14)

StageStateActionDestinationValue
May200160 = 160*
11080 + 35 = 115*
02070 = 70*
MonthJanuaryFebruaryMarchAprilMay
Number made

Minimum cost:

A2 October 2021 Q6

EdexcelCurrent spec12 marksDynamic Programming

6.

Figure 3: staged directed network from S to T with arcs SA 52, SB 48, SC 50, AD 53, AE 52, AF 53, BE 51, BF 50, BG 46, CE 50, CG 47, DH 49, DI 50, EH 51, EJ 46, FH 51, FI 52, FJ 50, GI 53, GJ 51, HT 47, IT 48, JT 49
Figure 3

The staged, directed network in Figure 3 represents a series of roads connecting 12 towns, \(S\), \(A\), \(B\), \(C\), \(D\), \(E\), \(F\), \(G\), \(H\), \(I\), \(J\) and \(T\). The number on each arc shows the distance between these towns, in miles.

Bradley is planning a four-day cycle ride from \(S\) to \(T\).

He plans to leave his home at \(S\). On the first night he will stay at \(A\), \(B\) or \(C\), on the second night he will stay at \(D\), \(E\), \(F\) or \(G\), on the third night he will stay at \(H\), \(I\) or \(J\), and he will arrive at his friend’s house at \(T\) on the fourth day.

Bradley decides that the maximum distance he will cycle on any one day should be as small as possible.

(a) Write down the type of dynamic programming problem that Bradley needs to solve. (1)
(b) Use dynamic programming to complete the table below. (9)
StageStateActionDestinationValue
(c) Hence write down the possible routes that Bradley could take. (2)

A2 October 2020 Q7

EdexcelCurrent spec12 marksDynamic Programming

7. A manufacturer can export five batches of footwear each year. Each exported batch contains just one type of footwear. The types of footwear are trainers, sandals or high heels.

The table below shows the profit, in £1000s, for the number of batches of each type of footwear.

Number of batches012345
Trainers05090170225295
Sandals070110165245300
High heels075115\(x\)235305

The total annual profit is to be maximised.

(a) Use dynamic programming to determine the two possible values of the maximum total annual profit, giving one of these values in terms of \(x\). (10)

Given that the maximum total annual profit is £320 000

(b) advise the manufacturer on the possible ways in which the five batches should be allocated. (2)

A2 June 2019 Q3

EdexcelCurrent spec13 marksDynamic Programming

3.

Figure 1: staged directed network from S to T with arcs SA 13, SB x, SC 24, AD 32, AE 29, BD 20, BE 19, BF −17, CF 13, DG −24, DH 18, EH 24, EI 27, FG −25, FI 14, FJ −30, GT 28, HT 19, IT −24, JT 17
Figure 1

In Figure 1 the weight of arc SB is denoted by \(x\) where \(x \geqslant 0\)

(a) Explain why Dijkstra’s algorithm cannot be used on the directed network in Figure 1. (1)

It is given that the minimum weight route from S to T passes through B.

(b) Use dynamic programming to find
(i) the range of possible values of \(x\)
(ii) the minimum weight route from S to T. (12)

D2 June 2019 Q7

EdexcelOld spec15 marksDynamic Programming

7. A company has purchased a plot of land and has decided to build four holiday homes, A, B, C and D, on the land at the rate of one home per year.

The company expects that the construction costs each year will vary, depending on which houses have already been constructed and which house is currently under construction. The expected construction costs, in thousands of pounds, are shown in the table below.

Construction cost
Already builtABCD
Nothing25353530
A–455055
B50–4555
C6045–50
D655560–
A and B––4035
A and C–55–30
A and D–5560–
B and C45––50
B and D65–35–
C and D5540––
A and B and C–––65
A and B and D––55–
A and C and D–45––
B and C and D55–––

In order to manage annual cash flow, the company needs to choose the order in which it builds the holiday homes so that the greatest expected annual cost of construction is as small as possible.

(a) Write down the type of dynamic programming problem that the company needs to solve. (1)
(b) Use dynamic programming to complete the table in the answer book. (11)
(c) Hence determine the order in which the four holiday homes should be built and the total expected cost of construction. (3)

D2 June 2018 Q6

EdexcelOld spec15 marksDynamic Programming

6. Jonathan is an author who is planning his next book tour. He will visit four countries over a period of four weeks. He will visit just one country each week. He will leave from his home, S, and will only return there after visiting the four countries. He will travel directly from one country to the next. He wishes to determine a schedule of four countries to visit.

Table 1 shows the countries he could visit each week.

Week1234
Possible countriesA, B or CD or EF, G or HI or J

Table 1

Table 2 shows the appearance fees, in £100s, he expects to earn in each country.

CountryABCDEFGHIJ
Earnings in £100s27293224223536383029

Table 2

Table 3 shows the cost, in £100s, of travelling between the countries.

ABCDEFGHIJ
S34653
A64
B53
C65
D768
E664
F57
G57
H67

Table 3

Jonathan’s expected income is the value of the appearance fees minus the cost of travel. He decides to use dynamic programming to find a schedule that maximises his total expected income for these four weeks.

Complete the table in the answer book to solve this dynamic programming problem. Hence write down Jonathan’s optimal expected income and state his possible optimal schedules.

D2 June 2017 Q7

EdexcelOld spec13 marksDynamic Programming

7. A clothing manufacturer can export a maximum of five batches of shirts each year.

Each exported batch contains just one type of shirt, the types being T-shirts, Rugby shirts and Polo shirts.

The table below shows the profit, in £1000s, for the number of each exported batch type.

Number of batches012345
T-shirt05595180230290
Rugby shirt065100160245285
Polo shirt070110175225310

The total annual profit is to be maximised.

(a) Use dynamic programming to determine the maximum annual profit. (11)
(b) Advise the manufacturer on the possible ways in which the five batches could be allocated. (2)

D2 June 2016 Q7

EdexcelOld spec15 marksDynamic Programming

7. Remy builds canoes.

He can build up to five canoes each month, but if he wishes to build more than three canoes in any one month he has to hire an additional worker at a cost of £400 for that month.

In any month when canoes are built, the overhead costs are £150

A maximum of three canoes can be held in stock in any one month, at a cost of £25 per canoe per month.

Canoes must be delivered at the end of the month.

The order book for canoes is

MonthJanuaryFebruaryMarchAprilMay
Number ordered22564

There is no stock at the beginning of January and Remy plans to have no stock after the May delivery.

(a) Use dynamic programming to determine the production schedule that minimises the costs given above. Show your working in the table provided in the answer book and state the minimum cost. (13)

The cost of materials is £200 per canoe and the cost of Remy’s time is £450 per month. Remy sells the canoes for £700 each.

(b) Determine Remy’s total profit for the five-month period. (2)

D2 June 2015 Q6

EdexcelOld spec16 marksDynamic Programming

6.

Figure 2: staged directed network of roads from S to T through A, B, C, D, E, F, G, H and J with weight limits
Figure 2

The staged, directed network in Figure 2 represents a series of roads connecting 11 towns, S, A, B, C, D, E, F, G, H, J and T. The number on each arc shows the weight limit, in tonnes, for the corresponding road. Janet needs to drive a truck from S to T, passing through exactly three other towns. She needs to find the maximum weight of the truck that she can use.

(a) Write down the type of dynamic programming problem that Janet needs to solve. (1)
(b) Use dynamic programming to complete the table in the answer book. (10)
(c) Hence find the maximum weight of the truck Janet can use. (1)
(d) Write down the route that Janet should take. (1)

Janet intends to ask for the weight limit to be increased on one of the three roads leading directly into T. Janet wishes to maximise the weight of her truck.

(e) (3)
(i) Determine which of the three roads she should choose and its new minimum weight limit.
(ii) Write down the maximum weight of the truck she would be able to use and the new route she would take.

D2 June 2014 (R) Q7

EdexcelOld spec13 marksDynamic Programming

7. Susie has hired a team of four workers who can make three types of toy. The total number of toys the team can produce will depend on which toys they make, and on how many workers are assigned to make each type of toy.

The table shows how many of each toy would be made if different numbers of workers were assigned to make them. Each worker is to be assigned to make just one type of toy and all four workers are to be assigned. Susie wishes to maximise the total number of toys produced.

Number of workers
01234
TOYSBicycle080170260350
Dolls House095165245335
Train Set0100180260340
(a) Use dynamic programming to determine the allocation of workers which maximises the total number of toys made. You should show your working in the table provided in the answer book. (12)
(b) State the maximum total number of toys produced by this team. (1)

D2 June 2014 Q7

EdexcelOld spec14 marksDynamic Programming

7. A company assembles microlight aircraft.

They can assemble up to four aircraft in any one month, but if they assemble more than three they will have to hire additional space at a cost of £1000 per month.

They can store up to two aircraft at a cost of £500 each per month.

The overhead costs are £2000 in any month in which work is done.

Aircraft are delivered at the end of each month. There are no aircraft in stock at the beginning of March and there should be none in stock at the end of July.

The order book for aircraft is

MonthMarchAprilMayJuneJuly
Number ordered34243

Use dynamic programming to determine the production schedule which minimises the costs. Show your working in the table provided in the answer book and state the minimum production cost. (14)

D2 June 2013 (R) Q8

EdexcelOld spec12 marksDynamic Programming

8. A factory can process up to five units of carrots each month.

Each unit can be sold fresh or frozen or canned.

The profits, in £100s, for the number of units sold, are shown in the table.

The total monthly profit is to be maximised.

Number of units012345
Fresh04585120150175
Frozen04570100120130
Canned03575125155195

Use dynamic programming to determine how many of the five units should be sold fresh, frozen and canned in order to maximise the monthly profit. State the maximum monthly profit. (12)

D2 June 2013 Q7

EdexcelOld spec13 marksDynamic Programming

7. Nigel has a business renting out his fleet of bicycles to tourists.

At the start of each year Nigel must decide on one of two actions:

  • Keep his fleet of bicycles, incurring maintenance costs.
  • Replace his fleet of bicycles.

The cost of keeping the fleet of bicycles,
the cost of replacing the fleet of bicycles
and the annual income are dependent on the age of the fleet of bicycles.
Table 1 shows these amounts, in £1000s.

Age of fleet of bicyclesnew1 year old2 years old3 years old4 years old
Cost of keeping (£1000s)01238
Cost of replacing (£1000s)–78910
Income (£1000s)118520

Table 1

Nigel has a new fleet of bicycles now and wishes to maximise his total profit over the next four years.

He is planning to sell his business at the end of the fourth year.

The amount Nigel will receive will depend on the age of his fleet of bicycles.

These amounts, in £1000s, are shown in Table 2.

Age of fleet of bicycles at end of 4th year1 year old2 years old3 years old4 years old
Amount received at end of 4th year (£1000s)6421

Table 2

Complete the table in the answer book to determine Nigel’s best strategy to maximise his total profit over the next four years. You must state the action he should take each year (keep or replace) and his total profit. (13)

D2 June 2012 Q8

EdexcelOld spec12 marksDynamic Programming

8. A company makes industrial robots.

They can make up to four robots in any one month, but if they make more than three they will have to hire additional labour at a cost of £400 per month.

They can store up to two robots at a cost of £150 per robot per month.

The overhead costs are £300 in any month in which work is done.

Robots are delivered to buyers at the end of each month. There are no robots in stock at the beginning of January and there should be none in stock after the April delivery.

The order book for robots is

MonthJanuaryFebruaryMarchApril
Number of robots required2234

Use dynamic programming to determine the production schedule which minimises the costs, showing your working in the table provided in the answer book. (12)

D2 June 2011 Q7

EdexcelOld spec13 marksDynamic Programming

7. Patrick is to take orders for his company’s products.
He will visit four countries over the next four weeks.
He will visit just one country each week.
He will leave from his office in London and will only return there after visiting the four countries.
He will travel directly from one country to the next.
He wishes to determine a schedule of four countries to visit.

Table 1 shows the countries he could visit in each week.

WeekWeek 1Week 2Week 3Week 4
Possible countriesA or BC, D or EF or GH or I

Table 1

Table 2 shows the value of the orders, in £100s, he expects to take in each country.

CountryABCDEFGHI
Value of expected orders in £100s221742413929273638

Table 2

Table 3 shows the cost, in £100s, of travelling between the various countries.

Travel costs in £100sABCDEFGHI
London5354
A542
B443
C65
D63
E44
F67
G56

Table 3

The expected income is the value of the expected orders minus the cost of travel.

It is decided to use dynamic programming to find a schedule that maximises the total expected income for these four weeks.

(a) Complete the table in the answer book to determine the optimal expected income. (11)
(b) State Patrick’s two optimal schedules. (2)

D2 June 2010 Q4

EdexcelOld spec13 marksDynamic Programming

4.

Figure 1: directed network from S to T. S to A 37, S to B 39, S to C 41; A to D 41, A to E 38, B to E 44, C to E 36, C to F 35; D to G 22, D to H 31, E to H 34, E to I 39, F to I 52; G to T 17, H to T 21, I to T 29
Figure 1

Figure 1 represents the maintenance choices a council can make and their costs, in £1000s, over the next four years.

The council wishes to minimise the greatest annual cost of maintenance.

(a) Use dynamic programming to find a minimax route from S to T. (9)
(b) State your route and the greatest annual cost incurred by the council. (2)
(c) Calculate the average annual cost to the council. (2)

D2 June 2009 Q7

EdexcelOld spec13 marksDynamic Programming

7. Minty has £250 000 to allocate to three investment schemes. She will allocate the money to these schemes in units of £50 000. The net income generated by each scheme, in £1000s, is given in the table below.

£0£50 000£100 000£150 000£200 000£250 000
Scheme 1060120180240300
Scheme 2065125190235280
Scheme 3055110170230300

Minty wishes to maximise the net income. She decides to use dynamic programming to determine the optimal allocation, and starts the table shown in your answer book.

(a) Complete the table in the answer book to determine the amount Minty should allocate to each scheme in order to maximise the income. State the maximum income and the amount that should be allocated to each scheme. (10)
(b) For this problem give the meaning of the table headings
(i) Stage,
(ii) State,
(iii) Action.
(3)

D2 June 2008 Q4

EdexcelOld spec12 marksDynamic Programming

4.

(a) Explain the difference between a maximin route and a minimax route in dynamic programming. (2)
Staged network from L to R through A to I

A maximin route from L to R is to be found through the staged network shown above.

(b) Use dynamic programming to complete a table and hence find a maximin route. (10)

D2 June 2007 Q7

EdexcelOld spec14 marksDynamic Programming

7.

Network of underwater tunnels from X to Y through air pockets A to L with times in seconds

Agent Goodie has successfully recovered the stolen plans from Evil Doctor Fiendish and needs to take them from Evil Doctor Fiendish’s secret headquarters at X to safety at Y. To do this he must swim through a network of underwater tunnels. Agent Goodie has no breathing apparatus, but knows that there are twelve points, \(A\), \(B\), \(C\), \(D\), \(E\), \(F\), \(G\), \(H\), \(I\), \(J\), \(K\) and \(L\), at which there are air pockets where he can take a breath.

The network is modelled above, and the number on each arc gives the time, in seconds, it takes Agent Goodie to swim from one air pocket to the next.

Agent Goodie needs to find a route through this network that minimises the longest time between successive air pockets.

(a) Use dynamic programming to complete a table of stage, state, action, destination and value, and hence find a suitable route for Agent Goodie. (12)

Unfortunately, just as Agent Goodie is about to start his journey, tunnel XA becomes blocked.

(b) Find an optimal route for Agent Goodie avoiding tunnel XA. (2)

D2 June 2006 Q5

EdexcelOld spec12 marksDynamic Programming

5. Victor owns some kiosks selling ice cream, hot dogs and soft drinks.

The network below shows the choices of action and the profits, in thousands of pounds, they generate over the next four years. The negative numbers indicate losses due to the purchases of new kiosks.

Directed network from S to T through A to K with profits and losses on the arcs

Use a suitable algorithm to determine the sequence of actions so that the profit over the four years is maximised and state this maximum profit. (12)

D2 June 2006 Q1

EdexcelOld spec4 marksDynamic Programming

1.

(a) State Bellman’s principle of optimality. (1)
(b) Explain what is meant by a minimax route. (1)
(c) Describe a practical problem that would require a minimax route as its solution. (2)

D2 January 2006 Q2

EdexcelOld spec12 marksDynamic Programming

2. An engineering firm makes motors. They can make up to five in any one month, but if they make more than four they have to hire additional premises at a cost of £500 per month. They can store up to two motors for £100 per motor per month. The overhead costs are £200 in any month in which work is done.

Motors are delivered to buyers at the end of each month. There are no motors in stock at the beginning of May and there should be none in stock after the September delivery.

The order book for motors is:

MonthMayJuneJulyAugustSeptember
Number of motors33754

Use dynamic programming to determine the production schedule that minimises the costs, showing your working in a table with the headings

Stage (month)State (Number in store at start of month)Action (Number made in month)Destination (Number in store at end of month)Value (cost)

Production schedule

MonthMayJuneJulyAugustSeptember
Number to be made

Total cost: ………… (12)

D2 June 2005 Q4

EdexcelOld spec14 marksDynamic Programming

4.

(a) Explain what is meant by a maximin route in dynamic programming, and give an example of a situation that would require a maximin solution. (3)
Network from A to K with weighted arcs

A maximin route is to be found through the network shown in the diagram.

(b) Complete the table in the answer book, and hence find a maximin route. (9)
(c) List all other maximin routes through the network. (2)