-
Notifications
You must be signed in to change notification settings - Fork 142
/
reward.lua
26 lines (23 loc) · 1.12 KB
/
reward.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- Object representing a received reward.
local Reward = {}
Reward.__index = Reward
-- scoreDiffReward = reward from score changes between states
-- xDiffReward = reward from Mario moving to the right
-- levelBeatenReward = reward from finishing the level or Mario dying
-- expectedGammaReward = discounted Q-value reward
-- expectedGammaRewardRaw = undiscounted Q-value reward
-- observedGammaReward = received direct rewards from future states, cascaded backwards (and discounted)
function Reward.new(scoreDiffReward, xDiffReward, levelBeatenReward, expectedGammaReward, expectedGammaRewardRaw, observedGammaReward)
local self = setmetatable({}, Reward)
self.scoreDiffReward = scoreDiffReward
self.xDiffReward = xDiffReward
self.levelBeatenReward = levelBeatenReward
self.expectedGammaReward = expectedGammaReward
self.expectedGammaRewardRaw = expectedGammaRewardRaw
self.observedGammaReward = observedGammaReward or 0
return self
end
-- Objects here have no members functions, because those seemed to be gone
-- after torch.save() and then torch.load().
-- See rewards.lua for some functions.
return Reward