Finish 2010-05-05 12:00:00 UTC

EspilacopA 04

by Uri

Status: Passed
Results: 3132168749 (cyc: 5, node: 235)
CPU Time: 145.956
Score: 6286150.0
Submitted at: 2010-04-30 11:13:15 UTC
Scored at: 2010-04-30 11:16:17 UTC

Current Rank: 4230th (Highest: 631st )

Comments
Uri
30 Apr 2010
Small improvement
Alan Chalker
10 May 2010
This entry was submitted during the Twilight phase
Alan Chalker
11 May 2010
This entry gets a result of 6421501743 on the test suite (3289332994 more than the contest suite). It has a ranking of 4215 compared to all other entries run against the test suite according to the data set provided by Jan Keller.
Please login or create a profile.
Code
function Aest = solver(imageSize, queryLimit)
% Try to solve using othog matrix questions

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Ver   Who  Date     Changes
% --------------------------------------------------------
% 04    ud  30/04/07  increasing ReqFactor limit and fixing the inv eq. - svd 
% 03    ud  30/04/07  only operation in time - worst than ver 02
%                     Increasing MaxMemSize to 2e6
% 02    ud  30/04/07  limit the size
% 01    ud  28/04/07  Solve using orthogonal arrays
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% just init
Aest    = zeros(imageSize);

% number of different basis
PixNum    = imageSize*imageSize;

% max memory proble solve
MaxMemSize = 2e6;
ReqMemSize = PixNum*queryLimit;

% define which alg to perform
ReqFactor  = ceil(ReqMemSize/MaxMemSize);

% check if queryLimit is too large
if ReqFactor > 2,
    approxSize  = ceil(sqrt(PixNum/queryLimit));
    % just use approxSize pixel as a mask
    mask    = logical(Aest*0);
    % number of steps to take
    stepNum = floor(imageSize/approxSize);
    for nc = 1:stepNum,
        indc = (nc-1)*approxSize + 1:nc*approxSize;
        
        for nr = 1:stepNum,
            indr = (nr-1)*approxSize + 1:nr*approxSize;
            
            mask(indr,indc) = true;
            pixSum = queryImage(mask);
            
            % assign
            Aest(indr,indc) = pixSum;
            
            % reset mask
            mask(indr,indc) = false;
        end
    end;
    
else
    
    % create basis
    ThrLevels = linspace(0.01,0.99,queryLimit);
    BasisM    = rand(PixNum,queryLimit) > repmat(ThrLevels,PixNum,1);
    
    % collect the info
    pixSum    = zeros(queryLimit,1);
    for k = 1:queryLimit,
        
        mask      = reshape(BasisM(:,k),imageSize,imageSize);
        pixSum(k) = queryImage(mask);
    end;
    
    % recover
    BasisM   = double(BasisM)';
    [U,S,V]  = svds(BasisM,3);
    Acol     = V*diag(1./diag(S))*U'*pixSum;
    Aest     = reshape(Acol,imageSize,imageSize);
    
end;




end