Game Optimization

34 Views Asked by At

I stumbled over this problem while coding and I'm lost. Is there a simple solution to this problem? Or what terms do I have to look for to read up on it?

Game rules

  • you have n cards (e.g. A & B) which you have to place onto n playing fields (e.g. I & II). One card per field and all cards have to be placed.

  • you gain points according to a card/ playing field table. For example:

\begin{array}{c|c|c} & I & II \\\hline A & 1 & 2 \\\hline B & -1 & 2 \end{array}

  • the goal is to gain the maximum points possible.

    => In this example it'd be A => I, B => II for 3 points.

What is the best way of finding the optimal combination as fast as possible in the general case?

e.g. n = 3 {A, B, C, I, II, III}

\begin{bmatrix}1 & 2 & 3\\-1 & 4 & 2\\1 & 4 & 3 \end{bmatrix}

edit: Ok the problem is known as the assignment problem (https://cs.stackexchange.com/questions/149595/maximum-sum-of-values-in-a-square-grid-one-in-each-row-column)