# RBDO: Soft Constraint doesnt work

Dear @moustafa,

Thanks for the RBDO part of UQLAB. It seems the “soft constraint” in the RBDO problems doesn’t work. I show here this problem with the “ COLUMNCOMPRESSION“ example. In the original example the soft constraint is introduced as:

G=x2-x1

Where x2 is “h” and x1 is “b”. In fact, b<h; therefore, the result by considering the mentioned soft constraint is achieved:
b=h=2.3709e+02

Now, I change the soft constraint as follow:
G=x2-3x1
In fact, 3b<h; therefore, the result by considering the mentioned constraint is achieved:

b= 1.5000e+02 h= 2.7618e+02

h>3b 2.7618e+02 > 3×1.5000e+02 it is wrong!!!

Please let me know if my explanation is correct.

Bests
Maria

Dear Maria,

I had a look and indeed there is a problem. There is an error in the comments on the column compression problem. As shown in Eq. (1.3) of the manual and the subsequent equations, the soft constraint is defined as f(d) \leq 0. The column example in the usage section (p. 15 of the RBDO user manual) is also defined as h - b < 0 which translates in UQLab as

RBDOOpts.SoftConstraints.mString = 'X(:,2) - X(:,1)';

since in the definition of the problem X(:,1) is b and X(:,2) is h.

The error lies in the comment in line 113 of the example

% Create a soft constraint function using a string (understood as X(2)-X(1)>0)

should have been

% Create a soft constraint function using a string (understood as X(2)-X(1)<=0)

So when you write f = x2-3x1, the solution found is such that f<0, meaning the solution you found actually satisfies the constraints.

Apologies for the typo in the comments of the example, they are inconsistent with the manual and actual implementation within UQLab. This will be fixed in the next release.

Cheers,
Moustapha

Dear @moustapha

Thank you for your kind consideration. In my opinion, I should inform to you the soft constraints doesn’t work! I define a different soft constraints for this example “COLUMNCOMPRESSION“ as follow:

1. X2- X1
2. X2- 2.*X1
3. X2- 4.*X1
4. 2.*X2- X1
5. 4.* X2- X1

I achieved the result of each case as follow:

1. X2= 2.3709e+02 , X1=2.3709e+02 → 2.3709e+02 -2.3709e+02 = 0

2. X2=2.7618e+02 , X1=1.5000e+02 → 2.7618e+02 -2*1.5000e+02 <0

3. X2=2.7618e+02 , X1=1.5000e+02 → 2.7618e+02 -4*1.5000e+02 <0

4. X2=2.0822e+02 , X1=3.5000e+02 → 2*2.0822e+02 - 3.5000e+02 > 0 !!!

5. X2= 2.0822e+02 , X1= 3.5000e+02 → 4*2.0822e+02 - 3.5000e+02 > 0 !!!

Thanks,
Maria

Dear @Maria

The soft function does work. When I run your fourth example, I get the following message for all the gradient-based algorithms (RIA, SLA, SORA):

Converged to an infeasible point.

fmincon stopped because the size of the current step is less than
the value of the step size tolerance but constraints are not
satisfied to within the value of the constraint tolerance.

Also please pay attention to the exit message in the last line of uq_display:

%------------------ Method
RBDO Method: Reliability index approach (RIA)

%------------------ Optimization
Iterations: 9
Model evaluations: 610
> Exit message: No feasible solution found!

--------------------------------------------------------------------------

As of now, the RBDO module behaves exactly like the optimization algorithm in Matlab, i.e. when no feasible solution is found, the algorithm does not stop and return an error. Instead, it finds and returns the solution that violates the least the constraints. It is then always important to check that the exitflag of the algorithm is positive or to read the exit message.

With your setting, the CMA-ES based algorithm however returns an error, which is not a desired behavior in this case. This is due to the fact that there is no feasible space to start with and CMA-ES requires an initial feasible point to function properly. I will have a look and fix this for the next release so that a warning is returned instead.

I did not run the case #5 because, even without considering the probabilistic constraint it is clear that there is no feasible space.

Hope this helps.
Best,
Moustapha