-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsimVendingFull.m
51 lines (42 loc) · 1.41 KB
/
simVendingFull.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
function [ dat ] = simVendingFull( nExamples, nConfusion )
%SYNTHESIZEDAT
%
% T-AOG
% S -> A1 | A2 | A3
% A1 -> a11 a12 a13 ... -> VEND A
% A2 -> a21 a22 a23 ... -> VEND B
% A3 -> a31 a32 a33 ... -> VEND C
%nExamples = 2;
%nConfusion = 1;
% nSnacks = 3;
% arrive
arrive_block = [1];
% pay (yes, no)
pay_block = [1; 0];
% push letter (a b c d e f null)
letter_block = [eye(6); zeros(1,6)];
% push number (0 ... 9 null)
number_block = [eye(10); zeros(1,10)];
% get snack (0 null)
snack_block = [1; 0];
% leave
leave_block = [1];
% generate one run of each action combination in the AOG for the vending
dat_so_far = arrive_block;
dat_so_far = addBlock(pay_block, dat_so_far);
dat_so_far = addBlock(letter_block, dat_so_far);
dat_so_far = addBlock(number_block, dat_so_far);
dat_so_far = addBlock(snack_block, dat_so_far);
dat_so_far = addBlock(leave_block, dat_so_far);
% vend chocolate: (if money & d & 1)
% faking this -- call it money & a & 0 -- indices 2 3 9
dat = dat_so_far;
dat = [(dat(:,2) & dat(:,3) & dat(:,9)) dat];
dat = [dat dat(:,1)]; % index 22 is correct cause
% add replicates
dat = repmat(dat,[nExamples 1]);
% add confusing actions -- occur approximately 30 times each replicate
confusion = (rand(size(dat,1),nConfusion) <= 30/308); %sum(confusion)
dat = [dat confusion];
% add "previous" fluent on
dat = [dat zeros(size(dat(:,1)))];