# MAPLE. Sept. 24, 2007 # # Given a payoff matrix A, use MAPLE's simplex method to # find the value of the corr. 2-player game. # # Usage: # Define a payoff matrix A: # A := Matrix(2,3,[ 1, 2, -2, -1, -3, 4]); # read game; with(simplex): m := LinearAlgebra[RowDimension](A): n := LinearAlgebra[ColumnDimension](A): con := { add(y||i, i=1..m) = 1 }: for j to n do con := con union { add(A[i,j]*(y||i), i=1..m) - v1 <= 0 }; od: con := con union { seq( y||i >= 0, i=1..m) }: print(` Value v1 and optimal strategy y for the row player:`); minimize( v1, con); con := { add(x||j, j=1..n) = 1 }: for i to m do con := con union { add(-A[i,j]*(x||j), j=1..n) - v2 <= 0 }; od: con := con union { seq( x||j >= 0, j=1..n) }: print(` Value v2 and optimal strategy x for the column player:`); minimize( v2, con);