function [BEST,FuncBEST] = Very_Optimistic_Method (Func_name,N,Lower,Upper,Maxiter)

fobj = TestFunctions (Func_name); 
D=length(Lower);
X=zeros(N,D);
XW=zeros(N/2,D);
XS=zeros(N/2,D);
XNEW=zeros(N/2,D);
XALL=zeros(3*N/2,D);
BEST=zeros(1,D);
K=2.0;

for i=1:N
  for j=1:D
    X(i,j)=Lower(j)+(Upper(j)-Lower(j))*rand;
  end
  fitness(i)=fobj(X(i,:));
end

X = sortX (X,fobj,N,D);

for i=1:N/2
  XS(i,:)=X(i,:);
end

for i=((N/2)+1):N 
  XW(i-(N/2),:)=X(i,:);
end

iter=1;

while(iter <= Maxiter)
  
     for i=1:N/2
         XNEW(i,:)=XW(i,:)+K*rand*(XS(i,:)-XW(i,:));
     end  
     
     XNEW = boundary (XNEW, Lower,Upper,N/2,D);
     
     for i=1:N
        XALL(i,:)=X(i,:);
     end
  
     for i=1:N/2
       XALL(N+i,:)=XNEW(i,:);
     end
   
     XALL = sortX (XALL,fobj,3*N/2,D);  
     
     for i=1:N
       X(i,:)=XALL(i,:);
     end
   
     for i=1:N/2
       XS(i,:)=X(i,:);
     end
   
     for i=((N/2)+1):N
       XW(i-(N/2),:)=X(i,:);
     end
    
     BEST=X(1,:);
     FuncBEST=fobj(BEST);     
    
     iter=iter+1;
end     
   
endfunction
