290 likes | 457 Views
Dynamic programming – Maximin problem. A maximin problem involves finding a route so as to make the smallest weighted arc as heavy as possible. Maximise the smallest weight = Maximin. The classic example of a maximin problem is a truck
E N D
Dynamic programming – Maximin problem A maximin problem involves finding a route so as to make the smallest weighted arc as heavy as possible. Maximise the smallest weight = Maximin The classic example of a maximin problem is a truck that needs to deliver as much cargo as possible in one trip but there are weight restrictions on the bridges. So the truck needs to follow a route that allows it to be as heavy as possible. The smallest weight restriction needs to be as big as possible. Here the arcs represent roads and their weights are the maximum weight allowed for a truck on the road.
Dynamic programming – Maximin problem Problem 1: Find the route through the network from A to G for which the minimum weight on the route is as large as possible. B 1 E 7 4 5 3 6 D G A 2 3 6 2 4 C 6 F This type of problem is called a maximin problem. Notice that we are not interested in the total weight of the route.
Dynamic programming – Maximin problem The first step is to label all the nodes with stage and state variables. The stage variable for a node is the maximum number of transitions required to get from this node to the end node, G. All nodes with the same stage variable are then given a different state variable, starting with 0 at the top of the page and working downwards. G has stage variable 0, and is given the state variable 0. B 1 E 7 4 5 3 6 D G A 2 (0, 0) 3 6 2 4 C 6 F
Dynamic programming – Maximin problem The first step is to label all the nodes with stage and state variables. The stage variable for a node is the maximum number of transitions required to get from this node to the end node, G. All nodes with the same stage variable are then given a different state variable, starting with 0 at the top of the page and working downwards. F is the only node with stage variable 1. F is given state variable 0. B 1 E 7 4 5 3 6 D G A 2 (0, 0) 3 6 2 4 C 6 F (1, 0)
Dynamic programming – Maximin problem The first step is to label all the nodes with stage and state variables. The stage variable for a node is the maximum number of transitions required to get from this node to the end node, G. All nodes with the same stage variable are then given a different state variable, starting with 0 at the top of the page and working downwards. E is the only node with stage variable 2. E is given state variable 0. B 1 E (2, 0) 7 4 5 3 6 D G A 2 (0, 0) 3 6 2 4 C 6 F (1, 0)
Dynamic programming – Maximin problem The first step is to label all the nodes with stage and state variables. The stage variable for a node is the maximum number of transitions required to get from this node to the end node, G. All nodes with the same stage variable are then given a different state variable, starting with 0 at the top of the page and working downwards. D is the only node with stage variable 3. D is given state variable 0. B 1 E (2, 0) 7 4 5 3 6 D G A (3, 0) 2 (0, 0) 3 6 2 4 C 6 F (1, 0)
Dynamic programming – Maximin problem The first step is to label all the nodes with stage and state variables. The stage variable for a node is the maximum number of transitions required to get from this node to the end node, G. All nodes with the same stage variable are then given a different state variable, starting with 0 at the top of the page and working downwards. B and C have stage variables of 4. B is given state variable 0, and C is given state variable 1. B (4, 0) 1 E (2, 0) 7 4 5 3 6 D G A (3, 0) 2 (0, 0) 3 6 2 4 C (4, 1) 6 F (1, 0)
Dynamic programming – Maximin problem The first step is to label all the nodes with stage and state variables. The stage variable for a node is the maximum number of transitions required to get from this node to the end node, G. All nodes with the same stage variable are then given a different state variable, starting with 0 at the top of the page and working downwards. A has stage variable 5. A is given state variable 0. B (4, 0) 1 E (2, 0) 7 4 5 3 6 D G A (3, 0) 2 (0, 0) (5, 0) 3 6 2 4 C (4, 1) 6 F (1, 0)
Dynamic programming – Maximin problem The next step is to set up a table to show your working. B (4, 0) 1 E (2, 0) 7 4 5 3 6 D G A (3, 0) 2 (0, 0) (5, 0) 3 6 2 4 C (4, 1) 6 F (1, 0)
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 6 D G A (3, 0) 2 (5, 0) (0, 0) 3 6 2 4 6 C (4, 1) F (1, 0) For each possible route, you need to look at the minimum weight edge on that route. For each node, you then need to identify the route for which the minimum weight edge is as large as possible – the maximin value.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 (5, 0) (0, 0) 3 6 2 4 6 C (4, 1) F (1, 0) In Stage 1, consider nodes with stage variable 1. This is F only. There is only one possible action from F, which is FG. This has value 4. The maximin value of a route starting from F is therefore 4 .
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 (5, 0) (0, 0) 2 E (2, 0) 1 3 6 2 4 6 C (4, 1) F (1, 0) In Stage 2, consider nodes with stage variable 2. This is E only. There are two possible actions from E. Action 0 is EG. The value of EG is 3.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 6 C (4, 1) F (1, 0) In Stage 2, consider nodes with stage variable 2. This is E only. There are two possible actions from E. Action 1 is EF. The value of EF is 2. From stage 1, the maximin value of a route from F is 4. So the smallest weight that must be covered on this route is 2.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 6 C (4, 1) F (1, 0) In Stage 2, consider nodes with stage variable 2. This is E only. The maximin value of a route starting from E is the maximum of the values of the two possible routes, which is 3.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 In Stage 3, consider nodes with stage variable 3. This is D only. There are two possible actions from D. Action 0 is DE. The value of DE is 5. From stage 2, the maximin value of a route from F is 3. So the smallest weight that must be covered on this route is 3.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 In Stage 3, consider nodes with stage variable 3. This is D only. There are two possible actions from D. Action 1 is DF. The value of DF is 6. From stage 1, the maximin value of a route from F is 4. So the smallest weight that must be covered on this route is 4.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 In Stage 3, consider nodes with stage variable 3. This is D only. The maximin value of a route starting from D is the maximum of the values of the two possible routes, which is 4.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 0 Min(1,3)=1 B (4, 0) 1 4 In Stage 4, consider nodes with stage variable 4. These are B and C. There are two possible actions from B. Action 0 is BE. The value of BE is 1. From stage 2, the maximin value of a route from E is 3. So the smallest weight that must be covered on this route is 1.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 1) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 0 Min(1,3)=1 B (4, 0) 1 Min(4,4)=4 4 In Stage 4, consider nodes with stage variable 4. These are B and C. There are two possible actions from B. Action 1 is BD. The value of BD is 4. From stage 3, the maximin value of a route from D is 4. So the smallest weight that must be covered on this route is 4.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 0 Min(1,3)=1 B (4, 0) 1 Min(4,4)=4 4 4 In Stage 4, consider nodes with stage variable 4. These are B and D. The maximin value of a route starting from B is the maximum of the values of the two possible routes, which is 4.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maxinim Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 0 Min(1,3)=1 B (4, 0) 1 Min(4,4)=4 4 4 In Stage 4, consider nodes with stage variable 4. These are B and C. 0 Min(3,4)=3 C (4, 1) 1 There are two possible actions from C. Action 0 is CD. The value of CD is 3. From stage 3, the maximin value of a route from D is 4. So the smallest weight that must be covered on this route is 3.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 0 Min(1,3)=1 B (4, 0) 1 Min(4,4)=4 4 4 In Stage 4, consider nodes with stage variable 4. These are B and C. 0 Min(3,4)=3 C (4, 1) 1 Min(6,4)=4 There are two possible actions from C. Action 1 is CF. The value of CF is 6. From stage 1, the maximin value of a route from F is 4. So the smallest weight that must be covered on this route is 4.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 0 Min(1,3)=1 B (4, 0) 1 Min(4,4)=4 4 4 In Stage 4, consider nodes with stage variable 4. These are B and C. 0 Min(3,4)=3 C (4, 1) 1 Min(6,4)=4 4 The maximin value of a route starting from C is the maximum of the values of the two possible routes, which is 4.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 0 Min(1,3)=1 B (4, 0) 1 Min(4,4)=4 4 4 In Stage 5, consider nodes with stage variable 5. This is A only. 0 Min(3,4)=3 C (4, 1) 1 Max(6,4)=4 4 There are three possible actions from A. 0 Min(7,4)=4 Action 0 is AB. 5 A (5, 0) 1 The value of AB is 7. From stage 4, the maximin value of a route from B is 4. 2 So the smallest weight that must be covered on this route is 4.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 0 Min(1,3)=1 B (4, 0) 1 Min(4,4)=4 4 4 In Stage 5, consider nodes with stage variable 5. This is A only. 0 Min(3,4)=3 C (4, 1) 1 Min(6,4)=4 4 There are three possible actions from A. 0 Min(7,4)=4 Action 1 is AD. 5 A (5, 0) 1 Min(6,4)=4 The value of AD is 6. From stage 3, the maximin value of a route from D is 4. 2 So the smallest weight that must be covered on this route is 4.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 0 Min(1,3)=1 B (4, 0) 1 Min(4,4)=4 4 4 In Stage 5, consider nodes with stage variable 5. This is A only. 0 Min(3,4)=3 C (4, 1) 1 Min(6,4)=4 4 There are three possible actions from A. 0 Min(7,4)=4 Action 2 is AC. 5 A (5, 0) 1 Min(6,4)=4 The value of AC is 2. From stage 4, the maximin value of a route from C is 2. 2 Min(2,4)=2 So the smallest weight that must be covered on this route is 2.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 0 Min(1,3)=1 B (4, 0) 1 Min(4,4)=4 4 4 In Stage 5, consider nodes with stage variable 5. This is A only. 0 Min(3,4)=3 C (4, 1) 1 Min(6,4)=4 4 The maximin value of a route starting from A is the maximum of the values of the three possible routes, which is 4. 0 Min(7,4)=4 4 5 A (5, 0) 1 Min(6,4)=4 4 2 Min(2,4)=2
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 From the completed table, the maximum value of the minimum weight is 4. 0 Min(1,3)=1 B (4, 0) 1 Min(4,4)=4 4 4 The table shows that there are two possible maximin routes. 0 Min(3,4)=3 C (4, 1) 1 Min(6,4)=4 4 You can take the first action from A, which is AB, 0 Min(7,4)=4 4 5 A (5, 0) 1 Min(6,4)=4 4 then the second action out of B, which is BD, 2 Min(2,4)=2 then the second action out of D, which is DF, and finally the action FG. So one maximin route is ABDFG.
Dynamic programming – Maximin problem B (4, 0) E (2, 0) 1 Current maximin Stage State Action Value 7 4 3 5 1 F (1, 0) 0 4 4 6 D G A (3, 0) 2 0 3 3 (5, 0) (0, 0) 2 E (2, 0) 1 Min (2,4)=2 3 6 2 4 0 Min(5,3)=3 3 D (3, 0) 6 C (4, 1) F (1, 0) 1 Min(6,4)=4 4 From the completed table, the maximum value of the minimum weight is 4. 0 Min(1,3)=1 B (4, 0) 1 Min(4,4)=4 4 4 The table shows that there are two possible maximin routes. 0 Min(3,4)=3 C (4, 1) 1 Min(6,4)=4 4 Alternatively, you can take the second action from A, which is AD, 0 Min(7,4)=4 4 5 A (5, 0) 1 Min(6,4)=4 4 then the second action out of D, which is DF, 2 Min(2,4)=2 and finally the action FG. So another maximin route is ADFG.