Beispiel #1
0
# Note: From this script the program can be run.
# You may change everything about this file.

from MatrixSuite import FixedMatrixSuite
import Strategies
import Game
from GrandTable import GrandTable
from ReplicatorDynamic import ReplicatorDynamic
import Nash

# Output some basic things to show how to call the classes.
matrix_suite = FixedMatrixSuite()
print(matrix_suite)
strategies = [Strategies.Aselect(), Strategies.Aselect(), Strategies.Aselect()]
print(strategies)
grand_table = GrandTable(matrix_suite, strategies, 9, 1000)
print(grand_table)

# Example of how to test a strategy:
matrix_suite = FixedMatrixSuite()  # Create a matrix suite

strat = Strategies.Aselect()  # Create the strategy you want to test.

strat.initialize(
    matrix_suite, "row"
)  # Initialise it with the game suite and as either "row" or "col" player.

action = strat.get_action(1)  # Get the next action
print("Strategy plays action:" + action.__repr__())

strat.update(1, action, 1.5,
Beispiel #2
0
import MatrixSuite
from MatrixSuite import FixedMatrixSuite
from MatrixSuite import RandomIntMatrixSuite
from MatrixSuite import RandomFloatMatrixSuite
import Strategies
from Strategies import Strategy
import Game
from GrandTable import GrandTable
from ReplicatorDynamic import ReplicatorDynamic, Proportions
import Nash
from typing import List
'''Setting up strategies and relative proportions'''

strategies = [
    Strategies.Aselect(),
    Strategies.EGreedy(),
    Strategies.UCB(),
    Strategies.Satisficing(),
    Strategies.Softmax(),
    Strategies.FictitiousPlay(),
    Strategies.Bully(),
    Strategies.ProportionalRegretMatching()
]
strategies_ext = [
    Strategies.Aselect(),
    Strategies.EGreedy(),
    Strategies.UCB(),
    Strategies.Satisficing(),
    Strategies.Softmax(),
    Strategies.FictitiousPlay(),