How ca I calculate the dominance between two popultion?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello every one ,
I have a problem and I want to solve it, so
I have two population pop and Pool type struct
pop: Position []
Cost []
Pool:
pop has value in both field
example
pop(1): [123, 0 , 1000, 52, 54, 200]
[0 4 0 210]
note Cost has always 4 values
and the size of Position is fixed (100)
I want to compare each line from pop with Pool by using Dominance concept
at the first time Pool is empty
for s=1:N
if ~isempty(Pool)
for c=1:numel(Pool)
if ~Dominates(pop(s),Pool(c))
pop(s).IsDominated=true;
Pool(c)=[];
Pool=[Pool pop(s)];
end
end
else
Pool=[Pool pop(s)];
end
end
I try this code but ir doesn't work, an arror appear
Error using <=
Matrix dimensions must agree.
Error in Dominates (line 24)
b=all(x<=y) && any(x<y);
The dominates function is as follow:
function b=Dominates(x,y)
if isstruct(x)
x=x.Cost;
end
if isstruct(y)
y=y.Cost;
end
b=all(x<=y) && any(x<y);
end
Please help me
THank you.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!