In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
In [42]:
def expected_payoff(A, x, y):
return np.dot(np.dot(x.T, A), y)
def value_of_strategy(A, x):
return np.min(x.T @ A)
In [45]:
A = np.array([[-1, -1, -1],
[ 1, -5, -5],
[ 1, 5, 10]])
x = np.array([0, 0, 1])
y = np.array([1, 0, 0])
print('Expected Payoff to Player R is: {}'.format(expected_payoff(A, x, y)))
print('Value of using Strategy x: {}'.format(value_of_strategy(A, x)))
x.T @ A
Out[45]:
In [21]:
A = np.array([[10, -5, 5],
[ 1, 1, -1],
[ 0,-10, -5]])
x = np.array([0, 1, 0])
y = np.array([0, 1, 0])
print('Expected Payoff to Player R is: {}'.format(expected_payoff(A, x, y)))
In [22]:
A = np.array([[10, -5, 5],
[ 1, 1, -1],
[ 0,-10, -5]])
x = np.array([0, 1, 0])
y = np.array([0, 1, 0])
x.T @ A
Out[22]:
In [39]:
A = np.array([[10, -5, 5],
[ 1, 1, -1],
[ 0,-10, -5]])
x = np.array([.2, .6, .2])
y = np.array([0, 0, 1])
# print('Expected Payoff to Player R is: {}'.format(expected_payoff(A, x, y)))
x.T @ A
Out[39]:
In [43]:
A = np.array([[10, -5, 5],
[ 1, 1, -1],
[ 0,-10, -5]])
x = np.array([.2, .6, .2])
y = np.array([0, 0, 1])
# print('Expected Payoff to Player R is: {}'.format(expected_payoff(A, x, y)))
x.T @ A
print('Value of using Strategy x: {}'.format(value_of_strategy(A, x)))
In [44]:
A = np.array([[10, -5, 5],
[ 1, 1, -1],
[ 0,-10, -5]])
x = np.array([0, 1, 0])
y = np.array([0, 0, 1])
# print('Expected Payoff to Player R is: {}'.format(expected_payoff(A, x, y)))
x.T @ A
print('Value of using Strategy x: {}'.format(value_of_strategy(A, x)))
In [ ]: