-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAgent.m
More file actions
33 lines (30 loc) · 1.07 KB
/
Copy pathAgent.m
File metadata and controls
33 lines (30 loc) · 1.07 KB
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
27
28
29
30
31
32
33
classdef Agent < handle
properties(SetAccess = private)
% These can be modified only by class methods
slotModels = zeros(1,numSlotMachines);
pastReward = 0; % Records the rewards obtained till Last Step
numSlotMachines = 10; %Initial random integer value
end %properties
methods
% Constructor
function AG = Agent(numArms, rewards)
AG.numSlotMachines = numArms; %Modify as per question
AG.slotModels = zeros(1,numArms);
AG.pastReward = rewards;
end
% Arm-Selector
function arm = agentArmSelect(obj,k,oldReward)
obj.pastReward = oldReward;
%random choice of arm
arm = randi(obj.numSlotMachines);
end
function agentArmUpdate(obj,arm,newReward)
response = newReward - obj.pastReward;
if response >0:
% the given arm obtained 1$ as output
else
% the given arm obtained 0$ as output
end
end
end %methods
end %classdef