title: Different optimization results for line-up competition algorithm of matlab and python
body: <p>I tried to write the line-up competition algorithm on python and matlab, but the result of matlab is better than that of python every time, and the result of matlab is fixed value while the result of python is not fixed. I think it's a problem with random numbers or critical conditions, but after using the same random numbers and critical conditions later, the results in python are still not ideal.</p>
  <p>This is my python code:</p>
  <pre><code>from function_ca import function_ca
  import numpy as np
  upper_bound = np.array([6, 6])
  lower_bound = np.array([0, 0])
  r = 0.999       
  population = 10 
  npoint = 5      
  ul_bound = upper_bound - lower_bound
  x = np.zeros((npoint, 2))
  ll = np.array([0, 0])
  bb = np.array([0, 0])
  xx = np.zeros((population, 2))
  for i in range(2):
      cacu_1 = lower_bound[i] + ul_bound[i]*np.random.rand(npoint, 1)
      x[:, i] = cacu_1.reshape((npoint, ))
  y = function_ca(x)
  m = 1
  
  while max(ul_bound) &gt;= 0.0000001:
      y1 = np.sort(y)
      k = np.argsort(y)
      x_t = x.repeat(repeats=1, axis=1)
      for i in range(len(k)):
          x[i, :] = x_t[k[i], :]
      for i in range(npoint):
          for j in range(2):
              ll[j] = max(x[i, j] - ul_bound[j] * i / (2 * npoint), lower_bound[j])
              bb[j] = min(x[i, j] + ul_bound[j] * i / (2 * npoint), upper_bound[j])
          for ii in range(2):
              caculate_2 = ll[ii] + (bb[ii] - ll[ii]) * np.random.rand(population, 1)
              xx[:, ii] = caculate_2.reshape((population,))
  
          yy = function_ca(xx)
          yy1 = np.sort(yy)
          kk = np.argsort(yy)
          if yy1[0] &lt; y1[i]:
              x[i, :] = xx[kk[0], :]
              y1[i] = yy1[0]
      y = y1
      m += 1
      ul_bound = ul_bound * 0.99
  
  print(m)
  print(x)
  print(y)
  </code></pre>
  <p>and this is my matlab code :</p>
  <pre><code>clear
  close
  %bounds of varibles 
  l=[0 0];
  b=[6 6];
  % l=[100 1000 1000 10 10 10 10 10];
  % b=[10000 10000 10000 1000 1000 1000 1000 1000];
  variable=size(l,2);
  %r=input('contraction factor 0.1-0.99:');
  %npoint=input('population number:');
  %reprod=input('production number:');
  r=0.999;
  npoint=20;
  reprod=10;
  tim0=clock;
  dbl=b-l;
  for i=1:variable
     x(:,i)=l(i)+dbl(i)*rand(npoint,1);
  end
  
  y=funLCA(x);
  m=1;
  while max(dbl)&gt;=0.000001%m&lt;100%
  
      [y1,k]=sort(y);
      x=x(k,:);
    for i=1:npoint
      for j=1:variable
        ll(j)=max(x(i,j)-dbl(j)*i/(2*npoint),l(j));
        bb(j)=min(x(i,j)+dbl(j)*i/(2*npoint),b(j));
          end
      for ii=1:variable  
          xx(:,ii)=ll(ii)+(bb(ii)-ll(ii))*rand(reprod,1);
      end
      yy=funLCA(xx);
      
      [yy1,kk]=sort(yy);
      if yy1(1)&lt;y1(i)
        x(i,:)=xx(kk(1),:);
        y1(i)=yy1(1);
      end
    end
  y=y1;
  m=m+1;
  dbl=r*dbl;
  end
  time=etime(clock,tim0)
  m
  y=funLCA(x)
  x
  </code></pre>
  <p>I think language will only affect the efficiency, but it will never affect the results.
  I hope that experts can help me and tell me why this is happening.</p>