Skip to content
Extraits de code Groupes Projets
Valider 43bb83f0 rédigé par Adrien Payen's avatar Adrien Payen
Parcourir les fichiers

markovDecision running

parent 4fdf8e94
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -26,7 +26,7 @@ def markovDecision(layout, circle) : ...@@ -26,7 +26,7 @@ def markovDecision(layout, circle) :
vi_safe = np.sum(safe_dice[k] * ValueI) vi_safe = np.sum(safe_dice[k] * ValueI)
vi_normal = np.sum(normal_dice[k] * ValueI) + 0.5 * np.sum(normal_dice[k][jail]) vi_normal = np.sum(normal_dice[k] * ValueI) + 0.5 * np.sum(normal_dice[k][jail])
vi_risky = np.sum(risky_dice[k] * ValueI) + np.sum(normal_dice[k][jail]) # 100% chance of triggering the trap vi_risky = np.sum(risky_dice[k] * ValueI) + np.sum(normal_dice[k][jail]) # 100% chance of triggering the trap
ValueINew = 1 + min(vi_safe,vi_normal,vi_risky) ValueINew[k] = 1 + min(vi_safe,vi_normal,vi_risky)
if ValueINew[k] == 1 + vi_safe : if ValueINew[k] == 1 + vi_safe :
DiceForStates[k] = 1 DiceForStates[k] = 1
...@@ -44,6 +44,6 @@ def markovDecision(layout, circle) : ...@@ -44,6 +44,6 @@ def markovDecision(layout, circle) :
Expec = ValueI[:-1] Expec = ValueI[:-1]
return [Expec, DiceForStates] return [Expec, DiceForStates]
layout = [0,0,3,0,0,0,2,0,0,0,3,0,0,1,0] layout = [0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 1, 0]
print(markovDecision(layout, False)) print(markovDecision(layout, False))
print(markovDecision(layout, True)) print(markovDecision(layout, True))
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter