Optimizing minimization with fmincon function
1 回表示 (過去 30 日間)
古いコメントを表示
Dear all,
I have this function which I minimize:
g=randn(1000,1);
u=randn(1000,1);
y=randn(1000,1);
options = optimoptions('fmincon','Display','off');
f = @(x) sum( ( y-x(1)*g-u*x(2) ).^2 );
nonlcon = @unitdisk;
x = fmincon(f,[0.2 0.02],[],[],[],[],[],[],nonlcon,options);
where
function [c,ceq] = unitdisk(x)
c = - x(2) +0.01;
ceq = [];
Is there a faster way of doing this minimization?
Thanks in advance.
0 件のコメント
採用された回答
Sulaymon Eshkabilov
2019 年 5 月 25 日
Hi,
By setting up the solver algorithm in the option settings, the simulation time cna be shortened substantially. E.g.
g=randn(1000,1);
u=randn(1000,1);
y=randn(1000,1);
options = optimoptions('fmincon','Display','off', 'Algorithm', 'active-set');
f = @(x) sum( ( y-x(1)*g-u*x(2) ).^2 );
nonlcon = @unitdisk;
x = fmincon(f,[0.2 0.02],[],[],[],[],[],[],nonlcon,options);
This algorithm shortens the computation time by about 50%. If you are not satisfied with this, you can investigate furthermore with the option settings for fmincon.
Good luck.
2 件のコメント
Sulaymon Eshkabilov
2019 年 5 月 26 日
hi,
Again if you post your example, that would be good to answer specifically w.r.t your problem constraints.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!