NAME

Game::Theory::TwoPersonMatrix - Reduce & analyze a 2 person matrix game

VERSION

version 0.02

SYNOPSIS

use Game::Theory::TwoPersonMatrix;
my $g = Game::Theory::TwoPersonMatrix->new(
  1 => { strategy => { 1 => \@s1, 2 => \@s2, } },
  2 => { strategy => { 1 => \@t1, 2 => \@t2, } },
);
$g->reduce(2, 1);
$g->reduce(1, 2);
my $p = $g->payoff;
print Dumper $p;
my $e = $g->nash;
print Dumper $e;

DESCRIPTION

A Game::Theory::TwoPersonMatrix reduces and analyzes a two person matrix game of player names, strategies and numerical utilities.

The players must have the same number of strategies, and each strategy must have the same size utility vectors as all the others.

Player strategies are given by a 2D matrix of utilities such that,

[ [ u1, u2 .. un] .. [ v1, v2 .. vn ] ]

Where each "ui" is a utility measure for the strategy "U."

Player 1 and 2 are the "row" and "column" players, respectively. This is due to the tabular format of a matrix game:

                 Player 2
                 --------
        Strategy  1    2
Player |    1    1,0  1,3
   1   |    3    0,2  2,4

The same game in "linear form" is:

P1: { 1: [1,1], 3: [0,2] }
P2: { 1: [0,2], 2: [3,4] }

For a description of player probability profiles, please see the relevant literature.

NAME

Game::Theory::TwoPersonMatrix - Reduce & analyze a 2 person matrix game

METHODS

new()

my $g = Game::Theory::TwoPersonMatrix->new(%args);

Create a new Game::Theory::TwoPersonMatrix object.

Player defaults:

1 => { 1 => [1,0], 2 => [0,1] }, # The "row player"
2 => { 1 => [1,0], 2 => [0,1] }  # The "column player"

If the probabilities are not given, they are computed to yield the same results as the player strategy profile. W00!

reduce()

$g->reduce_game(1, 2); # Player 1 given opponent 2
print Dumper $g->{1}, $g->{2};
$g->reduce_game(2, 1); # Player 2 given opponent 1
print Dumper $g->{1}, $g->{2};

Reduce the game by elimination of a single strictly dominated strategy of the player.

Use repeated application of this method to solve a game, or verify that it is insoluble.

nash()

my $equilibria = $g->nash;
print Dumper $equilibria;

Find the Nash equilibria.

payoff()

my $p = $g->payoff;
print Dumper $p;

    | 0 3 0 |      | 3 0 0 |
A = | 2 1 3 |  B = | 1 2 3 |

PA = 0*p1*q1 + 3*p1*q2 + 0*p1*q3
   + 2*p2*q1 + 1*p2*q2 + 3*p1*q3
PB = 3*p1*q1 + 0*p1*q2 ...
   + 1*p2*q1 + 2*p2*q2

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Gene Boggs.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.