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

 

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

myCostFcnRR(x,simParms)
function mycost = myCostFcnRR(x,simParms)
%% Run Simulink model
% Start Monte Carlo
%

% Copyright 2010 The MathWorks, Inc.
parfor ii = 1:simParms.nRuns
    %% Run the simulation
    [Zdotdot,thetadotdot,rf,rr] = runSimModel(x,simParms,ii);
    
    %% Compute cost
    totalAccel = (Zdotdot + rf * thetadotdot).^2 + (Zdotdot - rr * thetadotdot).^2;

    %% Return final value
    ta(ii) = sum(totalAccel);
    tm(ii) = max(totalAccel);
end

mycost = (mean(ta) + std(ta))/904 * 0.5 + (mean(tm) + std(tm))/56 * 0.5;

assignin('base','totAccel',ta);
assignin('base','pkAccel',tm);

Contact us