Heuristics - + 6 X 3 + 4 X 4 <=10 Then we choose X2 = 1...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Heuristics Knapsack Problem NP-Hard Problem (very difficult to solve) We go on a trip and we can only take 16 pounds in our bag. X 1 = Laptop (10 pounds) X 2 = IPod (4pounds) X 3 = Blackberry (6 pounds) X 4 = BIT textbook (4 pounds) 10 X 1 + 4 X 2 + 6 X 3 + 4 X 4 <=16 Max Z = 16 X 1 + 7 X 2 + 14 X 3 + 5 X 4 We want to pack the things that have the most value for us. (40 X 1 + 20 X 2 + 20 X 3 + 9 X 4 <= 60 With 2 constraints or more multi dimensional knapsack makes it even harder.) Here we are going to look only at the single dimension knapsack with one constraint. Create a ratio: value to the weight. Greedy Heuristics get as much as we can. X1 = 16/10 = 1.6 X2 = 7/4 = 1.75 X3 = 14/6 = 2.33 X4 = 5/4 = 1.25 So we choose X3 = 1 Now we have Z = 14 10 X 1 + 4 X 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: + 6 X 3 + 4 X 4 <=10 Then we choose X2 = 1 Z = 14 + 7 10 X 1 + 4 X 2 + 6 X 3 + 4 X 4 <=6 The next best ratio is X1 but it weights 10 and we only have 6 pounds left. Then we choose X4 = 1 Z = 14 + 7 + 5 10 X 1 + 4 X 2 + 6 X 3 + 4 X 4 <=2 Now we know we are done. So X1 = 0 And we get Z = 26 and we will take 14 pounds with us. But this is not the best solution. If we take X1 = 1, X2 = 0, X3 = 1, X4 = 0 and so Z = 30. It is a good answer but not all the time the best answer. Problem 12-9 Shortest route problem X 12 = 0,1 X 1 3 = 0,1 . . . . X 11, 12 = 0,1 Min Sum(i) Sum(j) Cij Xij X 1 2 + X 1 3 + X 1 4 = 1 X 10,13 + X 12,13 = 1 X 1 2 = X 2 5 X 1 3 = X 3 5 + X 3 4 12-21...
View Full Document

This note was uploaded on 10/12/2008 for the course BIT 3434 taught by Professor Trrakes during the Fall '08 term at Virginia Tech.

Page1 / 2

Heuristics - + 6 X 3 + 4 X 4 <=10 Then we choose X2 = 1...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online