Heuristic methods for fair sharing
Description
Distributing jobs/items to a number of consumers in a fair way has a number of applications. In this project you must implement 5 methods mentioned in the powerpoint: Random Assignment, Round Robin, Max-Min Round Robin, Reverse Round Robin and Least Load.
Input/output
As can be seen from the powerpoint, there is some randomness in the input, i.e. the numbers that should be distributed. Use the random library for the required randomness. In order to make the program deterministic it should read the data from a file (make the file yourself) with the following format:
Consumers: 4 35.3 33.3 . . 60.8
That means there is a header line telling who many consumers the following numbers/weights should be distributed to. The output should clearly demonstrate how the program has distributed the numbers to the consumers using the different methods, f.ex. like this.
A | B | C | D |
---|---|---|---|
87.0 | 79.2 | 78.5 | 74.2 |
7.1 | 12.2 | 16.2 | 17.3 |
69.9 | 68.8 | 60.8 | 46.4 |
22.8 | 28.2 | 33.3 | 35.3 |
45.3 | 44.9 | 42.9 | 37.8 |
---------- | ---------- | ---------- | ---------- |
232.1 | 233.3 | 231.7 | 211.0 |
Optional:
You can make a small helper program, that generates the input file from parameters that you give it.
You can implement another method for distribution the numbers.