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 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by