def __init__(self, game): Strategy.__init__(self) self.__LastState = -999 self.__LastAction = -999 self.__CurrentState = -999 self.__CurrentAction = -999 self._lambda = Lambda(BoydRLQTableI.__CoopRatio) self.initialQ(game) # initialise the Q-Table with the formulas BoydRLQTableI.__Counter = 0 self.__ExplorePercentage = 5.0 # for epsilon-greedy BoydRLQTableI.__LastLambda = BoydRLQTableI.__CoopRatio
def __init__(self, game): Strategy.__init__(self) self._lambda = Lambda(0.1) self.myCtr = 0 # counting my cooperation times self.oppCtr = 0 # counting the opponent's cooperation times
def __init__(self, game): Strategy.__init__(self) self._lambda = Lambda(random.random()) # random initialisation for the lambda
def __init__(self, game): Strategy.__init__(self) self.__LastState = -999 self.__LastAction = -999 self.__CurrentState = -999 self.__CurrentAction = -999 BoydRLQTableIPlus.__gamma = game.Lambda_global gammaSwitch = int(BoydRLQTableIPlus.__gamma * 10) if gammaSwitch == 0: BoydRLQTableIPlus.__CoopRatio = 0.0 BoydRLQTableIPlus.__learningRate = 0.0 BoydRLQTableIPlus.__discountFactor = 0.0 BoydRLQTableIPlus.__ccLambdaA = 0.0 BoydRLQTableIPlus.__ccLambdaB = 4.0 BoydRLQTableIPlus.__cdLambda = 4.0 BoydRLQTableIPlus.__dcLambda = 10.0 BoydRLQTableIPlus.__ddLambda = 10.0 elif gammaSwitch == 2: BoydRLQTableIPlus.__CoopRatio = 0.0 BoydRLQTableIPlus.__learningRate = 0.5 BoydRLQTableIPlus.__discountFactor = 0.0 BoydRLQTableIPlus.__ccLambdaA = 4.0 BoydRLQTableIPlus.__ccLambdaB = 0.0 BoydRLQTableIPlus.__cdLambda = 0.0 BoydRLQTableIPlus.__dcLambda = 10.0 BoydRLQTableIPlus.__ddLambda = 10.0 elif gammaSwitch == 4: BoydRLQTableIPlus.__CoopRatio = 0.5 BoydRLQTableIPlus.__learningRate = 1.0 BoydRLQTableIPlus.__discountFactor = 0.5 BoydRLQTableIPlus.__ccLambdaA = 10.0 BoydRLQTableIPlus.__ccLambdaB = 4.0 BoydRLQTableIPlus.__cdLambda = 0.0 BoydRLQTableIPlus.__dcLambda = 0.0 BoydRLQTableIPlus.__ddLambda = 10.0 elif gammaSwitch == 6: BoydRLQTableIPlus.__CoopRatio = 0.5 BoydRLQTableIPlus.__learningRate = 0.5 BoydRLQTableIPlus.__discountFactor = 0.5 BoydRLQTableIPlus.__ccLambdaA = 2.0 BoydRLQTableIPlus.__ccLambdaB = 2.0 BoydRLQTableIPlus.__cdLambda = 4.0 BoydRLQTableIPlus.__dcLambda = 0.0 BoydRLQTableIPlus.__ddLambda = 0.0 elif gammaSwitch == 8: BoydRLQTableIPlus.__CoopRatio = 1.0 BoydRLQTableIPlus.__learningRate = 1.0 BoydRLQTableIPlus.__discountFactor = 1.0 BoydRLQTableIPlus.__ccLambdaA = 10.0 BoydRLQTableIPlus.__ccLambdaB = 4.0 BoydRLQTableIPlus.__cdLambda = 10.0 BoydRLQTableIPlus.__dcLambda = 0.0 BoydRLQTableIPlus.__ddLambda = 0.0 elif gammaSwitch == 10: BoydRLQTableIPlus.__CoopRatio = 1.0 BoydRLQTableIPlus.__learningRate = 1.0 BoydRLQTableIPlus.__discountFactor = 0.0 BoydRLQTableIPlus.__ccLambdaA = 10.0 BoydRLQTableIPlus.__ccLambdaB = 8.0 BoydRLQTableIPlus.__cdLambda = 0.0 BoydRLQTableIPlus.__dcLambda = 0.0 BoydRLQTableIPlus.__ddLambda = 4.0 self._lambda = Lambda(BoydRLQTableIPlus.__CoopRatio) self.initialQ(game) # initialise the Qtable BoydRLQTableIPlus.__Counter = 0 self.__ExplorePercentage = 0.0 # for epsilon-greedy, epsilon = 0 BoydRLQTableIPlus.__LastLambda = BoydRLQTableIPlus.__CoopRatio
def __init__(self, game): Strategy.__init__(self) self._lambda = Lambda(0.0)