0

The game Tiny Tower has various 'Bitizens' which are skilled 0-9 in different attributes:

Michael:  
 a) retail: 9
 b) creative: 2
 c) service: 7
 d) recreational: 4
 e) food: 6

And it then has business in which three Bitizens can work at. Each business falls into one of the categories retail, creative, service, recreational and food. There is never any match between the amount of businesses or Bitizens, but to make things easier we could assume the number of positions matches the number of bitizens.

For example, there might be a Hat Shop which is a retail business, so Bitizens with high retail values are favourable. In the above example, Micheal is highly suited to be in a retail business.

How can I, algorithmically, fill the positions with the most relevantly-skilled Bitizens? I tried to have a go at the problem but I had trouble wrapping my head around in a way that would actually solve the problem effectively.

Nick Johnson
  • 100,655
  • 16
  • 128
  • 198
Josh Hunt
  • 14,225
  • 26
  • 79
  • 98
  • Can you provide some more information? An example of a `Business` and what needs to be maximized would be helpful. – multipleinterfaces Jul 15 '11 at 21:15
  • What exactly is your goal? Do you want to maximize the sum, over each bitizen, of the attribute corresponding to the business in which they work? – RoundTower Jul 15 '11 at 21:15
  • Sorry. I edited my question to hopefully make my intentions clearer. Overall, I want to put the employees in business that match their skills. Not as easy as putting them in the business they are most skilled in (because other people might be more skilled, or it might be a 'waste') – Josh Hunt Jul 15 '11 at 21:25

2 Answers2

4

Let's assume an extra "point" is equally valuable no matter where you put it. For example, if you have two businesses, creative and food, we assume it is always better to have a total of 20 in creative and 3 in food than to have 11 in each.

In that case, your problem is an example of the Assignment problem. This is known to be "easy" in that it can be solved in polynomial time: in particular, in time O(n^3). The Hungarian algorithm is the standard method for solving this problem. I can't explain it any better than the wikipedia page, which is quite detailed, but if you are stuck with something there, just ask.

If you have an enormous number of bitizens and businesses, so that this algorithm is infeasible, I think the problem would be quite amenable to attack by approximate methods like simulated annealing or evolutionary algorithms.

If my original assumption is incorrect (for example, if it might be better to have at least one well-staffed business of each type) you almost certainly should try these inexact methods. Concentrate on designing an objective function that reflects the value of any given worker-business assignment permutation.

RoundTower
  • 899
  • 5
  • 9
  • Thank you. I will definitely give those links a read over. Sounds like a good starting point. – Josh Hunt Jul 15 '11 at 21:48
  • Well, when the question is phrased like now, then it's NP-hard. So, no heuristic will change the situation. Hope OP will add more details. Thanks – eat Jul 15 '11 at 21:56
0

If you are able to lump all of your attributes such a way that there are only one objective to minimize, then you'll be able to solve your problem with assignment problem. Otherwise your problem is like multi-index assignment problem, which is NP-hard.

So, please elaborate on your particular case, in order to figure out a reasonable solution for it.

eat
  • 7,440
  • 1
  • 19
  • 27