以下代码输出的结果为空,我想知道为什么
function P = solvepareto(n1, n2, completionTimes, weights1, weights2, deadlines1, deadlines2)
% 初始化 P
P = cell(n1 + 1, n2 + 1, n1 + n2 + 1); % 使用 cell array 存储 P(ia, ib, u)
% 初始化 P(0,0,0)
P{1, 1, 1} = {[0, 0]};
% 不需要初始化无效情况,在recursion步骤中直接忽略
% 循环遍历所有可能的 i_a, i_b, u
for u = 1:n1+n2+1
for ib = 1:n2+1
for ia = 1:n1+1
% 步骤1: 初始化(每次都要初始化为空 cell)
widetildeP1 = {};
widetildeP2 = {};
widetildeP3 = {};
widetildeP4 = {};
%步骤2:agent A 的有效工件
if (ia > 1) && (ia + ib - 2 >= max(1, u-1))
for k = 1:length(P{ia-1,ib,u})
x = P{ia-1,ib,u}{k};
if completionTimes(ia + ib - u - 1) <= deadlines1(ia-1)
widetildeP1{end+1} = x; % 使用 cell 的追加函数
end
end
end
%步骤3:agent A 的无效工件
if (ia > 1) && (u > 1) && (ia + ib - 2 >= max(1, u-1))
for k = 1:length(P{ia-1, ib, u-1})
x = P{ia-1, ib, u-1}{k};
widetildeP2{end+1} = {[x(1) + weights1(ia-1), x(2)]};
end
end
%步骤4:agent B 的有效工件
if (ib > 1) && (ia + ib - 2 >= max(1, u-1))
for k = 1:length(P{ia, ib-1, u})
x = P{ia, ib-1, u}{k};
if completionTimes(ia + ib - u - 1) <= deadlines2(ib-1)
widetildeP3{end+1} = x;
end
end
end
%步骤5:agent B 的无效工件
if (ib > 1) && (u > 1) && (ia + ib - 2 >= max(1, u-1))
for k = 1:length(P{ia, ib-1, u-1})
x = P{ia, ib-1, u-1}{k};
widetildeP4{end+1} = {[x(1), x(2) + weights2(ib-1)]};
end
end
P{ia,ib,u} = [widetildeP1,widetildeP2, widetildeP3, widetildeP4];
end
end
end
% 合并
Q={};
for i = 1:n1+n2+1
Q{end+1}=P{n1+1,n2+1,i};
end
end