0% found this document useful (0 votes)
22 views10 pages

DP 1

Uploaded by

Hrijul chauhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views10 pages

DP 1

Uploaded by

Hrijul chauhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

DYNAMIC PROGRAMMING

Contents

• Stage Coach Problem solution - Backward Recursive Approach


• Terminology
Stage Coach Problem

• A person wants to go from city 1 to city 10. the various


possibilities and the distances are given in the following table.
Arc Distance Arc Distance Arc Distance Arc Distance

1-2 5 2-7 8 4-6 5 6-9 7

1-3 5 3-5 8 4-7 7 7-8 5

1-4 6 3-6 10 5-8 6 7-9 7

2-5 4 3-7 5 5-9 8 8-10 8

2-6 7 4-5 4 6-8 9 9-10 9


Stage Coach Problem

4
2 6
7 5
8
8
5 8
8 8
5 10 9
1 3 6 10
5 7
6 9 9
4 5
5
4 7 7
7

Shorted path from node 1 to node 10


Backward Recursive Approach

✔ n=1: One more stage to go

s X1 f1(s) X1*

8 10 8 10

9 10 9 10
Backward Recursive Approach
✔ n=2: Two more stage to go
s X2 f2(s) X2*
8 9
5 6+8 8+9 14 8
=14 =17
6 9+8 7+9 16 9
=17 =16

7 5+8 7+9 13 8
=13 =16

Corresponding
Backward Recursive Approach
✔ n=3: Three more stage to go
s X3 f3(s) X3*
5 6 7
2 4+14 16+7 8+13 18 5
=18 =23 =21
3 8+14 10+16 5+13 18 7
=22 =26 =18

4 4+14 5+16 7+13 18 5


=18 =21 =20

Corresponding
Backward Recursive Approach
✔ n=4: Four more stage to go

s X4 f4(s) X4*

1 5+18 5+18 6+18 23 2, 3


=23 =23 =24

Corresponding
Final solution

• 1-2-5-8-10
• 1-3-7-8-10
• Z=23.
Terminology

• Stage – Stage
• State- city at which the person presently is
• Decision variables- next destination
• Criterion of effectiveness- Minimize total distance

You might also like