fastest_mixing_mc.m
来自「斯坦福大学Grant和Boyd教授等开发的凸优化matlab工具箱」· M 代码 · 共 35 行
M
35 行
% Section 4.6.3: Find the fastest mixing Markov chain on a graph% Boyd & Vandenberghe "Convex Optimization"% Jo雔le Skaf - 09/26/05%% The 'fastest mixing Markov chain problem' is to find a transition% probability matrix P on a graph E that minimizes the mixing rate r, where% r = max{ lambda_2, -lambda_n } with lambda_1>=...>=lambda_n being the% eigenvalues of P.% Generate input datan = 5;E = [0 1 0 1 1; ... 1 0 1 0 1; ... 0 1 0 1 1; ... 1 0 1 0 1; ... 1 1 1 1 0];% Create and solve modelcvx_begin variable P(n,n) symmetric minimize(norm(P - (1/n)*ones(n))) P*ones(n,1) == ones(n,1); P >= 0; P(E==0) == 0;cvx_ende = flipud(eig(P));r = max(e(2), -e(n));% Display resultsdisp('------------------------------------------------------------------------');disp('The transition probability matrix of the optimal Markov chain is: ');disp(P);disp('The optimal mixing rate is: ');disp(r);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?