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

play01_plus_hack

by Jonathan

Status: Passed
Results: 2523 (cyc: 4, node: 180)
CPU Time: 1.371
Score: 2526.46
Submitted at: 2012-11-02 15:42:29 UTC
Scored at: 2012-11-02 15:45:34 UTC

Current Rank: 1507th (Highest: 9th )
Based on: play01 (diff)

Comments
Please login or create a profile.
Code
function xyOut = solver(a, xyIn, wts)
  % JLS solver; Based on spectral graph theory.
  
  L = diag(sum(a)) - a; % graph laplacian
  
  % get eigenvectors of interest
  [U, ~, ~] = svd(L);
  U         = U(:, end-2:end-1);
  
  % scale to integers, with truncation
  X = U;
  n = size(X, 1);
  k = max(fix(log10(abs(U(:))))) + ceil(log10(n));
  X = round(U .* 10^k);
  
  % resolve repeated rows arbitrarily
  [~, m, ~] = unique(X, 'rows');
  m         = numel(m);
  while m ~= n
    for row1 = 1:size(X, 1)
      idx = find(X(:, 1) == X(row1, 1) & X(:, 2) == X(row1, 2));
      for row2 = 2:numel(idx)
        X(idx(row2), 2) = X(idx(row2), 2) + row2;
      end
    end
    [~, m, ~] = unique(X, 'rows');
    m         = numel(m);
  end
  
  xyOut = X;
end