load('dat.mat');
rep=10;% number of repetitions
results=cell(1,numel(inst));
for i=1:numel(inst)
    L=inst{i}.L;
	w=inst{i}.w;
	Y=inst{i}.Y;
	A=inst{i}.Adj;
	L_size=int32(size(L,1));
	n=size(A,1)-1;
    m=size(w,2);
    budget=ceil(3*double(L_size)*(m^2)*log(m-n));
    results{i}.budget=budget;
    GSEMO_o=cell(1,rep);MOEAD_o=cell(1,rep);
    for j=1:rep
		% Run MOEA/D
        RR=struct();
        [P,Pw,S,Sw,eval]=MOEAD_in(w,A,L,budget,L_size,Y);
        RR.P=P;RR.Pw=Pw;RR.S=S;RR.Sw=Sw;RR.eval=eval;
        MOEAD_o{j}=RR;
		% Run GSEMO
        RR=struct();
        [P,Pw,eval]=GSEMO(w,A,budget,Y);
        RR.P=P;RR.Pw=Pw;RR.eval=eval;
        GSEMO_o{j}=RR;
    end
    results{i}.MOEAD_o=MOEAD_o;
    results{i}.GSEMO_o=GSEMO_o;
end
%save('results_dat.mat','results'); %Save results to file