Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Assignment 5 in CSC 464: Traveling Salesperson Problem and 0-1 Knapsack Problem - Prof. Ja, Assignments of Algorithms and Programming

The instructions and objectives for assignment 5 in the computer science course csc 464. The assignment involves solving two problems: the traveling salesperson problem and the 0-1 knapsack problem using dynamic programming and greedy algorithms. Students are required to show all steps in their solutions and calculate the profits and weights of given items to find the optimal solution.

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-a4v
koofers-user-a4v 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSC 464 - 01 Assignment 5
Given: March 14, 2003 Due: March 21, 2003
Value: 45 points
Objectives:
understand use of the dynamic programming strategy in the traveling salesperson
problem
compare and contrast greedy and dynamic programming in solving the 0-1 knapsack
problem
Please do the work neatly in pencil on one side of a page.
1. For the traveling salesperson problem #26 on page 133, show all steps
(consideration of all subsets, one by one, as in class) in the solution to the
problem. Work carefully (and not microscopically) and double check your work
because errors will propagate.
[25 points]
Write width-wise instead of length-wise if necessary for the clarity of the dynamic
programming array.
2. Given the following items:
item 1 2 3
weight 10 20 30
profit 60 100 120
a. Calculate the greedy solution to this 0-1 knapsack problem for W = 40
considering the items in order with largest profit per unit weight first. Show all
steps (consideration of each item and inclusion or rejection).
[2]
b. Calculate the dynamic programming solution to the problem for W = 40;
i.e., develop the 2-dimensional array. You can show the array entries for weights
in multiples of 10 from 0 through 40.
[8]
3. Given the following items:
item 1 2 3
weight 3 4 7
profit 4 5 10
and assuming the capacity W of the knapsack is 11.
a. Calculate the greedy solution to this 0-1 knapsack problem, considering the
items in order with largest profit per unit weight first. Show all steps.
[2]
b. Calculate the dynamic programming solution to this problem, show all
array entries for weights from 0 through 11.
[8]
Assignment 5 1

Partial preview of the text

Download Assignment 5 in CSC 464: Traveling Salesperson Problem and 0-1 Knapsack Problem - Prof. Ja and more Assignments Algorithms and Programming in PDF only on Docsity!

CSC 464 - 01 Assignment 5 Given: March 14, 2003 Due: March 21, 2003 Value: 45 points Objectives :  understand use of the dynamic programming strategy in the traveling salesperson problem  compare and contrast greedy and dynamic programming in solving the 0-1 knapsack problem Please do the work neatly in pencil on one side of a page.

  1. For the traveling salesperson problem #26 on page 133, show all steps (consideration of all subsets, one by one, as in class) in the solution to the problem. Work carefully (and not microscopically) and double check your work because errors will propagate. [25 points] Write width-wise instead of length-wise if necessary for the clarity of the dynamic programming array.
  2. Given the following items: item 1 2 3 weight 10 20 30 profit 60 100 120 a. Calculate the greedy solution to this 0-1 knapsack problem for W = 40 considering the items in order with largest profit per unit weight first. Show all steps (consideration of each item and inclusion or rejection). [2] b. Calculate the dynamic programming solution to the problem for W = 40; i.e., develop the 2-dimensional array. You can show the array entries for weights in multiples of 10 from 0 through 40. [8]
    1. Given the following items: item 1 2 3 weight 3 4 7 profit 4 5 10 and assuming the capacity W of the knapsack is 11. a. Calculate the greedy solution to this 0-1 knapsack problem , considering the items in order with largest profit per unit weight first. Show all steps. [2] b. Calculate the dynamic programming solution to this problem, show all array entries for weights from 0 through 11. [8] Assignment 5 1