diff --git a/Rl.py b/Rl.py index 8e320dfb49298ccbb5c07497089f64b74af96de4..f0ed8f1423c730bbc24d57d2446b9bc4edb317cc 100644 --- a/Rl.py +++ b/Rl.py @@ -214,3 +214,31 @@ def rewardG(appliable, config, action, missingLinks): return reward ################################################################################ +################################################################################ +def reward3G(appliable, config, action, missingLinks): + if appliable: + if action.name != "BACK" : + reward = -action.getOracleScore(config, missingLinks) + else : + back = action.size + canceledRewards = [h[3] for h in config.historyPop[-back:]] + reward = np.log(1-sum(canceledRewards)) if -sum(canceledRewards) > 0 else -1 + else: + reward = -forbiddenReward + return 3*reward +################################################################################ + +################################################################################ +def reward10G(appliable, config, action, missingLinks): + if appliable: + if action.name != "BACK" : + reward = -action.getOracleScore(config, missingLinks) + else : + back = action.size + canceledRewards = [h[3] for h in config.historyPop[-back:]] + reward = np.log(1-sum(canceledRewards)) if -sum(canceledRewards) > 0 else -1 + else: + reward = -forbiddenReward + return 10*reward +################################################################################ +