minimum for cost = Sum(i=0 to n, r
i*w
i ), or something like that
Yes the solution is simple
Do a brut search of all possible options, and select the one with lowest cost.
//vary the amount of workers
for( 1 worker used to all workers )
//when the amount of workers is fixed, vary the names selected
for( all combinations of the workers used )
//when you have a particular team, vary the amount of windows they each must wash to complete.
//eg if 50 windows must be washed by 5 people, then 1 can wash 46 and the others can wash one each
for( all starting positions of the workers )
//Calculate sum
for( all used workers )
....sum += worker time * his windows;
....if sum > min_sum goto next possibibilty
This is one implementation and no means the only one.
This could be done in about 50 lines, but I would take probably 200. I realized I use unecessary logic in my algorithm implemetations.
Last edited by crosswire; Aug 20, 2005 at 04:00 AM.
Let's act on what we agree on now, and argue later on what we don't.
Black men leave Barbeque alone if Barbeque don't trouble you