-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpbn_trajectories.m
More file actions
190 lines (183 loc) · 3.81 KB
/
pbn_trajectories.m
File metadata and controls
190 lines (183 loc) · 3.81 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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
%% Synchronization Test
clear all; clc;
t = 500; %time step duration
c_1 = .5; %switching probability between two F_1, F_2 if rand > c_l, F1
% 3 gene test case
n=3; %5th node extension
varF_1 = [1,1,1;2,2,2;3,3,3];
nv_1 = [3, 3, 3];
F_1 = [1,1,0;
1,1,0;
1,0,1;
1,1,1;
0,1,1;
0,0,1;
1,1,1;
0,0,0];
F_2 = [1,1,0;
0,1,0;
0,0,1;
1,1,1;
0,1,1;
0,0,1;
1,1,1;
1,0,0];
% synchronize
initState1 = [0, 1, 0];
initState2 = [1, 1, 1];
% do not synchronize
%initState1 = [0, 0, 0];
%initState2 = [1, 1, 1];
% % 5 gene test case
% n=5;
% varF_1 = [1,1,1,1,1;2,2,2,2,2;3,3,3,3,3;4,4,4,4,4;5,5,5,5,5];
% nv_1 = [5, 5, 5, 5, 5];
% F_1 = [1,1,0,0,1;
% 1,1,0,0,0;
% 1,0,1,1,1;
% 1,1,0,1,0;
% 1,1,1,0,0;
% 1,0,1,0,0;
% 1,1,0,1,1;
% 0,0,1,1,0;
% 0,1,0,0,1;
% 0,0,0,1,0;
% 0,0,0,1,0;
% 1,1,0,0,0;
% 1,0,1,0,0;
% 0,1,1,0,1;
% 0,1,1,0,0;
% 1,0,1,1,1;
% 1,1,0,0,1;
% 1,1,0,0,0;
% 1,0,1,1,1;
% 1,1,0,1,0;
% 0,1,0,0,0;
% 1,0,1,0,0;
% 1,1,1,0,1;
% 0,0,1,1,0;
% 0,1,1,0,1;
% 0,1,1,0,0;
% 0,0,0,1,0;
% 1,1,0,0,0;
% 1,0,0,1,0;
% 1,0,1,1,1;
% 1,1,0,0,1;
% 0,0,1,1,0];
% F_2 = [1,1,0,0,1;
% 1,1,0,0,0;
% 0,0,1,1,0;
% 1,0,0,1,1;
% 1,1,1,0,0;
% 1,0,1,0,0;
% 0,1,0,1,1;
% 1,0,1,1,0;
% 1,1,0,0,1;
% 1,0,0,0,0;
% 1,0,1,0,0;
% 1,1,0,0,0;
% 0,0,1,0,0;
% 0,1,1,0,1;
% 1,1,1,0,0;
% 0,0,1,1,0;
% 1,0,0,0,1;
% 0,0,0,0,0;
% 1,1,1,1,1;
% 0,1,0,1,0;
% 0,1,0,0,0;
% 1,0,1,0,0;
% 1,1,1,0,1;
% 0,0,1,1,0;
% 0,1,0,0,1;
% 0,1,1,0,0;
% 1,0,0,1,0;
% 1,1,0,1,0;
% 1,0,0,1,0;
% 0,0,1,1,1;
% 0,1,0,0,1;
% 1,0,1,1,1];
% initState1 = [1, 0, 1, 1, 0];
% initState2 = [1, 0, 0, 0, 0];
%% 2 point trajectories
trajec = zeros(2:1);
trajec(1,1) = bin2dec(num2str(initState1));
trajec(2,1) = bin2dec(num2str(initState2));
step1 = initState1;
step2 = initState2;
step1_dec = 0;
step2_dec = 0;
for i=1:t
if(rand > c_1)
step1 = bnNextState(step1,F_1,varF_1,nv_1);
step1_dec = bin2dec(num2str(step1));
step2 = bnNextState(step2,F_1,varF_1,nv_1);
step2_dec = bin2dec(num2str(step2));
else
step1 = bnNextState(step1,F_2,varF_1,nv_1);
step1_dec = bin2dec(num2str(step1));
step2 = bnNextState(step2,F_2,varF_1,nv_1);
step2_dec = bin2dec(num2str(step2));
end
trajec = [trajec, [step1_dec;step2_dec]];
end
plot(1:t+1,trajec);xlabel('Time Steps'); ylabel('States');
title('2-state Trajectories of Probabilistic Network Selection');
% %% PBN context
% p=0;
% cij = [1-c_1,1,1,1,1; c_1,-1,-1,-1,-1];
% varF = [1,1,1,1,1,1;2,2,2,2,2,2;3,3,3,3,3,3;4,4,4,4,4,4;5,5,5,5,5,5];
% F = [1,1,1,0,0,1;
% 1,1,1,0,0,0;
% 1,0,0,1,1,1;
% 1,1,1,0,1,0;
% 1,1,1,1,0,0;
% 1,1,0,1,0,0;
% 1,0,1,1,1,1;
% 0,1,0,1,1,0;
% 0,1,1,0,0,1;
% 0,1,0,0,0,0;
% 0,1,0,0,1,0;
% 1,1,1,0,0,0;
% 1,0,0,1,0,0;
% 0,0,1,1,0,1;
% 0,1,1,1,0,0;
% 1,0,0,1,1,1;
% 1,1,1,0,0,1;
% 1,0,1,0,0,0;
% 1,1,0,1,1,1;
% 1,0,1,0,1,0;
% 0,0,1,0,0,0;
% 1,1,0,1,0,0;
% 1,1,1,1,0,1;
% 0,0,0,1,1,0;
% 0,0,1,0,0,1;
% 0,0,1,1,0,0;
% 0,1,0,0,1,0;
% 1,1,1,0,0,0;
% 1,1,0,0,0,0;
% 1,0,0,1,0,1;
% 1,0,1,0,0,1;
% 0,1,0,1,1,0];
% nf = [ 2, 1, 1, 1, 1];
% nv = [5, 5, 5, 5, 5, 5];
% pbnA - state transition matrix of a PBN
% v - steady state distribution
%[A,v] = pbnA(F,varF,nf,nv,cij,0);
n=3; %5th node extension
nf = [ 2, 1, 1];
varF = [1,1,1,1;2,2,2,2;3,3,3,3];
cij = [1-c_1,1,1; c_1,-1,-1];
nv = [3, 3, 3, 3];
F = [1, 1, 1,0;
1, 0, 1,0;
1, 0, 0,1;
1, 1, 1,1;
0, 0, 1,1;
0, 0, 0,1;
1, 1, 1,1;
0, 1, 0,0];
bnA(F_1,varF_1,nv_1,0,'full')
bnA(F_2,varF_1,nv_1,0,'full')
[A,v] = pbnA(F,varF,nf,nv,cij,0);
A
v