Run fmincon with different initial value

I have an optimization problem with nonlinear inequality.I write the MATLAB code using fmincon given below. Now,i want to run the code for different initial point using a loop for check the value..How can i do it?
r=1;
d=80;
a=2.0944;
c = @(x)[(a.*x(1).^2./(4*r)) + ((a/2 + 2).*x(1))- x(2);
-(a.*x(1).^2./(4*r))- ((a/2 + 2).*x(1))+((2*d)+((a*d)/2)+(a*d.^2)/(4*r)-(4*r))-x(2)];
ceq = @(x)[ ];
nonlinfcn = @(x)deal(c(x),ceq(x));
obj = @(x)x(2);
opts = optimoptions(@fmincon,'Algorithm','interior-point');
[x,fval,exitflag] = fmincon(obj,[10;100],[],[],[],[],[10;100],[500;100000],nonlinfcn,opts);

 採用された回答

Torsten
Torsten 2015 年 7 月 13 日
編集済み: Walter Roberson 2015 年 7 月 13 日

1 投票

for j=1:n
x0=[x10(j);x20(j)];
[x,fval,exitflag] = fmincon(obj,x0,[],[],[],[],[10;100],[500;100000],nonlinfcn,opts);
disp(x);
end
where x10 and x20 are predefined arrays of initial values for x1 and x2.
Best wishes
Torsten.

3 件のコメント

rumpa dasgupta
rumpa dasgupta 2015 年 7 月 13 日
Thank you for your reply...
rumpa dasgupta
rumpa dasgupta 2015 年 7 月 14 日
Torsten, If i want to run the code for random initial value instead of predefined array of initial values for x1 and x2,then how can i do it?
Torsten
Torsten 2015 年 7 月 14 日

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

タグ

質問済み:

2015 年 7 月 13 日

コメント済み:

2015 年 7 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by