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

myNonlConRR(x,simParms)
function [c,ceq] = myNonlConRR(x,simParms)

% Copyright 2010 The MathWorks, Inc.
%% mynonlcon.m  Nonlinear constraints for fmincon.

% Extract suspension variables
kf = x(1);
cf = x(2);
kr = x(3);
cr = x(4);

% Extract parameters needed for constraints
struct2var(simParms)
Iyy = mcIyy;
Mb  = mcMb;
Lf  = mcLf;
Lr  = mcLr;
rf  = mcrf;
rr  = mcrr;
rt  = mcrt;
%% Define Reliability Limit and Desired Damping Coefficient Range
Plimit = 0.90;      % max probability of shock absorber failure for lifetime
%A = 0.758;
%B = 3.68;
%Pf = @(cdamp) 1 - wblcdf(cdamp,A,B);
A = @(dampRatio) -1.0129e+005.*dampRatio.^2 -28805.*dampRatio + 2.1831e+005;
B = @(dampRatio) 1.6865.*dampRatio.^2 -1.8534.*dampRatio + 4.1507;
Ps = @(miles,dampRatio) 1 - wblcdf(miles,A(dampRatio),B(dampRatio));

mileage = 100000;
% Can tolerate a +/-10% change from desired damping coefficient
cupper = 0.4;     % upper limit for damping coefficients
clower = 0.3;     % lower limit for damping coefficients


%% Compute Constraints
Mf  = Mb.*Lr./(Lf+Lr)./2;
Mr  = Mb.*Lf./(Lf+Lr)./2;
cdf = cf./(2*sqrt(kf.*Mf));
cdr = cr./(2*sqrt(kr.*Mf));

% Inequality constraints c <= 0
c = [sqrt(kf./Mf)/(2*pi)-2;... % fn <= 2 Hz for front
     sqrt(kr./Mr)/(2*pi)-2;... % fn <= 2 Hz for rear                
     clower-cdf;...           % damping ratio for front                
     clower-cdr;...           % damping ratio for rear
     Plimit- Ps(mileage,cdf);...      % front shock absorber reliability constraint
     Plimit- Ps(mileage,cdr)];        % rear shock absorber reliability constraint
 
 ceq = [];

Contact us