# How ca I calculate the dominance between two popultion?

조회 수: 3 (최근 30일)
Mira le . 2021년 5월 19일
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
THank you.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!