Пример #1
0
 def test_two(self):
     a = np.array([  #mixed strategies
         [10, 30],
         [40, 20]])
     val = 25.0
     vect1 = [0.5, 0.5]
     vect2 = [0.25, 0.75]
     game_p, v1, v2 = nash_equilibrium(a)
     self.assertTrue(check_matrix(game_p,v1,v2,val,vect1,vect2))
Пример #2
0
def fourth_test():
    a = np.array([  #with saddle point
        [2, 7, 2], [2, 3, 2], [2, 1, 8]
    ])
    val = 2
    vect1 = [1]
    vect2 = [0]
    game_p, v1, v2 = nash_equilibrium(a)
    return check_matrix(game_p, v1, v2, val, vect1, vect2)
Пример #3
0
def third_test():
    a = np.array([  #with saddle point
        [3, 9, 2, 1], [7, 8, 5, 6], [4, 7, 3, 5], [5, 6, 1, 7]
    ])
    val = 5
    vect1 = [1]
    vect2 = [2]
    game_p, v1, v2 = nash_equilibrium(a)
    return check_matrix(game_p, v1, v2, val, vect1, vect2)
Пример #4
0
def second_test():
    a = np.array([  #mixed strategies
        [10, 30], [40, 20]
    ])
    val = 25.0
    vect1 = [0.5, 0.5]
    vect2 = [0.25, 0.75]
    game_p, v1, v2 = nash_equilibrium(a)
    return check_matrix(game_p, v1, v2, val, vect1, vect2)
Пример #5
0
 def test_four(self):
     a = np.array([   #with saddle point
         [2,7,2],
         [2,3,2],
         [2,1,8]])
     val = 2
     vect1 = [1]
     vect2 = [0]
     game_p, v1, v2 = nash_equilibrium(a)
     self.assertTrue(check_matrix(game_p, v1, v2, val, vect1, vect2))
Пример #6
0
def first_test():
    a = np.array([  #mixed strategies
        [4, 0, 6, 2, 2, 1], [3, 8, 4, 10, 4, 4], [1, 2, 6, 5, 0, 0],
        [6, 6, 4, 4, 10, 3], [10, 4, 6, 4, 0, 9], [10, 7, 0, 7, 9, 8]
    ])
    vect1 = [0.0, 0.12, 0.09, 0.43, 0.33, 0.0]
    vect2 = [0.0, 0.0, 0.69, 0.14, 0.14, 0.01]
    val = 4.87
    game_p, v1, v2 = nash_equilibrium(a)
    return check_matrix(game_p, v1, v2, val, vect1, vect2)
Пример #7
0
 def test_three(self):
     a = np.array([ #with saddle point
         [3,9,2,1],
         [7,8,5,6],
         [4,7,3,5],
         [5,6,1,7]])
     val = 5
     vect1 = [1]
     vect2 = [2]
     game_p, v1, v2 = nash_equilibrium(a)
     self.assertTrue(check_matrix(game_p,v1,v2,val,vect1,vect2))