📄 tdmaweights_nonlin.m
字号:
%% function [util,f,w,e] = TDMAweights_nonlin(B,rates)%% Arguments:% B - routing matrix% rates - rates of links in different slots%% Output:% util - optimal utility% f - rates of flows% w - weigths (durations) of slots% e - e != 0 if error (see fmincon).%% Description:%% find weights that maximizes utility fairness% we have the following system:%% max sum u(f_i)% subj. B*f <= x% x = R * w%% that is B*f - R*w <= 0, or [B|-R]*[f/x] <= 0%% NOTE: Does not work well, since we use non-linear optimization.% To use a linear approximation instead, see TDMAweights.m%function [util,f,w,e] = TDMAweights_nonlin(B,rates)l = size(rates,1);m = size(rates,2);nf = size(B,2);w0 = [zeros(nf,1);ones(m,1)/m];Ae = [zeros(1,nf),ones(1,m)];be = 1;A = [B, -rates];A = [A;zeros(m,nf),diag(-ones(m,1))];b = zeros(l+m,1);lb = zeros(m+nf,1);ub = [];options = optimset;options.GradObj = 'on';options.Hessian = 'off';options.LargeScale = 'off';options.MaxFunEvals = 1e5;options.Display = 'off';[w,util,e] = fmincon(@maxrouting,w0,A,b,Ae,be,lb,ub,[],options,m,nf);f = w(1:nf);w = w(nf+1:nf+m);if e <= 0 % There was an error C' netsize D'endutil = - util;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -