我需要在 d 维度空间中生成(在matlab中) L 点,这必须满足集合中任意两点之间的距离 D (定义如下)高于某个给定的阈值 r 。
集合 D = {L 联盟 L的组合} 。 L的其他各种组合作为其平均值生成。例如,点1,5,6的组合被生成为(point_1 + point_5 + point_6)/ 3,类似地,组合1,2,5,6被生成为(point_1 + point_2 + point_5 + point_6)/ 4。
一般情况下, D 集合将具有$ \ sum_ {i = 1} ^ {L} L C_ {i} $ points。
答案 0 :(得分:1)
我制作了一个代码(我认为)做你解释的,告诉我你的想法。
nL=6;
d=2;
r=0.1;
L=rand(d,nL); %%% generate nL random d-dimentional points
Lfinal=[];
for nn=1:nL %% for all passible size of subset of (1:nL)
sets=nchoosek(1:nL,nn); %% all sub-set of 1:nL of size nn
Ls=reshape(L(:,sets'),d,nn,[]); %% the corresponding Ls
newL=squeeze(sum(Ls,2))/nn; %% their sums
Lfinal=[Lfinal newL]; %% concatante to the final set of Ls.
end
L=Lfinal;
dists=pdist2(L',L'); %%% compute the distances between each point
dists(dists==0)=inf; %%% fill the diagonal with infinity to not use the distance between a point and it self
L=L*r/min(dists(:)); %%% multiply the points by "r/min(dists(:))" to make sure all points are at leat at distance r
L