1) Write code to pack your suitcase. I've included a csv file that lists items, a value, and a weight associated with each item. Read in this file and pack your suitcase with these items using a greedy approach. Your goal is to optimize packing your suitcase such that you maximize the space used for the greatest possible value. For instance, if the limit of my suitcase is 1000 and I have one item that weighs 1000 and has a value of 4, then the best way to pack my suitcase is with this one item if there are no other combination of items with a total weight < 1000 and a value > 4. Your implementation should be written as a function which takes in 2 parameters: (1) the path/name of the csv file and (2) the max allowed weight, w. The function will return the total weight packed, the value of the items packed, and a list of the items packed. The value of the suitcase will be equivalent to the sum of the value for all items packed. For both questions A and B, the problem is bounded. We have 1 of each item listed in the csv file. A. Implement the fractional knapsack problem. When writing out the items packed, include the fraction of the item packed (0 to 1). The value of the item is based upon the fraction of the item packed. For example, if the item has a value of 1 and you packed % of it, then the value of packing that item would be 0.5. B. Implement the integer knapsack problem.

Information Technology Project Management
9th Edition
ISBN:9781337101356
Author:Kathy Schwalbe
Publisher:Kathy Schwalbe
Chapter3: The Project Management Process Groups
Section: Chapter Questions
Problem 6E
icon
Related questions
Question
100%

I need this done in Python and have included what the CSV file contains. Thanks!

1) Write code to pack your suitcase. I've included a csv file that lists items, a value, and a weight
associated with each item. Read in this file and pack your suitcase with these items using a greedy
approach. Your goal is to optimize packing your suitcase such that you maximize the space used for the
greatest possible value. For instance, if the limit of my suitcase is 1000 and I have one item that weighs
1000 and has a value of 4, then the best way to pack my suitcase is with this one item if there are no
other combination of items with a total weight < 1000 and a value > 4.
Your implementation should be written as a function which takes in 2 parameters: (1) the path/name of
the csv file and (2) the max allowed weight, w. The function will return the total weight packed, the
value of the items packed, and a list of the items packed. The value of the suitcase will be equivalent to
the sum of the value for all items packed. For both questions A and B, the problem is bounded. We have
1 of each item listed in the csv file.
A. Implement the fractional knapsack problem. When writing out the items packed, include the
fraction of the item packed (0 to 1). The value of the item is based upon the fraction of the item
packed. For example, if the item has a value of 1 and you packed % of it, then the value of
packing that item would be 0.5.
B. Implement the integer knapsack problem.
Transcribed Image Text:1) Write code to pack your suitcase. I've included a csv file that lists items, a value, and a weight associated with each item. Read in this file and pack your suitcase with these items using a greedy approach. Your goal is to optimize packing your suitcase such that you maximize the space used for the greatest possible value. For instance, if the limit of my suitcase is 1000 and I have one item that weighs 1000 and has a value of 4, then the best way to pack my suitcase is with this one item if there are no other combination of items with a total weight < 1000 and a value > 4. Your implementation should be written as a function which takes in 2 parameters: (1) the path/name of the csv file and (2) the max allowed weight, w. The function will return the total weight packed, the value of the items packed, and a list of the items packed. The value of the suitcase will be equivalent to the sum of the value for all items packed. For both questions A and B, the problem is bounded. We have 1 of each item listed in the csv file. A. Implement the fractional knapsack problem. When writing out the items packed, include the fraction of the item packed (0 to 1). The value of the item is based upon the fraction of the item packed. For example, if the item has a value of 1 and you packed % of it, then the value of packing that item would be 0.5. B. Implement the integer knapsack problem.
ITEM, VALUE, WEIGHT
1st aid box,1880,700
1st aid jar, 736,500
1st aid kit [square], -184,700
baby bottle, 365,600
baby carriage,1455,10000
basket,910,249
bbq fork, 536,450
beach chair, -1209,7000
bicycle, -61,13154
book, 1949, 680
bowl, 1057,900
bracelet,916,80
broom, 1826,680
bucket, 881,541
Transcribed Image Text:ITEM, VALUE, WEIGHT 1st aid box,1880,700 1st aid jar, 736,500 1st aid kit [square], -184,700 baby bottle, 365,600 baby carriage,1455,10000 basket,910,249 bbq fork, 536,450 beach chair, -1209,7000 bicycle, -61,13154 book, 1949, 680 bowl, 1057,900 bracelet,916,80 broom, 1826,680 bucket, 881,541
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Image Element
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Information Technology Project Management
Information Technology Project Management
Computer Science
ISBN:
9781337101356
Author:
Kathy Schwalbe
Publisher:
Cengage Learning
Principles of Information Systems (MindTap Course…
Principles of Information Systems (MindTap Course…
Computer Science
ISBN:
9781305971776
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning