NAME
Game::Theory::TwoPersonMatrix - Reduce & analyze a 2 person matrix game
VERSION
version 0.0101
SYNOPSIS
use Game::Theory::TwoPersonMatrix;
my $g = Game::Theory::TwoPersonMatrix->new(
1 => { 1 => \@u1, 2 => \@u2 },
2 => { 1 => \@v1, 2 => \@v2 }
);
$g->reduce(2, 1);
$g->reduce(1, 2);
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 (or payoffs) such that,
[ [ u1, u2 .. un] .. [ v1, v2 .. vn ] ]
Where each "ui" is a utility or payoff 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] }
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"
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.
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.