Finish 2012-11-07 16:00:00 UTC

explodeRelax300

by Sebastian Ullmann

Status: Passed
Results: 2655 (cyc: 5, node: 223)
CPU Time: 58.652
Score: 2725.7
Submitted at: 2012-11-02 13:02:04 UTC
Scored at: 2012-11-02 13:05:26 UTC

Current Rank: 1515th (Highest: 9th )
Based on: explodeRelax (diff)

Comments
Please login or create a profile.
Code
function x = explodeRelax(a, x, wts)
  x0_mean = mean(x,1);
  r0_mean = mean(sqrt(sum(bsxfun(@minus,x,x0_mean).^2,2)));
  a = a + diag(sum(a,2)==1);
  a = bsxfun(@rdivide,a,sum(a,2));
  for iRun = 1:300
    for iNode = 1:size(a,1)
      xi = round(a(iNode,:)*x);
      if all((x(:,1)~=xi(1))|(x(:,2)~=xi(2)))
        x(iNode,:) = xi;
      end
    end
    x_old = x;
    x = bsxfun(@minus,x,mean(x,1));
    [U,~,V] = svd(x,'econ');
    x = U*V';
    r_mean = mean(sqrt(sum(bsxfun(@minus,x,mean(x,1)).^2,2)));
    x = round(exp(150*(1-iRun/300))*r0_mean/r_mean*x);
    if size(unique(x,'rows'),1) ~= size(x,1)
      x = x_old;
    end
  end
  x = bsxfun(@plus,x,round(x0_mean-mean(x,1)));
end