solve non-linear optimization problem
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
how to maximize this nonlinear function z and find the value of x and y,
z= 0.031 {0.009[exp(x-z)-1]+x/1.14}-(-1+√(1+y^4/x))/y
10<=x<=20 and y>=0
採用された回答
Matt J
2021 年 4 月 26 日
With fmincon, if you have Optimization Toolbox.
19 件のコメント
Hayam Wahdan
2021 年 4 月 26 日
The main problem of this optimization problem, the objective function z is calculated in terms of the same value of z
You "objective" is really an equality constraint:

Hayam Wahdan
2021 年 4 月 26 日
After this assumption, the problem contains three decision variables x,y and z?
Matt J
2021 年 4 月 26 日
Yes, that's right.
Hayam Wahdan
2021 年 4 月 26 日
How fminco function solve this optimization problem
Min -Z
St
Z-....=0
d>=100
d<=300
v>=0
Matt J
2021 年 4 月 26 日
Did you already get it to work on your original problem, and if so how is this new version different?
Hayam Wahdan
2021 年 4 月 26 日
I want to ask, can this function solve this optimization problem subject to non-linear constraints
Walter Roberson
2021 年 4 月 26 日
Yes, see the nonlcon parameter of fmincon.
I want to ask, can this function solve this optimization problem subject to non-linear constraints
Yes, see this example in the documentation:
Note that you don't really have to ensure that the initial guess satisfy the constraints, as they do in the example, but it can be beneficial to do so.
Hayam Wahdan
2021 年 4 月 27 日
Can you help me in writing this MATLAB function Min -Z St z= 0.031 {0.009[exp(x-z)-1]+x/1.14}-(-1+√(1+y^4/x))/y 10<=x<=20 and y>0
Walter Roberson
2021 年 4 月 28 日
編集済み: Walter Roberson
2021 年 4 月 28 日
fmincon thinks you can get an arbitrarily large result if you make y arbitrarily large.
format long g
obj = @(xyz) -xyz(3);
A = []; b = []; Aeq = []; beq = [];
lb = [10, realmin, -inf];
ub = [20 1e9 1e9];
nl = @(x,y,z) 0.031*(0.009*(exp(x-z)-1)+x./1.14)-(-1+sqrt(1+y^4./x))./y - z
nl = function_handle with value:
@(x,y,z)0.031*(0.009*(exp(x-z)-1)+x./1.14)-(-1+sqrt(1+y^4./x))./y-z
nonlcon = @(xyz) deal(nl(xyz(1), xyz(2), xyz(3)), []);
xyz0 = [.1 .2 .3]
xyz0 = 1×3
0.1 0.2 0.3
[best, fval] = fmincon(obj, xyz0, A, b, Aeq, beq, lb, ub, nonlcon)
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the value of the optimality tolerance,
and constraints are satisfied to within the value of the constraint tolerance.
best = 1×3
17.9264664551072 190469849.537475 999999999.999999
fval =
-999999999.999999
Walter Roberson
2021 年 4 月 28 日
Please re-check your equations. I suspect that the sqrt() is intended to extend over the /y as well, which is not what you have coded.
Hayam Wahdan
2021 年 4 月 28 日
Thank you very much for your quick reply,
when i tried this code, gave me error in this line
[best, fval] = fmincon(obj, v0, A, b, Aeq, beq, lb, ub, nonlcon)
Walter Roberson
2021 年 4 月 28 日
What was the error message?
Hayam Wahdan
2021 年 4 月 28 日
Error using barrier
Nonlinear constraint function is undefined at initial point. Fmincon cannot continue.
Error in fmincon (line 798)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, ...
Error in nonlinear (line 11)
[best, fval] = fmincon(obj, vdJ0, A, b, Aeq, beq, lb, ub, nonlcon)
Walter Roberson
2021 年 4 月 28 日
please post the complete code you used.
Hayam Wahdan
2021 年 4 月 28 日
編集済み: Walter Roberson
2021 年 4 月 28 日
format long g
obj = @(xyz) -xyz(3);
A = []; b = []; Aeq = []; beq = [];
lb = [100, realmin, -inf];
ub = [300 1e9 1e9];
%nl = @(x,y,z) 0.031*(0.009*(exp(x-z)-1)+x./1.14)-(-1+sqrt(1+y^4./x))./y - z
w=10^-15*exp(-2.897*10^22*25^-1);
nl = @(x,y,z) 0.055*(w*(exp(5802*(x-19.5*z))-1)+x./1.14)-(-1+sqrt(1+0.5272*y^4./x^2.))/(2.6328 *10^9*y) - z;
nonlcon = @(xyz) deal(nl(xyz(1), xyz(2), xyz(3)), []);
xyz0 = [.1 .2 .3];
[best, fval] = fmincon(obj, xyz0, A, b, Aeq, beq, lb, ub, nonlcon)
Walter Roberson
2021 年 4 月 28 日
w=10^-15*exp(-2.897*10^22*25^-1);
You badly need to rescale !!
exp(-1158800000000000000000) is about 
Effectively your w is 0.
Hayam Wahdan
2021 年 4 月 28 日
Thank you very much, I will rescale it
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Systems of Nonlinear Equations についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
