# How ca I calculate the dominance between two popultion?

2 ビュー (過去 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.

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!