Hi,
This is difficult one to explain but here goes. I have a list of numbers which are to be set over a set number of column (Pre-determined by another calulation). The task it to move the number around till the shortest column height (Numbers are additionalised in each column to give height).
I told you it was not going to be easy to explain.
What is the best way to process this to get the column lists?
Ex:- Numbers (232,277,432,200,200,220,500,490,286,478) & Column Count is 4 (Note:- Not always are they evenly balanced by quantity).
Think of it as you can move the numbers from column to column but the aim to to get the lowest average of the sum of the column across all columns.
Ideal would (Not as per example):- Col=200,300,300 Col2=200, 400, 100, 50 Col3= 200, 300, 200 Col4=300, 200, 50, 200
Column sum
Col1=800
Col2=750
Col3=700
Col4= 750
i.e. move the lengths around to make the shortest column.
Thanks in advance.
OK, Realtime numbers
432
432
432
305
205
205
205
205
205
205
150
150
150
4 columns/pots (making an target 820 per each pot)
I hope this helps
What I have tried:
Sorry I have no trys to show as I must confess I don't realy know where to start (Any pointer are welcome).
New Try,
1) Order list to larger -> Smaller
2) Workout the Best average.
3) Add to each column (In order) largest
4) when all have first run add smallest to largest but not if largest is greater or equal to Best average.
I'm unsure if this is the best approach but it is best way I can visualise the process. Turning it into code is another issue.
Hi, Sorry for the delay in writting this up.
I have worked out a solution from the input here & thought it good to pass it on where I got to (If someone has a simular issue it may come in handy)
Steps:-
1) Sort coins with larger first.
2) Add one coin to each pot (From larger to Smaller) i.e. only one coin per pot at this stage.
3) Put the largest coin in the smallest pot till all coins have gone.
This worked for me & I hope it works for others.