function subproblems=assignpop(subproblems,allpoint,idealpoint)
global params
   selweight=[subproblems.weight];
   for  i=1:length(allpoint)
    allobj=subobjective(selweight,allpoint(i).objective,idealpoint, params.dmethod);
    [vol,pos]=sort(allobj);
    allpoint(i).estimation=[pos',vol'];
       findspace=0;outp=0;
       while findspace==0&&outp==0
    if isempty(subproblems(allpoint(i).estimation(1,1)).optpoint)
        subproblems(allpoint(i).estimation(1,1)).optpoint=allpoint(i);
        findspace=1;
    else
        if subproblems(allpoint(i).estimation(1,1)).optpoint.estimation(1,2)>allpoint(i).estimation(1,2);
            cellspace=subproblems(allpoint(i).estimation(1,1)).optpoint;
            subproblems(allpoint(i).estimation(1,1)).optpoint=allpoint(i);
            allpoint(i)= cellspace;
        end
        allpoint(i).estimation(1,:)=[];
        if isempty(allpoint(i).estimation)
            outp=1;           
        end
    end
       end
   end    
   clear  selweight allobj vol pos findspace outp;
   ind={subproblems.optpoint};
   [subproblems.curpoint] = ind{:};
   [subproblems.optpoint]=deal([]);

   clear ind indiv NPOP;
end