From 67b8b07c953e019c6e97f9ddb3016a4f71bd9b4d Mon Sep 17 00:00:00 2001
From: "maxime.petit" <maxime.petit@sms.liscluster>
Date: Wed, 26 May 2021 14:58:26 +0200
Subject: [PATCH] Fixed reward funcs

---
 Rl.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Rl.py b/Rl.py
index 1596f3b..8641f6c 100644
--- a/Rl.py
+++ b/Rl.py
@@ -101,7 +101,7 @@ def rewardB(appliable, config, action, missingLinks):
     if "BACK" not in action.name :
       reward = 1.0 - action.getOracleScore(config, missingLinks)
     else :
-      back = int(action.name.split()[-1])
+      back = action.size
       error_in_pop = [i for i in range(1,back) if config.historyPop[-i][3] < 0]
       last_error = error_in_pop[-1] if len(error_in_pop) > 0 else 0
       reward = last_error - back
@@ -116,7 +116,7 @@ def rewardC(appliable, config, action, missingLinks):
     if "BACK" not in action.name :
       reward = -action.getOracleScore(config, missingLinks)
     else :
-      back = int(action.name.split()[-1])
+      back = action.size
       error_in_pop = [i for i in range(1,back) if config.historyPop[-i][3] < 0]
       canceledRewards = [h[3] for h in config.historyPop[-back:]]
       reward = -sum(canceledRewards)
@@ -131,7 +131,7 @@ def rewardD(appliable, config, action, missingLinks):
     if "BACK" not in action.name :
       reward = -action.getOracleScore(config, missingLinks)
     else :
-      back = int(action.name.split()[-1])
+      back = action.size
       error_in_pop = [i for i in range(1,back) if config.historyPop[-i][3] < 0]
       canceledRewards = [h[3] for h in config.historyPop[-back:]]
       reward = -sum(canceledRewards) - 1
-- 
GitLab