Optimization: Function taking a variable value from out of the bounds

(Files attached)
x0 = abs([0.01, 1, 283.15, 8, 10]);
%options = optimset('PlotFcns',@optimplotfval);
fitnessfcn = @(x)Lobo(x(1), x(2), x(3), x(4), x(5));
nonlcon1 = @(x)nonlcon(x(1), x(2), x(3), x(4), x(5));
lb = abs([0.01, 1, 283.15, 8, 10]);
ub = abs([10, 18.3, 1473.15 ,20, 50]);
[X, fval] = fmincon(fitnessfcn, x0, [], [], [], [], lb, ub, nonlcon1);
I am getting imaginary values of intermediary equations in Lobo because d0 (diameter) is going below 0. Why is this happening? Also, the calculated value of MATLAB do not match the manually calculated value (calculator). e.g. F cannot be beyond 1 and when a calculator is applied to the same formula it comes around 0.1.
Result: F =
1.0087
1.0087
d0 =
-1.1697e+003
-1.1697e+003
h0 =
1.0303e+014 -7.4856e+013i
1.0303e+014 -7.4856e+013i
Tw =
314.2630
314.2630
Lf =
0.3670
0.3670
tf =
0.0025
0.0025
dbc =
0.0067
0.0067
cbt =
1.5030
1.5030
dtc =
1.5097
1.5097
ntubes =
1.5097
1.5097
Ar =
5.6371e+003
5.6371e+003
qr =
2.3992e+017 -1.7431e+017i
2.3992e+017 -1.7431e+017i

8 件のコメント

Torsten
Torsten 2018 年 3 月 15 日
I think you mean
F = (C - x + 2.*sinh(2./x))/(2.*pi);
instead of
F = (C - x + 2.*sinh(2./x))/2.*pi;
Best wishes
Torsten.
Devdatt Thengdi
Devdatt Thengdi 2018 年 3 月 15 日
Oh! Thanks. Anything about the first question?
Devdatt Thengdi
Devdatt Thengdi 2018 年 3 月 15 日
Also, could you tell me why the matrix dimensions do not agree here?
dbc = db./(sin(180./nb) + (pi./nb)); %Burner circle diameter
Torsten
Torsten 2018 年 3 月 15 日
Since you don't provide a mathematical problem formulation, there will be nobody in the forum who can answer questions with regards to content.
For your question above: Use the MATLAB debugger. Or print out db and nb before dbc is calculated.
Best wishes
Torsten.
Devdatt Thengdi
Devdatt Thengdi 2018 年 3 月 15 日
All I need to know " Why code is extending values of d0 beyond the range I have provided?" i.e. In the line:
lb = abs([0.01, 1, 283.15, 8, 10]);
ub = abs([10, 18.3, 1473.15 ,20, 50]);
[X, fval] = fmincon(fitnessfcn, x0, [], [], [], [], lb, ub, nonlcon1);
I have correctly bound d0 between 0.01:10. But, when you run the program:
d0 =
-1.1697e+003
-1.1697e+003
d0 is negative. Why is that? Is there any syntax error?
Torsten
Torsten 2018 年 3 月 15 日
And the output you list for the variables is right after you start fmincon ? Or after some iterations when h0 already became complex-valued ? If the latter is the case, this should explain why the calculation leaves senseful limits.
Devdatt Thengdi
Devdatt Thengdi 2018 年 3 月 15 日
編集済み: Devdatt Thengdi 2018 年 3 月 15 日
It is after some iterations. And how does this explain it? I mean I have set limits on the variables. I have set a nonlcon (on qr) so, there must some set of d0, L, Tg, nb, uo which qr lies between 32000:45000. What am I missing out on here? Is the program forcing values(d0) out of the bounds because there exists no qr (in the given range) for the given range of d0? Am I correct here?
Torsten
Torsten 2018 年 3 月 15 日
This might be the reason.
I suggest you make a pattern search:
Take a certain number of values for the variables d0, L, Tg, nb and uo between their respective lower and upper limits. Then calculate qr and qout for all combinations of these values and inspect whether you get feasible points for your problem.
Best wishes
Torsten.

サインインしてコメントする。

回答 (0 件)

タグ

質問済み:

2018 年 3 月 15 日

コメント済み:

2018 年 3 月 15 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by