I am working with RBDO using a PCE model. All the examples I saw have Cost functions with simple forms. Mine is a bit more complex because it includes several sequential calculations involving the decision variables and the stochastic parameters. I tried various alternatives to handle problem. One was to write a large Cost function, like this one:

RBDOOpts.Cost.mString = [

'dose = X(:,1); ’ …

'theta11 = X(:,2); ’ …

'theta12 = X(:,3); ’ …

'theta21 = X(:,4); ’ …

'theta22 = X(:,5); ’ …

'theta23 = X(:,6); ’ …

'rho = X(:,7); ’ …

'linVal1 = -(theta11 + theta12 .* dose); ’ …

'linVal2 = -(theta21 + theta22 .* dose + theta23 .* dose .^ 2); ’ …

'Y1 = 1.0 ./ (1.0 + exp(linVal1)); ’ …

'Y2 = 1.0 ./ (1.0 + exp(linVal2)); ’ …

'Z2 = Y2 - 0.5; ’ …

‘ZConst = Z2;’

];

but it does not work because of the “=”. Another strategy was using a function mHandle without much success I have to say. So, anybody has experience in using complex Cost functions?

Another problem is that I need the stochastic parameters within the Cost function In the above example only X(:,1) is a decision variable, the other 6 columns are parameters. So, how can I pass parameters into the cost function?