Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The focus of this assignment is more on the accuracy of the approximation rather than the algorithm's efficiency. So while you might want to track

The focus of this assignment is more on the accuracy of the approximation rather than the algorithm's efficiency. So while you might want to track the times for the sake of curiosity, our tables and graphs should reflect the approximations themselves. To that end, the column headings of your table, and the data beneath them, should be the following:

  • Trial No. - 1, 2, 3, etc.

  • File Name - the file name from which you read the input for that trial

  • Items - the number of items (weights) found in that file

  • Optimal Answer - the number of bins in an optimal solution (compute this by adding up all the weights in the file and dividing by a bin-capacity of 100. The data has been "hard-wired" to exactly fit an integer number of bins.)

  • Online NF - the number of bins computed by the Online BPP Next Fit approximation algorithm

  • Online FF - the number of bins computed by the Online BPP First Fit approximation algorithm

  • Online BF - the number of bins computed by the Online BPP Best Fit approximation algorithm

  • Offline FFD - the number of bins computed by the Offline BPP First Fit Decreasing approximation algorithm

  • Offline BFD - the number of bins computed by the Offline BPP Best Fit Decreasing approximation algorithm

The graph should similarly compare the number of bins required in an optimal solution and the five algorithms. One graph per trial.

Tasks:

[1] Like in the previous assignment, you will need a function that reads all the files in a directory. You should download the data files from our Google drive into a local directory.

[2] For each file, read in the weights of the n items into a list.

[3] Implement each of the five approximation algorithms mentioned above. For the two "offline" versions that require presorting the data in non-increasing (decreasing) order, you may use Python's built-in sorting function or call any other sorting algorithm of your choosing. You may also use your choice of data structure for finding a bin with a suitable or best-fit capacity. (The slides mention using a "balanced binary search tree", but you are not required to use this data structure.)

[4] Create a Pandas DataFrame structured according to the output columns mentioned above and populate another row for each trial.

[5] Create an appropriate bar graph showing the results of a given trial (optimal solution and the five approximate solutions).

how to use data table connect to graph function python, give me example

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Question Can a Roth IRA invest in stock of the IRA owners business?

Answered: 1 week ago

Question

Draw and explain the operation of LVDT for pressure measurement

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago