9
The Design & Analysis of The Design & Analysis of the Algorithms the Algorithms Lecture 2. 2011.. by me M. Lecture 2. 2011.. by me M. Sakalli Sakalli Download two pdf files.. Download two pdf files..

The Design & Analysis of the Algorithms Lecture 2. 2011.. by me M. Sakalli Download two s

Embed Size (px)

Citation preview

Page 1: The Design & Analysis of the Algorithms Lecture 2. 2011.. by me M. Sakalli Download two s

The Design & Analysis of The Design & Analysis of the Algorithmsthe Algorithms

Lecture 2. 2011.. by me M. SakalliLecture 2. 2011.. by me M. Sakalli

Download two pdf files.. Download two pdf files..

Page 2: The Design & Analysis of the Algorithms Lecture 2. 2011.. by me M. Sakalli Download two s

1-2M, Sakalli, CS246 Design & Analysis of Algorithms, Lecture Notes

Not about computer games.. But about Not about computer games.. But about strategies applied in GT. strategies applied in GT.

Bidding and counter-bidding game, academic studies results Bidding and counter-bidding game, academic studies results that 1$ produces 4-5$s. Cost minimization. that 1$ produces 4-5$s. Cost minimization.

Based on “analysis of conflicts”, the driving force is incentives Based on “analysis of conflicts”, the driving force is incentives and self-interest. and self-interest.

Initially it was a mathematical tool, but now it provides very Initially it was a mathematical tool, but now it provides very basis of economical games, war games. (non-cooperative basis of economical games, war games. (non-cooperative games). games).

We are also part of it with our preferences of what is good We are also part of it with our preferences of what is good over what is bad for. Economics of information. over what is bad for. Economics of information.

A large A large BW, fast process speed, and promising payoffBW, fast process speed, and promising payoff. .

Page 3: The Design & Analysis of the Algorithms Lecture 2. 2011.. by me M. Sakalli Download two s

1-3M, Sakalli, CS246 Design & Analysis of Algorithms, Lecture Notes

For a game:For a game:a.a. 2 or more "players". 2 or more "players". b.b. Each player has 1 or more possible actions.Each player has 1 or more possible actions.c.c. And each move has an effect on the "outcome"And each move has an effect on the "outcome"d.d. Each move gives a "payoff" through the matrix.Each move gives a "payoff" through the matrix.

Each player’s aim is to Each player’s aim is to maximize his/her outcomemaximize his/her outcome - players action - players action expected to be expected to be rationalrational. Therefore, a strategy is possible by . Therefore, a strategy is possible by guessing the possible consecutive moves of the opponents. guessing the possible consecutive moves of the opponents.

The degree of rationality for human is not s.th easy to model. ie. The degree of rationality for human is not s.th easy to model. ie. due to many social factors, the rationalities of human are not due to many social factors, the rationalities of human are not perfect. In computers case, programs, sw agents on behalf of perfect. In computers case, programs, sw agents on behalf of their programmers are players. their programmers are players.

GameGame: Write a number between 1-99 and taking the average, A, : Write a number between 1-99 and taking the average, A, and winner is the one guessing the closest number to %80 of A. and winner is the one guessing the closest number to %80 of A. Average will drift down with A*(4/5)Average will drift down with A*(4/5)nn 0.. How fast.. 0.. How fast..

Page 4: The Design & Analysis of the Algorithms Lecture 2. 2011.. by me M. Sakalli Download two s

1-4M, Sakalli, CS246 Design & Analysis of Algorithms, Lecture Notes

2 Person Zero Sum Game 2p-zs2 Person Zero Sum Game 2p-zs 2-players whose interests are diametrically?? opposed, 2-players whose interests are diametrically?? opposed, One’s win means the other’s loss, One’s win means the other’s loss, Always Always summing to zerosumming to zero. . Suppose Red striker and Blue is a goalie, and suppose the Suppose Red striker and Blue is a goalie, and suppose the

payoff matrix of strategies for Striker and goal keeper.. payoff matrix of strategies for Striker and goal keeper.. Blue dives to the Blue dives to the RR L ….. More columns are possible… L ….. More columns are possible…

----------------------------------------------------------------LL 2 2 -3 …..-3 …..

Red Red MM 00 2 …. 2 ….RR -5-5 10 …..10 …..

The values here are set in reference to the Strikers win.. ie The values here are set in reference to the Strikers win.. ie striker winning 2 or -5 means gk losing 2 or -5, respectively. striker winning 2 or -5 means gk losing 2 or -5, respectively.

Page 5: The Design & Analysis of the Algorithms Lecture 2. 2011.. by me M. Sakalli Download two s

1-5M, Sakalli, CS246 Design & Analysis of Algorithms, Lecture Notes

Players have complete knowledge of payoff matrix and possible Players have complete knowledge of payoff matrix and possible moves. moves. Tic-Tac-Toe, Chess, Tennis, SoccerTic-Tac-Toe, Chess, Tennis, Soccer. .

Each player must decide which move Each player must decide which move independentlyindependently (no promise), (no promise), and and simultaneouslysimultaneously (announce at the same time). Striker vs goalie.. (announce at the same time). Striker vs goalie.. Payoff matrix quantizes the moves..Payoff matrix quantizes the moves..

Blue dives to the Blue dives to the

RR L L

----------------------------------------------------------------

LL 2 2 -3 -3

Red Red MM 00 2 2

RR -5-5 10 10

