Question

I am trying to obtain the pareto optimal front for the two fitness functions. I sorted the undominated solutions by using a dummy matrix that allocated "ones" in the matrix for any undominated solution. When I plot the pareto front it keeps including points that I know are not part of the pareto optimal. However, I cannot seem to find the cause of this problem. Any help would be really appreciated.

for  i = 1:1000
    f1(i) = x(i,1)^2;
    f2(i) = (x(i,1)-2)^2;
end
store = zeros(1000,1);
for i = 1:1000
    st = zeros(1000,1);
    for j = 1:1000
        if i == j
            st(j) = 1;                         
            continue;                           %Skip to next iteration.
        end
        if f1(i) > f1(j) && f2(i) > f2(j);      %Check for "x-dominated"
           continue;
        else st(j) = 1;                         %Dummy 1000x1 matrix
        end
    end
    if st == ones(1000,1)                       %Testing the dummy matrix for dominance
       store(i) = x(i);
    end
end

pareto = store(store ~= 0);                     
N = length(pareto);
for k = 1:N
    f3(k) = x(k,1)^2;
    f4(k) = (x(k,1)-2)^2;
end

enter image description here

Was it helpful?

Solution

Not really sure what you did, but this is how I would draw the pareto front with finite points. I think this should get you on track:

t=1:10;
f1 = t.^2;
f2 = (t-2).^2;

ip = true(size(f1));

for k=1:numel(f1)
    if any(f1<f1(k)&(f2<f2(k)))
        ip(k) = false;
    end
end

plot(f1,f2)
hold all
plot(f1(ip),f2(ip),'ro')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top