Game Theory – Edward Mellor /stor-i-student-sites/edward-mellor PhD Student at STOR-i CDT, ¶¶Ňő̽̽App Thu, 30 Apr 2020 15:07:34 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 /stor-i-student-sites/edward-mellor/wp-content/uploads/sites/7/2021/08/cropped-cropped-EMlogo-32x32.png Game Theory – Edward Mellor /stor-i-student-sites/edward-mellor 32 32 The Patrol Problem /stor-i-student-sites/edward-mellor/2020/04/26/the-patrol-problem/ Sun, 26 Apr 2020 13:47:05 +0000 http://www.lancaster.ac.uk/stor-i-student-sites/edward-mellor/?p=205 Read more]]> In my previous post, I talked about the statistics research project that I did as part of the STOR-i program. Today I will discuss the Operational Research project I worked on with Kevin Glazebrook about Optimal Patrolling.

Consider an art gallery with several rooms. Some of these rooms are connected directly by doorways but for some pairs of rooms it may be necessary to pass through one or more intermediary rooms in order to travel between them. Each room in the gallery contains various valuable pieces of artwork. At night, when the gallery is closed, a single guard must patrol the area to prevent thievery or vandalism from instituters (attackers). The Patrol Problem is to find a patrol route that minimizes the expected cost of any damage caused by attackers.

To approach this problem we must first create a model and make some modelling assumptions.

We can use the ideas from my post on The seven bridges of Königsberg to represent the rooms of the gallery as nodes on a graph as shown in the example below:

We assume that the total value of the artwork in each room is known to both the patroller and any potential attacker. We also assume that the length of time taken to carry out an attack in any given room is random but is sampled from a known distribution.

Our patrol model assumes that the attackers arrive according to a Poisson process with a known rate and then decide which room to attack in one of the two follow ways:

  1. The target of the attack is chosen at random with known probabilities.
  2. The target of each attack is chosen strategically with the presence of a patroller in mind and the aim to maximize the total expected cost of the attacks.

The patroller is assumed to move between rooms in discrete time-steps. If the patroller interrupts an attack in progress, we assume that no damage is caused.

We need a way to tell the patroller which is the best route to take.

If the attackers choose where to attack using the randomised method we have the following:

While visiting a location the patroller either determines that no attacks are underway or apprehends the attacker. Thus, we know that immediately after a visit to a location, no attackers are present. It therefore makes sense to characterize the system by a vector containing the number of time-steps since patroller visited each room. We call this the state of the model.

If we assume that the time it takes to carry out an attack has some maximum, we can ensure the number of states is finite. This is because once we have neglected a room long enough, increasing the time since the last visit will not change the probability that an attack is ongoing.

The current room can be determined from the state as it will correspond to the entry with the lowest value. A patrol policy then tells the patroller what to do in any given state: either stay where you are or move to an adjacent room.

Since there are a finite number or states and a finite number of rooms we have a finite number of policies. An optimal policy can be found using linear programming.

If the attackers choose where to attack strategically we can create a two-person zero sum game as discussed by in my post on game theory.

In either case the optimal solution is very computationally expensive to calculate and so approximate methods are often preferred.

]]>
Game Theory feat. Sherlock Holmes /stor-i-student-sites/edward-mellor/2020/03/31/game-theory-feat-sherlock-holmes/ /stor-i-student-sites/edward-mellor/2020/03/31/game-theory-feat-sherlock-holmes/#comments Tue, 31 Mar 2020 11:03:42 +0000 http://www.lancaster.ac.uk/stor-i-student-sites/edward-mellor/?p=165 Read more]]> Game theorists develop strategies for competitive situations where multiple players make decisions, each of which affect the outcome. Each player has some utility function that they are trying to maximise. Usually the best option for a given player is dependent on what the other players choose. Such situations are referred to as games.

In this blog we will discuss a particular type of game called a two-person zero-sum game. This is a two player game where the utility function of one player is exactly the negative of the utility function of the other. It is therefore sufficient to only consider the utility function of one player.

We will consider an example from Alan R. Washbern’s book: where each of the players have only two options. Since the players have a finite number of options they can write all possible outcomes in a matrix and so this is called a matrix game.

As promised this example features Sherlock Holmes and his nemesis Professor James Moriarty and is inspired by ‘s book The Final Solution.

In the book, Holmes boards a train from London to Dover in an attempt to escape from Moriarty. As the train pulls away from the station the pair see each other. Holmes is aware that Moriarty has the necessary resources to overtake the train and be waiting for him in Dover. Holmes now has two options: to take the train all the way to Dover or to get off early at the only intermediate station – Canterbury. Moriarty is aware of these options and so must choose to wait for Holmes in either Canterbury of Dover.

If both choose to go to the same place Holmes has no chance of escape. If Holmes chooses Dover while Moriarty chooses Canterbury, Homes can safely escape to mainland Europe. Finally, if Holmes Chooses Canterbury and Moriarty chooses Dover, there is still a 50% chance that Holmes will be captured before he escapes the county. Thus, we have the following matrix M of escape probabilities where the rows represent Holmes’ choice and the columns represent Moriarty’s choice.

