Code covered by the BSD License

# Level Diagrams for multiobjective decision making and Design Concepts Comparison

### Gilberto Reynoso-Meza (view profile)

A tool to draw Leveldiagrams, with utilities for decision making and design concepts comparison.

sPareto6.m
function lg=sPareto6(lg)
% Function for sPareto representation
%  lg=sPareto6(lg)
%  lg : structure with data for layer graph representation
%       (see 'buildlgstruct' function)
%
% Beta version
% (c) 2012 - CPOH
% Grupo de Control Predictivo y Optimizacin Heurstica.
% Universitat Politcnica de Valncia - Spain.
% http://cpoh.upv.es

%% Separate design concepts
k1=0;
k2=0;
k3=0;
kr=0;
F1=lg.spf;
F2=lg.spf;
F3=lg.spf;
FR=lg.spf;
for raza=1:size(lg.spf,1)
if lg.spc(raza,1)==1
k1=k1+1;
F1(k1,:)=lg.spf(raza,:);
elseif lg.spc(raza,1)==2
k2=k2+1;
F2(k2,:)=lg.spf(raza,:);
elseif lg.spc(raza,1)==3
k3=k3+1;
F3(k3,:)=lg.spf(raza,:);
elseif lg.spc(raza,1)==0
kr=kr+1;
FR(kr,:)=lg.spf(raza,:);
end
end

F1=F1(1:k1,:);
F2=F2(1:k2,:);
F3=F3(1:k3,:);
FR=FR(1:kr,:);

%% Normalize between [1,2]
minimo=min([F1;F2;F3;FR]);
maximo=max([F1;F2;F3;FR]);

F1off=F1;
F2off=F2;
F3off=F3;
FRoff=FR;

for i=1:size(F1,1)
F1off(i,:)=(F1(i,:)-minimo)./(maximo-minimo);
end

for i=1:size(F2,1)
F2off(i,:)=(F2(i,:)-minimo)./(maximo-minimo);
end

for i=1:size(F3,1)
F3off(i,:)=(F3(i,:)-minimo)./(maximo-minimo);
end

for i=1:size(FR,1)
FRoff(i,:)=(FR(i,:)-minimo)./(maximo-minimo);
end

for i=1:size(F1off,1)
F1off(i,:)=1+F1off(i,:);
end

for i=1:size(F2off,1)
F2off(i,:)=1+F2off(i,:);
end

for i=1:size(F3off,1)
F3off(i,:)=1+F3off(i,:);
end

for i=1:size(FRoff,1)
FRoff(i,:)=1+FRoff(i,:);
end

%% Computing Quality measure
if min(lg.spc)>0 % We are comparing two design concepts
[Epstar1 Epstar2]=GimmeQ6(F1off,F2off);
else %We are using a Pareto front for reference for comparison
Epstar1=GimmeQ6(F1off,FRoff);
Epstar2=GimmeQ6(F2off,FRoff);
Epstar3=GimmeQ6(F3off,FRoff);
end

%% Return values
k1=0;
k2=0;
k3=0;
for raza=1:size(lg.spf,1)
if lg.spc(raza,1)==1
k1=k1+1;
lg.Epstar(raza,1)=Epstar1(k1,1);
elseif lg.spc(raza,1)==2
k2=k2+1;
lg.Epstar(raza,1)=Epstar2(k2,1);
elseif lg.spc(raza,1)==3
k3=k3+1;
lg.Epstar(raza,1)=Epstar3(k3,1);
end
end

%% Re-sorting

% [lg.spc,indices]=sort(lg.spc,'descend');
%
% lg.spf=lg.spf(indices,:); %Pareto front is sorted
% lg.sps=lg.sps(indices,:); %Pareto set is sorted
% lg.Epstar=lg.Epstar(indices,:);
% lg.pref=lg.pref(indices,:);

%%
% Auxiliar vector normalized distance
maxauxc=max(lg.Epstar);
minauxc=min(lg.Epstar);

%% sPareto merged Front

% Computing shape of plot array
% gfsf : rows
% gfsc : columns
if lg.nobj==3
gfsf=1;
gfsc=3;
else
gfs=sqrt(lg.nobj);
gfsf=round(gfs);
gfsc=gfsf;
if gfsf^2<lg.nobj
gfsc=gfsc+1;
end
end
lg.layout=[lg.layout gfsf gfsc];
%% Plot
lg.figuras(3)=figure('Name','Design Concepts Comparison');

% color map
% white color [1 1 1]
% black color [0 0 0]
if size(lg.pref,1)==lg.numind
cm=colormap(hot(40));
numcol=size(cm,1); %number of different color
end

for ii=1:lg.nobj
eval(['subplot(' num2str(gfsf) ',' num2str(gfsc) ',' num2str(ii) ')'])
lgSetLabelConcept6(ii);
%eval(['xlabel(''\bf J' num2str(ii) ' (J' num2str(ii) ' units) '')'])
hold on;
SolReferencia=0;
for kk=lg.numind:-1:1
color=lg.pref(kk)/lg.worstpref;
color=round((numcol-1)*color+1);
color=cm(color,:);
if lg.spc(kk,1)==1
handlerPC(kk)=plot(lg.spf(kk,ii),lg.Epstar(kk),'d','MarkerEdgeColor',color,'MarkerSize',8);
elseif lg.spc(kk,1)==2
handlerPC(kk)=plot(lg.spf(kk,ii),lg.Epstar(kk),'o','MarkerEdgeColor',color,'MarkerFaceColor',color,'MarkerSize',8);
elseif lg.spc(kk,1)==3
handlerPC(kk)=plot(lg.spf(kk,ii),lg.Epstar(kk),'s','MarkerEdgeColor',color,'MarkerFaceColor',color,'MarkerSize',8);
elseif lg.spc(kk,1)==0
SolReferencia=SolReferencia+1;
end
end
if minauxc==maxauxc
minauxc=minauxc-0.1;
maxauxc=maxauxc+0.1;
end

%     if ii==1
%         clickableLegend(handlerPC, {'Design Concept 1','Design Concept 2','Design Concept 3'},'groups', lg.spc(SolReferencia+1:end,:));
%     end

axis([lg.minpf(1,ii) lg.maxpf(1,ii) minauxc maxauxc])
lg.axis=[lg.axis;gca];
end

%% Update Control
% 30/01/2012 ... Initial Release
% 16/10/2012 ... First Test Release