フィルターのクリア

fmincon, find integer values as optimal values

5 ビュー (過去 30 日間)
Mohamed Musni
Mohamed Musni 2018 年 2 月 1 日
コメント済み: Mohamed Musni 2018 年 2 月 1 日
f =@(fr)(50*fr(1)^2 + 100)/fr(1) + (175*fr(2)^2 + 150)/fr(2) + (160*fr(3)^2 + 250)/fr(3)
lb = [0,0,0];
ub = [5,5,5];
A = [];
b = [];
Aeq = [];
beq = [];
fr0 = [1,1,1];
fr = fmincon(f,fr0,A,b,Aeq,beq,lb,ub)
output:
f =
function_handle with value:
@(fr)(50*fr(1)^2+100)/fr(1)+(175*fr(2)^2+150)/fr(2)+(160*fr(3)^2+250)/fr(3)
Local minimum possible. Constraints satisfied.
fmincon stopped because the size of the current step is less than
the default value of the step size tolerance and constraints are
satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
fr =
1.4142 0.9258 1.2500
I want to find positive integer values rather than decimal values for my variables. is there any way to include this condition with fmincon? any help will be highly appreciated. thank you

採用された回答

Sean de Wolski
Sean de Wolski 2018 年 2 月 1 日
編集済み: Sean de Wolski 2018 年 2 月 1 日
fmincon is not designed to deal with integer x values. You should try ga() which has an IntCon option or patternsearch() with a round() on the input values.
Of course for a small problem like this there are only 216 unique combinations of x so you could easily brute force it.
[rr,cc,pp] = ndgrid(0:5);
v = (50*rr.^2 + 100)./rr + (175*cc.^2 + 150)./cc + (160*pp.^2 + 250)./pp;
[val, idx] = min(v(:));
[rr(idx) cc(idx) pp(idx)]
  1 件のコメント
Mohamed Musni
Mohamed Musni 2018 年 2 月 1 日
thank you. I found tutorial with ga() and abled to get answer with integer values. have a nice day

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by