Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource placement (optimal strategy)

I know that this is not exactly the right place to ask this question, but maybe a wise guy comes across and has the solution.

I'm trying to write a computer game and I need an algorithm to solve this question:

The game is played between 2 players. Each side has 1.000 dollars. There are three "boxes" and each player writes down the amount of money he is going to place into those boxes. Then these amounts are compared. Whoever placed more money in a box scores 1 point (if draw half point each). Whoever scores more points wins his opponents 1.000 dollars. Example game:

Player A: [500, 500, 0] Player B: [333, 333, 334]

Player A wins because he won Box A and Box B (but lost Box C).

Question: What is the optimal strategy to place the money?

I have more questions to ask (algorithm related, not math related) but I need to know the answer to this one first.

Update (1): After some more research I've learned that these type of problems/games are called Colonel Blotto Games. I did my best and found few (highly technical) documents on the subject. Cutting it short, the problem I have (as described above) is called simple Blotto Game (only three battlefields with symmetric resources). The difficult ones are the ones with, say, 10+ battle fields with non-symmetric resources. All the documents I've read say that the simple Blotto game is easy to solve. The thing is, none of them actually say what that "easy" solution is.

Update (2): I wrote a small actionscript file to demonstrate the strategy in the paper mentioned by Tom Sirgedas. You can test it at megaswf. Instructions: Click a point inside the triangle. Red region represent winning cases. Blue region represents losing cases, tiny whitish lines represents draw.

like image 962
blackened Avatar asked Feb 28 '11 23:02

blackened


People also ask

What is optimum strategy?

An optimal strategy is one that provides the best payoff for a player in a game. Optimal Strategy = A strategy that maximizes a player's expected payoff.

What is an optimal solution in game theory?

An optimal solution to the game is said to be reached if neither player finds it beneficial to alter his strategy. In this case the game is said to be in a state of equilibrium. This equilibrium is called as Nash Equilibrium. The game matrix is usually expressed in terms of a payoff to a player.


1 Answers

I found an optimal strategy in this paper: http://www.rand.org/pubs/research_memoranda/2006/RM408.pdf

Let's call this Blotto's strategy.

enter image description here

Look at the diagram above. Any move you make can be represented by a point on the triangle. The strategy in the paper says to pick a point at random in the hexagon. Choose points closer to the edge of the hexagon with higher probability (0 probability for the center of the hexagon, and linearly scale up to the maximum probability at the hexagon outline. Every point on the hexagon outline has equal probability.)

This solution is for "continuous" Blotto, but I assume you are interested in the discrete case (dividing N troops into 3 groups). Applying Blotto's strategy to the discrete case works perfectly well, when N is a multiple of 3. For other values of N, I was able to make a small adjustment on the hexagon border that works very well, but not perfectly.

If there is a strategy that can defeat this one, there must be some static move which wins against Blotto's strategy. There is none, except for when N is not a multiple of 3, then it seems that a move on the line where the big triangle and hexagon meet (e.g. the move <0,.5,.5>) will win against Blotto's strategy slightly more than lose. For N=100, the difference seems to be less than 1%, and continues to shrink for larger N.

Code to implement Blotto's strategy:

// generate a random number in the range [0,x) -- compensate for rand()%x being slightly un-uniform
int rnd( int x ) { int r; while ( 1 ) { r = rand(); if ( r < RAND_MAX/x*x ) return r % x; } }

// distance from center of triangle/hexagon to (x,y,z), multiplied by 3 (trilinear coordinates)
int hexagonalDist3( int x, int y, int z, int N ) { return max(max(abs(N-x*3),abs(N-y*3)),abs(N-z*3)); }

void generateRandomSimpleBlottoMove( int& x, int& y, int& z, int totalTroops )
{
   int N = totalTroops;
   while ( true )
   {
      x = rnd(N+1);
      y = rnd(N+1);
      z = N-x-y;

      // keep only moves in hexagon, with moves closer to the border having higher probability
      double relativeProbabilityOfKeepingThisMove = hexagonalDist3(x,y,z,N) > N ? 0 : hexagonalDist3(x,y,z,N);

      // minor adjustment for hexagon border when N is not a multiple of 3 -- not perfect, but "very close"
      if ( N % 3 != 0 && hexagonalDist3(x,y,z,N) == N ) 
         relativeProbabilityOfKeepingThisMove = N*(N%3)/3; 

      // possibly keep our move 
      if ( rnd(N) < relativeProbabilityOfKeepingThisMove )
         break;
   }
}
like image 110
Tom Sirgedas Avatar answered Nov 15 '22 10:11

Tom Sirgedas