[問題]如何提升運算效能 已回收
想請教一下
要利用下面的程式 解一個七維的Markov Chain
但是由於StateSpace很大 超過50000*7
所以就算用了16G的RAM與64bit的Win7 還是跑了快兩天都還卡在那個for迴圈
有辦法可以縮短執行時間,改善速度嗎??
謝謝。
[row, col] = size(StateSpace);
A = sparse(row+1, row);A(row+1) = 1;
for (index = 1:row) % traverse all state
currentState = StateSpace(index,:);
i = currentState(1);
j = currentState(2);
k = currentState(3);
l = currentState(4);
m = currentState(5);
p = currentState(6);
q = currentState(7);
Tmp = [i,j,k,l,m,p,q];
allocatedResource = dot(Tmp,BW);
% according to different state, calculate all balance equation.
if (allocatedResource <= C)
A(index,:) = balEquation2(i,j,k,l,m,p,q,lambda,mu,C);
end
end
Y = zeros(row+1,1);
Y(row+1) = 1;
X = A\Y; % find stedy stete solution
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 124.11.188.145
→
07/08 01:34, , 1F
07/08 01:34, 1F
推
07/08 09:58, , 2F
07/08 09:58, 2F
推
07/08 21:53, , 3F
07/08 21:53, 3F
→
07/09 23:00, , 4F
07/09 23:00, 4F
推
07/10 06:00, , 5F
07/10 06:00, 5F