Sherlock wants to maximise his chance of escape so what is his optimal strategy?

There are two ‘pure strategies’ available: to go to Canterbury or to go to Dover. Alternatively, Holmes can create a ‘mixed strategy’ by going to Canterbury with probability p and Dover otherwise. We can recover the two pure strategies by letting p=0 or p=1.

Assume Moriarty chooses to go to Canterbury with probability q then the probability of escape is given by (p + 2q – 3pq)/2. We can see that if Moriarty chooses q=1/3 then this probability is 1/3 regardless of the choice of p. Additionally, if Holmes chooses p=2/3 then he can also ensure the escape probability is 1/3 regardless of the choice of q. If Holmes/Moriarty then changes their strategy, their chances of escape/capture will decrease.

We see that the highest guaranteed utility for one player corresponds exactly to the lowest guaranteed utility for the other. The von Neumann’s Theorem which Washburn goes on to prove in his book (linked above) tells us that this will always be true when both players have an optimal policy.

]]>
/stor-i-student-sites/edward-mellor/2020/03/31/game-theory-feat-sherlock-holmes/feed/ 1
Optimal strategy for ‘Guess Who?’? /stor-i-student-sites/edward-mellor/2020/02/26/optimal-strategy-for-guess-who/ Wed, 26 Feb 2020 15:01:06 +0000 http://www.lancaster.ac.uk/stor-i-student-sites/edward-mellor/?p=160 Read more]]> As I was growing up, one of my favourite games was Guess Who?. This two player game was originally created by but is now owned by .  Each player is allocated one of 24 possible characters from the table of names below. The players then take turns to ask yes/no questions to guess the other person’s character.

AlexAlfredAnitaAnneBernardBillCharlesClaire
DavidEricFrankGeorgeHermanJoeMariaMax
PaulPeterPhilipRichardRobertSamSusanTom

The player who eliminates all but one of the possible candidates in the least amount of moves is the winner. If both players correctly identify their opposition’s character in the same amount of moves it’s a draw.

I recently saw a video by online claiming to have a best Guess Who? strategy and so being a mathematician I wanted to check the numbers. In this blog we will consider what constitutes a good question and whether Rober really does have an optimal strategy.

There is an unlimited amount of questions that could be asked but many of these are equivalent.  For example, the answer to “Is your person male?”, “Is your person female?” and “is your person called Anita, Anne, Claire, Maria or Susan?” will all rule out the same candidates.

Any question will split the remaining candidates into two groups. Since each candidate that has yet to be ruled out is equally likely, we can consider any two questions equivalent if the smaller of the groups they each identify contain the same number of candidates.

Suppose we have n candidates remaining. Since we are asking a question, we must have that n is greater than 1 and since we can automatically rule out our own character we also know that n can be at most 23.

We can now define a question by the size of the smaller of the two groups that it splits the candidates into. We will call this number m. If m=0 the question is giving us no new information and therefore does not help us. We will therefore assume m is at least 1. Since m is the size of the smaller group it is at most n/2 or (n-1)/2 if n is odd. Note that such a question will always exist since for any candidate we can ask if their character name comes before them alphabetically.

Thus in our first turn we effectively have (23-1)/2=11 choices for what to do.

The best choice becomes clear if we consider the extreme cases. If m=1 we could get the correct solution straight away but this will only happen 1 in every 23 tries. The rest of the time we will only rule out one candidate. If we proceed to guess one candidate each time it will take us on average 11.5 guesses. On the other hand if we take m to be as big as possible we will rule out at least 11 candidates so it will take at most 5 guesses.

This idea is explained in more detail in the following video by Mark Rober:

The strategy laid out in Rober’s video is therefore to always try to ask a question that divides the candidates into two groups that are as even as possible. (i.e. choose m to be as big as possible)

But is this always the best approach?

If our opponent guesses correctly first time our only chance to draw is to also make a guess.

Similarly if we suppose our opponent went first and their first question rules out all but two candidates, they are then guaranteed to win on their next question. With our current strategy it is impossible for us to win in two moves and so in this situation it might be better to play more aggressively by asking a question with a smaller m.

Our choice of move could also depend on how we weight draws verses wins.  If we want to win outright then our only option is to make a guess. If we would rather win but are happy with a draw we need to make some calculations. Again we will only consider the two extreme cases:

Option 1: Make 2 random guesses

  • This gives us a 1/23 chance to win and (22/23)(1/22)=1/23 chance to draw

Option 2: Divide the group as evenly as possible then make a guess

  • This has zero of winning and (11/23)(1/11)+(12/23)(1/12) =2/23 chance to draw

Therefore, it is always better to make guesses in this situation. This highlights that although the Guess Who? strategy described by Rober is very good in most situations if we take the other players actions into account it is not optimal.

]]>