-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbf_mvt_twopatch.m
47 lines (33 loc) · 981 Bytes
/
bf_mvt_twopatch.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
% bruteforce search best patch residents time for two patch types
close all;
clear all;
more off;
PATCH = [50 300];
PN = 2;
TAU = [10 50 100 500 1000 5000 10000 50000 100000 500000];
TN = 10;
prt = zeros(PN, TN);
maxRate = zeros(PN, TN);
collected = zeros(PN, TN);
patchA = load(sprintf('avgGainFct_%d.dat', PATCH(1) ) );
patchB = load(sprintf('avgGainFct_%d.dat', PATCH(2) ) );
[M N] = size(patchA.g);
time = 0.1:0.1:N/10;
maxRate = zeros(1,TN);
STEPSIZE = 10;
for a = 1:STEPSIZE:N
fprintf('processing prtA %f\n', a);
for b = 1:STEPSIZE:N
for t = 1:TN
rate = ( patchA.g(a) + patchB.g(b) ) / ( time(a) + time(b) + 2*TAU(t) );
if (rate > maxRate(t) )
maxRate(t) = rate;
prtA(t) = time(a);
prtB(t) = time(b);
collected(t) = patchA.g(b) + patchB.g(b);
end
end % for t
end % for b
end % a
filename = sprintf('bf_mvt_two_%d_%d.dat',PATCH(1), PATCH(2));
save(filename, "maxRate", "prtA", "prtB", "collected");