Reducing%20Knapsack%20to%20TSP - PowerPoint PPT Presentation

About This Presentation
Title:

Reducing%20Knapsack%20to%20TSP

Description:

Reducing Knapsack to TSP Prof. Pasi Fr nti ... (N+1)-11-2-0 Knapsack problem Input: knapsack instance {2,3,5,7,11} Size of the knapsack S=15. – PowerPoint PPT presentation

Number of Views:200
Avg rating:3.0/5.0
Slides: 10
Provided by: csJoensu6
Category:

less

Transcript and Presenter's Notes

Title: Reducing%20Knapsack%20to%20TSP


1
Reducing Knapsack to TSP
  • Pasi Fränti

2
Knapsack problem
  • Input knapsack instance 2,3,5,7,11
  • Size of the knapsack S15.

3
Step 1 Create one node for every item
  • Input knapsack instance 2,3,5,7,11
  • Create a node for every knapsack element.

2
7
5
3
11
4
Step 2 Add start and end points
  • Input knapsack instance 2,3,5,7,11
  • Add node 0 as the home.
  • Add node N1 as the turning point.

2
7
5
0
n1
3
11
N2 nodes needed to represent the knapsack
instance
5
Step 3 Create forward links
  • Input knapsack instance 2,3,5,7,11
  • Draw links from smaller nodes to bigger ones.
  • Set weights according to the bigger node
    w(i,j)j.

7
2
7
2
7
7
7
5
5
5
0
n1
5
11
11
3
11
3
3
11
11
6
Step 4 Create forward links for node N1
  • Input knapsack instance 2,3,5,7,11
  • Draw links to N1 with weights w(i,N1)0.

7
2
7
2
7
7
7
0
5
0
5
5
0
0
n1
0
5
0
11
11
3
11
3
3
11
11
7
Step 5 Create backward links
  • Input knapsack instance 2,3,5,7,11
  • Draw backward links from bigger to smaller nodes.
  • Set weight of the link as w(j,i)0.

0
2
7
0
0
0
0
0
0
0
0
0
5
0
n1
0
0
0
0
0
0
0
3
11
0
8
Solution for KP ? Solution for TSP
  • KP 3,5,7
  • ?
  • TSP 0-3-5-7-(N1)-11-2-0 (S15)

Visit the nodes in an increasing order !
9
Solution for TSP ? Solution for KP
  • TSP 0-3-5-7-(N1)-11-2-0

?
  • KP 3,5,7 (all nodes which arrival cost gt
    0)

Select nodes with entrance wgt0 !
Write a Comment
User Comments (0)
About PowerShow.com