-
Notifications
You must be signed in to change notification settings - Fork 0
/
setEVCSimParameters.m
72 lines (61 loc) · 2.52 KB
/
setEVCSimParameters.m
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function EVCSim = setEVCSimParameters(EVCSim, params, varargin)
import EVC.*;
import EVC.DDM.*;
if(isempty(varargin))
sim = [];
else
sim = varargin{1};
end
% set control efficacy
for i = 1:length(EVCSim.DDMProcesses)
if(EVCSim.DDMProcesses(i).input.type == DDMFnc.INTENSITY2DDM_EFFICACY)
EVCSim.DDMProcesses(i).input.params{4} = params.controlEfficacy;
end
end
% set control implementation cost
EVCSim.defaultCostFnc.params{1} = params.implementationCost;
% % set control reconfiguration cost
EVCSim.reconfCostFnc.params{1} = params.reconfigurationCost;
% set reward sensitivity
EVCSim.rewardFnc.params{3} = params.rewardSensitivity;
% set target response weight
if(isempty(sim))
for i = 1:length(EVCSim.trials)
EVCSim.trials(i).stimRespMap(2) = params.targetResponseWeight;
end
else
switch sim
case 'task switching'
EVCSim.trials(1).stimRespMap(1) = params.targetResponseWeight;
EVCSim.trials(2).stimRespMap(1) = params.targetResponseWeight;
EVCSim.trials(3).stimRespMap(4) = params.targetResponseWeight;
EVCSim.trials(4).stimRespMap(4) = params.targetResponseWeight;
case 'COGED'
EVCSim.trials(1).stimRespMap(1) = params.targetResponseWeight;
EVCSim.trials(2).stimRespMap(end) = params.targetResponseWeight;
end
end
% set learning rate
EVCSim.learningFnc(1).params{1} = params.learningRate;
% set expected task difficulty
if(isfield(params, 'expectedTaskDifficulty'))
temp.noiseFnc.type = DDMFnc.ACTUAL_EXPECTED;
temp.noiseFnc.params{1} = EVCSim.defaultDDMParams.c;
temp.noiseFnc.params{2} = EVCSim.defaultDDMParams.c * params.expectedTaskDifficulty;
temp.noiseFnc = DDMFnc(temp.noiseFnc.type, ...
temp.noiseFnc.params);
temp.noiseProcess = DDMProc(DDMProc.ACTUAL_EXPECTED, ... % default controlled DDM process
DDMProc.NOISE, ...
temp.noiseFnc);
EVCSim.DDMProcesses(end+1) = temp.noiseProcess;
end
% diminished utility
if(isfield(params, 'diminishedUtility') && isfield(params, 'utilityScalar'))
EVCSim.rewardFnc.type = EVCFnc.REWRATE_LOGVAL;
EVCSim.rewardFnc.params{3} = params.utilityScalar;
EVCSim.rewardFnc.params{4} = params.diminishedUtility;
end
if(isfield(params, 'rewardMagnitude'))
EVCSim.rewardFnc.params{4} = EVCSim.rewardFnc.params{4} * params.rewardMagnitude;
end
end