Problem with RBDO Example 2: uq_cmaesnonlconwrapper

Hello everyone,

I was editing uq_Example_RBDO_02_BracketStructure and adding a soft constraint matrix to it, but I got the following error while running the code:

something went extremely wrong while trying to evaluate the analysis
You may find additional information in the catched exeption:
Dimensions of matrices being concatenated are not consistent.

Error in uq_cmaesnonlconwrapper (line 20)
c = [ hc sc] ;

Error in uq_runRBDOptimizer>@(X)uq_cmaesnonlconwrapper(X,current_analysis) (line 140)
nonlcon = @(X)uq_cmaesnonlconwrapper( X, current_analysis ) ;

Error in uq_runRBDOptimizer>@(x)nonlcon(x) (line 147)
[Xstar,Fstar,exitflag,output] = uq_c1p1cmaes(@(x)fun(x),x0,sigma0,lb,ub,@(x)nonlcon(x),optim_options) ;

Error in uq_c1p1cmaes>@(x)nonlcon(x’) (line 202)
nonlconfcn = @(x) nonlcon(x’);

Error in uq_c1p1cmaes (line 336)
g = nonlconfcn(x_current);

Error in uq_runRBDOptimizer (line 147)
[Xstar,Fstar,exitflag,output] = uq_c1p1cmaes(@(x)fun(x),x0,sigma0,lb,ub,@(x)nonlcon(x),optim_options) ;

Error in uq_rbdo (line 52)
results = uq_runRBDOptimizer(current_analysis) ;

Error in uq_initialize_uq_rbdo (line 1666)

Error in uq_Ex02_RubBreakwat (line 120)
myRBDO_MCC = uq_createAnalysis(MCCOpts);

How to fix this error?

RBDO Ex02.zip (2.8 KB)

Hi @Soheil_Radfar,

Did your edits change the matrices hc and sc that are concatenated in this line? As the error message says, their dimensions are not consistent anymore. I would suggest to set a breakpoint in line 20 of uq_cmaesnonlconwrapper, run your code again, and examine the sizes of these matrices when execution stops at this breakpoint. What size should they have, what size do they have? This way, you can for sure find out where this error comes from.

Good luck! :slight_smile:

1 Like

I checked the code again and found the way to solve runtime error.
The original UQLab code has a problem. I do not know how to inform the Team, therefore, I tag dear @moustapha, here.

The problem is that in the source code of the program (in uq_cmaesnonlconwrapper) and in the line 18, the sc matrix is transposed, while it should not be, and this causes an error when executing the code.

Dear @nluethen, thank you for your answer.