从奇偶校验矩阵

时间:2017-03-16 20:50:49

标签: matlab matrix optimization constraints nonlinear-optimization

晚上好,

这次我的问题涉及通过线性规划获得LDPC矩阵的度分布,在以下陈述中:

enter image description here

我的代码如下:

function [v] = LP_Irr_LDPC(k,Ebn0)

options = optimoptions('fmincon','Display','iter','Algorithm','interior-point','MaxIter', 4000, 'MaxFunEvals', 70000);
fun = @(v) -sum(v(1:k)./(1:k));

A = [];
b = [];
Aeq = [0, ones(1,k-1)];
beq = 1;
lb = zeros(1,k);
ub = [0, ones(1,k-1)];
nonlcon = @(v)DensEv_SP(v,Ebn0);
l0 = [0 rand(1,k-1)];
l0 = l0./sum(l0);

v = fmincon(fun,l0,A,b,Aeq,beq,lb,ub,nonlcon,options)
end

非线性约束的定义:

function [c, ceq] = DensEv_SP(v,Ebn0)

% It is also needed to modify this function, as you cannot pass parameters from others to it. 

h = [0 rand(1,19)];
h = h./sum(h); % This is where h comes from

syms x;
X = x.^(0:(length(h)-1));
R = h*transpose(X);

ebn0 = 10^(Ebn0/10);
Rm = 1;
LLR = (-50:50);
p03 = 0.3;
LLR03 = log((1-p03)/p03);
r03 = 1 - p03;
noise03 = (2*r03*Rm*ebn0)^-1;
pf03 = normpdf(LLR, LLR03, noise03);
sumpf03 = sum(pf03(1:length(pf03)/2));

divisions = 100;

Aj = zeros(1, divisions);
rho = zeros(1, divisions);
xj = zeros(1, divisions);
k = 10; % Length(v) -> Same value as in 'Complete.m'

for j=1:1:divisions
    xj(j) = sumpf03*j/divisions;
    rho(j) = subs(R,x,1-xj(j));
    Aj(j) = 1 - rho(j);
end

c = zeros(1, length(xj));
lambda = zeros(1, length(Aj));
for j = 1:1:length(xj)
    lambda(j) = sum(v(2:k).*(Aj(j).^(1:(k-1))));
    c(j) = sumpf03*lambda(j) - xj(j);
end

save Almacen
ceq = [];
%ceq = sum(v)-1;
end

此问题与发布here的问题相关联。我的问题是,我需要来自此优化问题的向量vh中的每个元素分别是x/Nx/(N(1-r)的一小部分。

如何在不失去收敛能力的情况下确保条件?

非常感谢提前和最好的问候。

1 个答案:

答案 0 :(得分:0)

我在函数h中想出了一个可能的解决方案,至少对于向量DensEv_SP

function [c, ceq] = DensEv_SP(v,Ebn0)

% It is also needed to modify this function, as you cannot pass parameters from others to it. 

k = 10; % Same as in Complete.m, desired sum of h
M = 19; % Number of integers
h = [0 diff([0,sort(randperm(k+M-1,M-1)),k+M])-ones(1,M)];

h = h./sum(h);

syms x;
X = x.^(0:(length(h)-1));
R = h*transpose(X);

ebn0 = 10^(Ebn0/10);
Rm = 1;
LLR = (-50:50);
p03 = 0.3;
LLR03 = log((1-p03)/p03);
r03 = 1 - p03;
noise03 = (2*r03*Rm*ebn0)^-1;
pf03 = normpdf(LLR, LLR03, noise03);
sumpf03 = sum(pf03(1:length(pf03)/2));

divisions = 100;

Aj = zeros(1, divisions);
rho = zeros(1, divisions);
xj = zeros(1, divisions);
N = 20; % Length(v) -> Same value as in 'Complete.m'

for j=1:1:divisions
    xj(j) = sumpf03*j/divisions;
    rho(j) = subs(R,x,1-xj(j));
    Aj(j) = 1 - rho(j);
end

c = zeros(1, length(xj));
lambda = zeros(1, length(Aj));
for j = 1:1:length(xj)
    lambda(j) = sum(v(2:k).*(Aj(j).^(1:(k-1))));
    c(j) = sumpf03*lambda(j) - xj(j);
end

save Almacen
ceq = (N*v)-floor(N*v);
%ceq = sum(v)-1;
end

如上所述,向量h不再存在任何问题;然而,我定义ceq值的方式似乎不足以使优化工作(v的问题根本没有减少)。有人知道如何找到解决方案吗?

非常感谢提前和最好的问候。