APCKMCS for reliability analysis

I am using APCK model for reliability analysis. The reliability problem has 17 random variables. I use this apptions for this problem:

   APCKMCSOpts.Type = 'Reliability';
  APCKMCSOpts.Method = 'AKMCS';
  APCKMCSOpts.AKMCS.MetaModel = 'PCK';
  APCKMCSOpts.AKMCS.IExpDesign.Sampling = 'LHS';
  APCKMCSOpts.AKMCS.MaxAddedED = 45;
  APCKMCSOpts.AKMCS.IExpDesign.N = 15;
  APCKMCSOpts.AKMCS.PCK.Kriging.Corr.Family = 'Gaussian';
  APCKMCSOpts.AKMCS.LearningFunction = 'U';
  APCKMCSOpts.Simulation.MaxSampleSize = 1e6;
  myAPCKMCSAnalysis = uq_createAnalysis(APCKMCSOpts);

also I added this line in uq.lar :


but I see this error in some runs,

something went extremely wrong while trying to evaluate the analysis
You may find additional information in the catched exeption:
NaN's cannot be converted to logicals.

Error in uq_lar (line 239)
    s(~s) = 1;

Error in uq_PCE_lars (line 60)
lar_results = uq_lar(Psi, Y, lar_options);

Error in uq_PCE_calculate_coefficients_regression (line
                lars_results = uq_PCE_lars(univ_p_val,

Error in uq_PCE_calculate_coefficients (line 47)
Error in uq_calculateMetamodel (line 18)
        success =

Error in uq_initialize_uq_metamodel (line 358)
success = uq_calculateMetamodel(current_model);

Error in uq_PCK_calculate_coefficients (line 88)
        myPCE = uq_createModel(popts, '-private');

Error in uq_calculateMetamodel (line 24)
        success =

Error in uq_initialize_uq_metamodel (line 358)
success = uq_calculateMetamodel(current_model);

Error in uq_akmcs (line 110)
            myMetamodel = uq_createModel(metaopts,

Error in uq_reliability (line 62)
        results = uq_akmcs(CurrentAnalysis);

Error in uq_initialize_uq_reliability (line 633)

Error in Pilot_without_copula_F (line 440)
myAPCKMCSAnalysis = uq_createAnalysis(APCKMCSOpts);

Furthermore, I checked other candidate options (all 4 combinations) of both learning function and stop citerion:

  1. Learning function:U & EFF
  2. stop criteria:stopU & stopPf

Do you know what is the reseaon of it?

Besides, its worth mentioning that when I use AKMCS method,not APCKMCS, every thing is right!

Please help me to find my problem with APCKMCS method?

Many thanks

1 Like

Hi @Abdollahi

but I see this error in some runs,

You get the error only in some runs but not all? Did you check that your limit-state does not run NaN for some inputs?
@nluethen is probably more familiar with these types of errors occurring in LARS… Otherwise would you mind sharing your limit-state function (if it’s analytical)? May be then it will be easier to spot the error.

It’s probably unrelated but I would recommend having a slightly larger initial experimental design (I always start with at least as many points as the number of random variables).

Dear Dr. Moustapha Maliki,
Many thanks for your quick reply.

I examine this example with different reliability methods such as Monte Carlo simulation, Subset simulation, Importance sampling and Adoptive Kriging-Monte Carlo simulation.
I didn’t see any error in the mentioned methods.
Also, I used different meta-model such as PCE, PCK and Kriging for the mentioned example, it worked fine and I didn’t see any error.
Fortunately, the AKMCS method shows a good performance in our study with 20 initial sample size and 50 maximum added sample size.
Recently, I used the Adaptive PC-Kriging Monte Carlo simulation method and I get error in some scenarios.
I used different initial sample sizes and max added ones BUT I faced the NaN problem with mentioned in my question in the previous post.

Hi Azam,

It sounds like a problem with your data. 15 ED points in 17 dimensions is very little. Is there a reason that you are using such a small experimental design? Does the error also come when you use e.g. 30 or 50 points in the initial design? How many points did you use when you constructed the PCK metamodel?

For PCK you need an input object. Make sure that the input object you use is the correct one. You can even set it explicitly by
APCKMCSOpts.AKMCS.PCK.Input = myInput;

Also, what Moustapha said is an important point: does your limit state function return NaN for some inputs?

You could try to find out where the NaN comes from by setting a few breakpoints: e.g. in line 199, 232, and 236 of uq_lar.m. Then you can check in which iteration the error occurs and which quantity contains the first NaN.

I’m afraid I can’t say more without seeing your limit state function or your data.

Good luck! And please let us know once you find the reason for the problem, and how you fixed it :slight_smile:

Dear @nluethen

Thank you for your kind reply,
I achieved more accurate results through AK-MCS by considering 15 ED points. I am a bit cofused why the Adoptive-PC-Kriging MCS couldn’t provide results?
The random variables are generated in logical interval. I check the LSF for any meta-model and any reliability methods, but none of them get the NAN error.


Hi Azam,

every method has its limits, and if you use too few points, strange things can happen. 15 points in 17 dimensions are really too few to compute a reasonable metamodel, unless your model is very simple (e.g. constant or linear in many dimensions).

Still, it would be interesting to understand where the NaNs come from, so if you find the time to investigate a bit following our suggestions in the previous posts, or if you can share your limit state function or your data, we would be grateful.
If that’s not possible, but you found some other metamodelling method that works well in your case, that’s good as well :slight_smile: