Test the bin packing algorithms

Assignment Help Data Structure & Algorithms
Reference no: EM131116532

Test the following bin-packing algorithms:
(a) Next fit. (b) Firstfit.?(c) First fit decreasing.
Your program should run as follows:
./TestBinPackingAlgorithms <Number of Items>
The <Number of Items> should be an integer that corresponds to the number of items you will try to fit into bins. Your program should do the following:
// Generate a vector of N random numbers in the range [0.0, 1.0];
vector<double> random_numbers = GenerateRandomNumbers(N);?
const int number_of_bins_next_fit = NextFitBinPacking(random_numbers);
const int number_of_bins_first_fit = FirstFitBinPacking(random_numbers);
// Sort the random_numbers from larger to smaller
std::sort(random_numbers.begin(), random_numbers.end(),
std::greater<double>());?
const int number_of_bins_first_fit_decreasing = FirstFitBinPacking(random_numbers);

cout << "Number of bins:" << endl;

cout << "Next Fit: " << number_of_bins_next_fit << endl;
cout << "First Fit: " << number_of_bins_first_fit << endl;
cout << "First Fit Decreasing: " << number_of_bins_first_fit_decreasing << endl;
To generate a set of random numbers in the range [0.0, 1.0]:
#include <cstdlib>
#include <ctime>
using namespace std;
srand(time(0)); //use current time as seed for random generator
for (int i = 0; i < N; ++i) {
const double random_variable = (double)rand() % (double)RAND_MAX;
// Push it into the vector of random numbers.
}
You can use a naïve implementation for FirstFit. You don't have to keep track of the items per bin, but just the total number of bins. So each bin can be represented by the amount_of_space_used. An empty bin will have amount_of_space_used = 0.0, whereas for a full bin amount_of_space_used = 1.0;
You should expect FFD to be better than FF, and FF to be better than NF. Report your final results in your readme file.
}
Test for 50, 100, and 500 items.
--For extra credit you can implement FirstFitBinPacking using a more efficient implementation that requires a priority queue--

Reference no: EM131116532

Questions Cloud

Elements of product identity and meaning : A Brand encompasses the various elements of product identity and meaning. Brand equity reflects the value of a brand name based on its strength and appeal in the marketplace and its power as a communication vehicle.  There is also the aspect of br..
Relative to its actual average inventory position : If Kroger had Whole Foods' number of days' sales in inventory, how much additional cash flow would have been generated from the smaller inventory relative to its actual average inventory position? Round interim calculations to one decimal place an..
Considered as opportunity for market expansion : Going global is many times considered as an opportunity for market expansion. Discuss the option(s) of distribution networks considering the local competition in the foreign country. Discuss the phases for identifying regions for facility locations a..
Walsh company manufactures and sells one product : Walsh Company manufactures and sells one product. The following information pertains to each of the company's first two years of operations: Variable costs per unit:
Test the bin packing algorithms : Test the following bin-packing algorithms: (a) Next fit. (b) Firstfit.?(c) First fit decreasing.
Best definition of hegemony : Which of the following is the best definition of 'hegemony?
Differences between high school and community college : Differences between High School and Community College. By going to college how will you increase your earning power?  Similarities and differences? Difference in how much it costs?
Which is part of integrated health system : The Medical Staff at your hospital (which is part of an integrated health system of network hospitals, a nursing home, multiple physician practices) requires the integration of a knowledge based application to be integrated within their organizationa..
Corporate legality versus corporate responsibility : Read the Recalcitrant Director of Byte Products, Inc. which can be found in the Cases section of the textbook. James Elliot, The Chairman & CEO, has asked you to write a recommendation on getting a super-majority board vote to either a) use the plant..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd