0% found this document useful (0 votes)
763 views

03-Dynamic Programming

The document discusses using dynamic programming to solve several optimization problems involving scheduling activities with constraints. It provides examples of modeling shortest path problems, hike scheduling problems, and backpack packing problems as dynamic programming problems to find optimal solutions. Sample recursive equations and tables showing the stages of building optimal solutions are included.

Uploaded by

aziz
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
763 views

03-Dynamic Programming

The document discusses using dynamic programming to solve several optimization problems involving scheduling activities with constraints. It provides examples of modeling shortest path problems, hike scheduling problems, and backpack packing problems as dynamic programming problems to find optimal solutions. Sample recursive equations and tables showing the stages of building optimal solutions are included.

Uploaded by

aziz
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Dynamic Programming

Question 1
Solve the shortest path problem with dynamic programming (Forward
strategy)
7
B E 1
4
6 H
2 4
3
3 6
4 2
A C F J
3
4 4
3
3 I
4
1 3
D G
5
We have 5 stages

𝐹 𝑡 (𝑖 )=𝑆h𝑜𝑟𝑡𝑒𝑠𝑡𝑝𝑎𝑡 h 𝑓𝑜𝑟𝑚𝑛𝑜𝑑𝑒 𝐴 𝑡𝑜𝑛𝑜𝑑𝑒 𝑖𝑜𝑓 𝑠𝑡𝑎𝑔𝑒𝑡



𝛿 ( 𝑖 )=𝑆𝑒𝑡𝑜𝑓 𝑝𝑟𝑑𝑒𝑐𝑒𝑠𝑠𝑜𝑟𝑠𝑜𝑓 𝑛𝑜𝑑𝑒𝑖
Stage 0:

Stage 1:
Stage 2:
Stage 3:
Stage 4:
Question 2
• I am an avid hiker. Last summer, I went with my friend G. Don on a 5-day hike-
and-camp trip in the beautiful White Mountains in New Hampshire. We
decided to limit our hiking to an area comprising three well-known peaks:
Mounts Washington, Jefferson, and Adams. Mount Washington has a 6-mile
base-to-peak trail. The corresponding base-to-peak trails for Mounts Jefferson
and Adams are 4 and 5 miles, respectively.
• The trails joining the bases of the three mountains are 3 miles between
Mounts Washington and Jefferson, 2 miles between Mounts Jefferson and
Adams, and 5 miles between Mounts Adams and Washington. We started on
the first day at the base of Mount Washington and returned to the same spot
at the end of 5 days. Our goal was to hike as many miles as we could. We also
decided to climb exactly one mountain each day and to camp at the base of
the mountain we would be climbing the next day. Additionally, we decided
that the same mountain could not be visited in any two consecutive days.
• Use DP to schedule the 5-day hike.
Question 3
A wilderness hiker must pack three items: food, first-aid kits, and
clothes.
The backpack has a capacity of 3 ft3 Each unit of food takes 1 ft3. A first-
aid kit occupies ¼ ft3 and each piece of cloth takes about ½ ft3.
The hiker assigns the priority weights 3, 4, and 5 to food, first aid, and
clothes, which means that clothes are the most valuable of the three
items.
From experience, the hiker must take at least one unit of each item and
no more than two first-aid kits.
How many of each item should the hiker take?
Let,

Objective

Subject to,

and 1 and integer


Assume, as the volume assigned to items i, i +1, ……and n.

Recursive Equations:
Stage 3:

Optimum Solution

1 ---- ---- ---- ---- ---- ---- ---- ----


2 5 ---- ---- ---- ---- ---- 5 1
3 5 ---- ---- ---- ---- ---- 5 1
4 5 10 --- --- ---- ---- 10 2
5 5 10 --- --- ---- ---- 10 2
6 5 10 15 ---- ---- --- 15 3
7 5 10 15 ---- ---- --- 15 3
8 5 10 15 20 ---- ---- 20 4
9 5 10 15 20 ---- ---- 20 4
10 5 10 15 20 25 --- 25 5
11 5 10 15 20 25 --- 25 5
12 5 10 15 20 25 30 30 6
Stage 2:

Optimum Solution

1 4 + --- ---- --- ---


2 4 + --- 8 + --- --- ---
3 4+5=9 8 + --- 9 1
4 4+5=9 8 + 5 = 13 13 2
5 4 + 10 = 14 8 + 5 = 13 14 1
6 4 + 10 = 14 8 + 10 = 18 18 2
7 4 + 15 = 19 8 + 10 = 18 19 1
8 4 + 15 = 19 8 + 15 = 23 23 2
9 4 + 20 = 24 8 + 15 = 23 24 1
10 4 + 20 = 24 8 + 20 = 28 28 2
11 4 + 25 = 29 8 + 20 = 28 29 1
12 4 + 25 = 29 8 + 25 = 33 33 2
Stage 1:

Optimum Solution

12 3 + 23 = 26 6 + 13 = 19 9 + ---- 26 1

Optimum Solution:
Z = 26
m1 = 1, m2 = 2, m3 = 3

You might also like