Code covered by the BSD License  

Highlights from
Speeding Up Optimization Problems with Parallel Computing

image thumbnail

Speeding Up Optimization Problems with Parallel Computing

by

Stuart Kozola

 

Files from the webinar: Speeding up optimization problems with parallel computing

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

sumInvDist(x)
function energy = sumInvDist(x)

% Copyright 2010 The MathWorks, Inc.
E = length(x);
energy = 0;
for i = 1:3:E-5
    for j = i+3:3:E-2
        dist   = x(i:i+2) - x(j:j+2);
        if norm(dist) == 0
            energy = 1e9;
        else
            energy = energy + 1/sqrt(dist'*dist);
        end
    end
end

Contact us