RedRed10. Blue anticipates this, and dives to right and -5. But red 10. Blue anticipates this, and dives to right and -5. But red might try a left strike and wins 2... so on.. might try a left strike and wins 2... so on..

From the Red point of the game, row-wise: Max-Min, max of From the Red point of the game, row-wise: Max-Min, max of mins.mins.

Fr the Blue point, column-wise: Min-Max, min of mix.Fr the Blue point, column-wise: Min-Max, min of mix.

Page 6: The Design & Analysis of the Algorithms Lecture 2. 2011.. by me M. Sakalli Download two s

1-6M, Sakalli, CS246 Design & Analysis of Algorithms, Lecture Notes

EValue: 2rl+0rm-5rr-3ll+2ml+10lrEValue: 2rl+0rm-5rr-3ll+2ml+10lr Fair game v=0, red wins v>0, Blue wins v<0, and suppose Fair game v=0, red wins v>0, Blue wins v<0, and suppose

that l and r are probabilities.. John von Neumannthat l and r are probabilities.. John von Neumann

UmpireGame str

2 0 -5 -3 2 10

Goalie

R L

R L M R

L M

Page 7: The Design & Analysis of the Algorithms Lecture 2. 2011.. by me M. Sakalli Download two s

1-7M, Sakalli, CS246 Design & Analysis of Algorithms, Lecture Notes

Saddle points and pure strategiesSaddle points and pure strategiesSaddle points.. Saddle points.. For each row, find the min and then mark the largest of the mins. For each row, find the min and then mark the largest of the mins. For each col, find the max; and mark the cols with the smallest of the mins. For each col, find the max; and mark the cols with the smallest of the mins. If the max-min = min-max, then this is a saddle point strategy.If the max-min = min-max, then this is a saddle point strategy.There may be more than one saddle points. There may be more than one saddle points. Determining saddle points can be done efficiently, in linear time.Determining saddle points can be done efficiently, in linear time.The range between.. The range between..

Blue dives to the Blue dives to the RR L L

----------------------------------------------------------------LL 2* 2* -3 -3 -3-3

Red Red MM 0*0* 2 2 00max-minmax-min RR -5-5 10 10 -5-5

min-max min-max *2*2 1010

No saddle point. No saddle point. Basically, Red’s strategy is to guarantee wining of Basically, Red’s strategy is to guarantee wining of at least 0at least 0, , (maximum of minimums) while Blue’s is to ensure the opposite (minimum of (maximum of minimums) while Blue’s is to ensure the opposite (minimum of (losses) maximums, (losses) maximums, at most 2at most 2).. )..

This range between allows a mixed strategies.This range between allows a mixed strategies.

Page 8: The Design & Analysis of the Algorithms Lecture 2. 2011.. by me M. Sakalli Download two s

1-8M, Sakalli, CS246 Design & Analysis of Algorithms, Lecture Notes

Mixed strategiesMixed strategies

Dice.. Dice.. Blue Blue AA BB

---------------------------------------------------------------- AA 2 2 -3 -3 RedRed BB 0 0 3 3

Mixed strategy of Blue.Mixed strategy of Blue.Payoff for Payoff for Red(A) Red(A) for p=1, q=1/2 for p=1, q=1/2 (2 -3) *.5 = -0.5 (2 -3) *.5 = -0.5 Payoff for Payoff for Red(B) Red(B) for p=0, q=1/2 for p=0, q=1/2 3 *.5 = 1.5 3 *.5 = 1.5

Payoff for equally randomized p=q=1/2, expected value 2/4=0.5. Payoff for equally randomized p=q=1/2, expected value 2/4=0.5. From Blue’s perspective, not been affected from Red’s str.From Blue’s perspective, not been affected from Red’s str.Red(A) = 2q - 3(1-q) = 5q - 3.Red(A) = 2q - 3(1-q) = 5q - 3.Red(B) = + 3(1-q) = 3 - 3q., equalize these two equations qRed(B) = + 3(1-q) = 3 - 3q., equalize these two equations qBlues strategy suggests q = 3/4 with a payoff value of 3/4. Blues strategy suggests q = 3/4 with a payoff value of 3/4.

From Red’s perspective setting columns equal will suggest p = 3/8 with a payoff value of From Red’s perspective setting columns equal will suggest p = 3/8 with a payoff value of 3/4. 3/4.

The value of the game is 3/4 and optimal choices of Red (3/8, 5/8) and of Blue. (3/4, 1/4)The value of the game is 3/4 and optimal choices of Red (3/8, 5/8) and of Blue. (3/4, 1/4)

Page 9: The Design & Analysis of the Algorithms Lecture 2. 2011.. by me M. Sakalli Download two s

1-9M, Sakalli, CS246 Design & Analysis of Algorithms, Lecture Notes

John von NeumannJohn von Neumann 1928, shows that every m*n matrix 1928, shows that every m*n matrix has a unique solution, the value of the game v, has a unique solution, the value of the game v, such that of players stick by with optimal such that of players stick by with optimal strategies strategies

(i)(i) Red’s optimal strategy yields her expected payoff is Red’s optimal strategy yields her expected payoff is

>= v, no matter what Blue does. >= v, no matter what Blue does.

(i)(i) Expected payoff for Blue’s optimal strategy is, Expected payoff for Blue’s optimal strategy is, <= v, no matter what Rose does.<= v, no matter what Rose does.

(ii)(ii) More to be presented. More to be presented.