├── ML_RS.m ├── RBDO_ML.m ├── README.md ├── constraint.m └── objfun.m /ML_RS.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Amin-Eshghi/A-polynomial-regression-machine-learning-approach-for-reliability-based-optimization/553b6844b6c7871f141aabeedcc6f57902ca6c51/ML_RS.m -------------------------------------------------------------------------------- /RBDO_ML.m: -------------------------------------------------------------------------------- 1 | function RBDO_ML() 2 | warning off 3 | % This code consists of a Machine Learning (LM) approach for reliability-based design optimization (RBDO) 4 | % which uses a polynomial regression technique for reliability analysis under uncertainty. 5 | % One mathematical example is solved for demonstration purpose. 6 | % To see more details about this method and other numerical examples you can check out: 7 | %% 8 | % 1. Eshghi, Amin Toghi, and Soobum Lee. "Adaptive improved response surface method for reliability-based 9 | % design optimization." Engineering Optimization (2019): 1-19. 10 | %% 11 | % VARIABLE DEFINITION 12 | % nc: number of constraints ; nv: number of design variables 13 | % rt: target reliability; x0: initial design; xp: previous design 14 | % lb & ub: lower bound and upper bound for design variables 15 | % iter: variable used to record iteration number of optimization process 16 | % UNIFSEED: uniform random seeds for reliability analysis using ML 17 | % ns: number of MCS samples 18 | % GT_RS: quantile of response at target reliability (CDF) level (used 19 | % as reliability constraint in RBDO) 20 | % Sen_GT_RS: sensivities of quantile w.r.t. means of design variables 21 | % 22 | % FUNCTION DEFINITION 23 | % RBDO_ML(): main function 24 | % Costfun(): objective function & gradients w.r.t. means of design variables 25 | % frelcon(): Define the probability constraints and gradients 26 | % ML_RS(): ML method for reliability analysis under uncertainty 27 | % SHOW(): show the optimization information for every design iteration 28 | 29 | 30 | 31 | global nc rt Iters cost c_total count nv m 32 | c_total = []; 33 | count = 0; 34 | 35 | %=================== Define Optimization Parameters ===================% 36 | nc = 2; rt = normcdf(3,0,1); 37 | %[Width Thickness] 38 | x0=[2.5 2.5]; 39 | 40 | lb=[0 0 ]; 41 | 42 | ub=[ 5 5]; 43 | 44 | 45 | xp = x0; Iters = 0; 46 | options = optimset('GradConstr','on','GradObj','on','LargeScale','off','Algorithm','sqp'); 47 | 48 | %========== Generate Uniform Random Seeds for Reliability Analysis ========% 49 | nv = length(x0); %% Number of input random variables 50 | ns = 1000000; %% Number of MCS samples 51 | UNIFSEED = unifrnd(0,1,nv,ns); 52 | save UNIFSEED UNIFSEED 53 | 54 | %======================= Start Optimization ==========================% 55 | [x,fval,exitflag,output]=fmincon(@objfun,x0,[],[],[],[],lb,ub,@frelcon,options) 56 | 57 | %==================== Define Constraints and Gradiants =================% 58 | function [c,ceq,GC,GCeq] = frelcon(x) 59 | ceq = []; GCeq = []; 60 | 61 | for j = 1:nc 62 | [GT_RS, Sen_GT_RS] = ML_RS(x,j,rt); 63 | c(j) = GT_RS; 64 | GC(:,j) = Sen_GT_RS; 65 | end 66 | 67 | dx = norm(x-xp); 68 | if dx > 1d-10 || Iters == 0 69 | Iters = Iters + 1; 70 | SHOW(Iters,x,c,GC); 71 | end 72 | xp = x; 73 | end 74 | 75 | %===================== Display Iteration Information================% 76 | function SHOW(Iters,x,c,GC) 77 | fprintf(1,'\n********** Iter.%d ***********\n' ,Iters); 78 | disp(['Des.: ' sprintf('%6.4f ',x)]); 79 | disp(['Obj.: ' sprintf('%6.4f',cost)]); 80 | disp(['Cons.: ' sprintf('%6.4f ',c)]); 81 | for k = 1:nv 82 | if k ==1 83 | disp(['Sens.: ' sprintf('%6.4f ',GC(k,:))]); 84 | else 85 | disp([' ' sprintf('%6.4f ',GC(k,:))]); 86 | 87 | end 88 | end 89 | fprintf('\n\n') 90 | end 91 | %===============================================================% 92 | end 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # A-polynomial-regression-machine-learning-approach-for-reliability-based-optimization 2 | This is a compact code for reliability analysis under uncertainty using a Polynomial Regression Machine Learning approach. The code implements a stochastic response surface method (SRSM) which quantifies the uncertainty in a performance function for the purpose of reliability-based design optimization (RBDO). 3 | The method first uses the Polynomial Regression to approximate the limit state functions (LSF). Then it adds some weights and implements Moving Least Square method to locate the new design point closer to the estimated LSF. The two-step process results in a stochastic response surface, with which we can apply the Monte Carlo simulation (MCS) to obtain the full probabilistic characteristics (e.g., statistical moments, reliability, PDF and quantile) of the performance function. One mathematical example is solved for demonstration purpose. 4 | 5 | FUNCTION DEFINITION 6 | 7 | ML_RS(): main function 8 | ML_sampling(): identify locations of polynomial regression samples 9 | FindResponse(): define performance functions 10 | 11 | VARIABLE DEFINITION 12 | 13 | u: mean vector of random variables; s: standard deviation vector 14 | cid: constraint number; rt: target reliability 15 | nv: number of random variables; ns: number of MCS samples 16 | uniComp: polynomial component function values 17 | Response_RS: random response values generated using SRSM 18 | GT_RS: quantile of response at target reliability (CDF) level (used as reliability constraint in RBDO) 19 | Sen_GT_RS: sensivities of quantile w.r.t. means of design variables 20 | To check out more details about this method and some numerical examples you can check out: 21 | 22 | Eshghi, Amin Toghi, and Soobum Lee. "Adaptive improved response surface method for reliability-based design optimization." Engineering Optimization (2019): 1-19. 23 | -------------------------------------------------------------------------------- /constraint.m: -------------------------------------------------------------------------------- 1 | function [c,ceq]=constraint(x) %Constraint defined here 2 | 3 | % Numerical example to demonstrate the performance of the proposed method. This example is provided with detailed explaination at: 4 | % References: 5 | % 1. Eshghi, Amin Toghi, and Soobum Lee. "Adaptive improved response surface method for reliability-based 6 | % design optimization." Engineering Optimization (2019): 1-19. 7 | 8 | % Cantilever beam 9 | % This example demonstrates a cantilever beam design problem. The design goal 10 | % is to minimize its weight subject to multiple constraints on displacement and stress. 11 | % The cantilever beam is in vertical and lateral bending which is loaded at the tip by the vertical and lateral loads Y and Z, respectively. 12 | % Beam length is 100 in. The width w and thickness t of the cross section are deterministic design variables. 13 | % With the assumption of constant density, the objective function is equivalent to minimizing the cross-sectional area defined as f = w * t. 14 | % Two nonlinear constraints are considered in the formulation. The first constraint (G1) is related to yielding at the fixed end of the beam; 15 | % the other constraint (G2) deals with the tip displacement which is allowed to be less than D0=2.2535 in. 16 | 17 | L=100; 18 | D0=2.2535; 19 | 20 | W =x(1); 21 | T=x(2); 22 | Sy=21000; 23 | Y=550; 24 | Z=300; 25 | E=15.22*10^6; 26 | 27 | c(1)=-(Sy-((600*Y/(W*T^2))+(600*Z/(W^2*T)))); 28 | c(2)=-(D0-(4*L^3*(((Y/(T^2))^2+(Z/(W^2))^2)^0.5)/(E*W*T))); 29 | 30 | ceq=[]; 31 | 32 | fid=fopen('HistConst.txt','a'); 33 | fprintf(fid,['x=[' num2str(x) '], ']); 34 | fprintf(fid,['c=[' num2str(c) '] ']); 35 | fprintf(fid,'\n'); 36 | fclose(fid); 37 | 38 | return 39 | end -------------------------------------------------------------------------------- /objfun.m: -------------------------------------------------------------------------------- 1 | 2 | function [f,g]=objfun(x) % obj function calculation 3 | % Numerical example to demonstrate the performance of the proposed method. This example is provided with detailed explaination at: 4 | % References: 5 | % 1. Eshghi, Amin Toghi, and Soobum Lee. "Adaptive improved response surface method for reliability-based 6 | % design optimization." Engineering Optimization (2019): 1-19. 7 | 8 | % Cantilever beam 9 | % This example demonstrates a cantilever beam design problem. The design goal 10 | % is to minimize its weight subject to multiple constraints on displacement and stress. 11 | % The cantilever beam is in vertical and lateral bending which is loaded at the tip by the vertical and lateral loads Y and Z, respectively. 12 | % Beam length is 100 in. The width w and thickness t of the cross section are deterministic design variables. 13 | % With the assumption of constant density, the objective function is equivalent to minimizing the cross-sectional area defined as f = w * t. 14 | % Two nonlinear constraints are considered in the formulation. The first constraint (G1) is related to yielding at the fixed end of the beam; 15 | % the other constraint (G2) deals with the tip displacement which is allowed to be less than D0=2.2535 in. 16 | 17 | global cost 18 | 19 | W =x(1); 20 | T=x(2); 21 | Sy=21000; 22 | Y=550; 23 | Z=300; 24 | E=15.22*10^6; 25 | f=W*T; 26 | g=[T W]; 27 | 28 | cost=f; 29 | %fid=fopen('HistConst.txt','a'); 30 | %fprintf(fid,['x=[' num2str(x') '], ']); 31 | %fprintf(fid,['f=[' num2str(f) '] ']); 32 | %fprintf(fid,'\n'); 33 | %fclose(fid); 34 | 35 | return 36 | end --------------------------------------------------------------------------------