-
Notifications
You must be signed in to change notification settings - Fork 0
/
respondent.asv
65 lines (57 loc) · 1.66 KB
/
respondent.asv
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
classdef respondent
properties
BYO
partworth
musthave
unaccept
revealedMusthave
revealedUnaccept
surveyquestions
surveyresponses
surveydata
tournament
end
methods
function decision=evaluate(obj, qlevels,numAttributes,numProfiles)
for i=1:numProfiles
decision(1,i)=1;
for j=1:numAttributes
if obj.musthave(j,1)~=0 %%check that musthave are observed
if qlevels(j,i)==obj.musthave(j,1)
decision(1,i)=1*decision(1,i);
else
decision(1,i)=0;
end
end
end
for j=1:numAttributes
if obj.unaccept(j,1)~=0 %%check that unacceptable are observed
if qlevels(j,i)~=obj.unaccept(j,1)
decision(1,i)=1*decision(1,i);
else
decision(1,i)=0;
end
end
end
end
end
function obj=processChoices(obj,numAttributes,numProfiles,firstquestion,lastquestion)
for currentquestion=firstquestion:lastquestion
for i=1:numProfiles
for j=1:numAttributes
if obj.surveydata((currentquestion-1)*numAttributes+j,2+numProfiles+i)==1
if obj.musthave(j,1)==obj.surveydata((currentquestion-1)*numAttributes+j,i)
obj.revealedMusthave(j,1)=obj.musthave(j,1);
end
end
if obj.surveydata((currentquestion-1)*numAttributes+j,2+numProfiles+i)==0
if obj.unaccept(j,1)==obj.surveydata((currentquestion-1)*numAttributes+j,i)
obj.revealedUnaccept(j,1)=obj.unaccept(j,1);
end
end
end
end
end
end
end
end