rng(100,'twister')
uqlab  
ModelOpts.mFile = 'PCE_RBDO';
% ModelOpts.mFile = 'uq_highlynonlinear_constraint';

myModel = uq_createModel(ModelOpts);

% myInput = uq_createInput(Iopts) ;
 
InputOpts.Marginals(1).Type = 'Gaussian';
% InputOpts.Marginals(1).Moments = [102000, 10200];
InputOpts.Marginals(1).Cov = 0.1;

myInput = uq_createInput(InputOpts);

% Constraint function
RBDOOpts.LimitState.Model = myModel ;
% RBDOOpts.LimitState.Model = myPCEModel;
RBDOOpts.Cost.mString = '3.1415.*100.*X(:,1).*(200 + 100./X(:,2)).*(100./X(:,2))';
% Design variables
RBDOOpts.Input.DesVar(1).Name = 'LR';
RBDOOpts.Input.DesVar(1).Type = 'constant';
RBDOOpts.Input.DesVar(2).Name = 'RT';
RBDOOpts.Input.DesVar(2).Type = 'constant';
RBDOOpts.Input.DesVar(3).Name = 'A1';
RBDOOpts.Input.DesVar(3).Type = 'constant';
RBDOOpts.Input.DesVar(4).Name = 'A2';
RBDOOpts.Input.DesVar(4).Type = 'constant';
% RBDOOpts.Input.DesVar(5).Name = 'E1';
% RBDOOpts.Input.DesVar(5).Type = 'Gaussian';
% RBDOOpts.Input.DesVar(5).Cov = 0.1;
RBDOOpts.Input.EnvVar = myInput;

RBDOOpts.Optim.Bounds = [3 20.1 0 0; 20 30 90 90];
RBDOOpts.Optim.StartingPoint = [4 25 45 45];
% RBDOOpts.TargetPf = 0.05;
RBDOOpts.TargetBeta = 2;

RBDOOpts.Type = 'RBDO';
RBDOOpts.Method = 'two-level';
MCCOpts = RBDOOpts;
MCCOpts.Reliability.Simulation.MaxSampleSize = 5e4;
MCCOpts.Optim.MaxIter = 350;
myRBDO_MCC = uq_createAnalysis(MCCOpts);
uq_print(myRBDO_MCC)
uq_display(myRBDO_MCC)


% RIAOpts = RBDOOpts;
% RIAOpts.Type = 'RBDO';
% RIAOpts.Method = 'RIA';
% myRBDO_RIA = uq_createAnalysis(RIAOpts) ;
% uq_print(myRBDO_RIA)
% uq_display(myRBDO_RIA)

% PMAOpts = RBDOOpts;
% PMAOpts.Type = 'RBDO';
% PMAOpts.Method = 'PMA';
% myRBDO_PMA = uq_createAnalysis(PMAOpts) ;
% uq_print(myRBDO_PMA)
% uq_display(myRBDO_PMA)


% SORAOpts = RBDOOpts;
% SORAOpts.Type = 'RBDO';
% SORAOpts.Method = 'SORA';
% myRBDO_SORA = uq_createAnalysis(SORAOpts) ;
% uq_print(myRBDO_SORA)
% uq_display(myRBDO_SORA)

