Exemplo n.º 1
0
def CPSD(game):
	"""
	conditional strict pure-strategy dominance criterion for IEDS

	The criterion is 'conditional' in that it will eliminate strategies that
	are dominated given all available data in a partial game.
	"""
	dominated = {r:set() for r in game.roles}
	for r in game.roles:
		for s1, s2 in RSG.product(game.strategies[r], repeat=2):
			if s1 == s2:
				continue
			for profile in game:
				v1 = v2 = float('-inf')
				try:
					v1 = game.getPayoff(profile, r, s1)
				except KeyError:
					continue
				try:
					v2 = game.getPayoff(profile.remove(r,s1).add(r,s2), r, s2)
				except KeyError:
					break
				if v1 >= v2:
					break
			if v1 < v2:
				dominated[r].add(s1)
	return game.subgame(strategies={r:set(game.strategies[r]) - dominated[r] \
			for r in game.roles})
Exemplo n.º 2
0
def PSD(game):
	"""
	confirmed strict pure-strategy dominance criterion for IEDS

	This criterion differs from CPSD in that it will only declare a strategy
	dominated if all profiles in which both it and the dominating strategy
	appear have payoff data available.
	"""
	dominated = {r:set() for r in game.roles}
	for r in game.roles:
		for s1, s2 in RSG.product(game.strategies[r], repeat=2):
			if s1 == s2:
				continue
			data_missing = False
			for profile in game:
				v1 = v2 = float('-inf')
				try:
					v1 = game.getPayoff(profile, r, s1)
					v2 = game.getPayoff(profile.remove(r,s1).add(r,s2), r, s2)
					if v1 >= v2:
						break
				except KeyError:
					data_missing = True
					break
			if v1 < v2 and not data_missing:
				dominated[r].add(s1)
	return game.subgame(strategies={r:set(game.strategies[r]) - dominated[r] \
			for r in game.roles})