1 / 9

Optimalization Toolbox

Optimalization Toolbox. Fmincon(). Štefan Kolesár. Inputs. x, b, beq, lb, ub sú vektory , A , Aeq sú matice c(x) , ceq(x) sú funkcie , ktoré vracajú vektor Funkčná hodnota f(x) je skalár f(x), c(x), ceq(x) – môžu b y ť nelineárne. Syntax. x = fmincon(fun,x0,A,b)

aileen
Download Presentation

Optimalization Toolbox

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Optimalization Toolbox Fmincon() Štefan Kolesár

  2. Inputs • x, b, beq, lb, ub sú vektory, • A, Aeq sú matice • c(x), ceq(x) sú funkcie, ktoré vracajú vektor • Funkčná hodnota f(x) je skalár • f(x), c(x), ceq(x) – môžu byť nelineárne

  3. Syntax • x = fmincon(fun,x0,A,b) • x = fmincon(fun,x0,A,b,Aeq,beq) • x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub) • x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon) • x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options) • x = fmincon(problem) • [x,fval] = fmincon(...) • [x,fval,exitflag] = fmincon(...) • [x,fval,exitflag,output] = fmincon(...) • [x,fval,exitflag,output,lambda] = fmincon(...) • [x,fval,exitflag,output,lambda,grad] = fmincon(...) • [x,fval,exitflag,output,lambda,grad,hessian] = fmincon(...)

  4. Options • options = optimset('GradConstr','on') • options = optimset('Hessian','user-supplied'); • options = optimset( 'HessFcn',@hessianfcn'); • options=optimset('Algorithm', 'trust-region-reflective'); • options=optimset('Algorithm','active-set'); %default • options=optimset('Algorithm','interior-point'); • options=optimset('Algorithm',’sqp');

  5. Output • [….output….] • Iterations – počet iterácií • funcCount – počet výpočtov funkčných hodnôt • Lssteplength – dĺžka jedno-rozmer. kroku v pomere k smeru vyhľadávania • Constrviolation – počet funkcií podmienky • Stepsize – dĺžka kroku • algorithm

  6. Príklad 1. • Najdite optimálne x f(x) = –x1*x2*x3, štartovacie body x = [10;10;10], za podmienky • 0 ≤ x1 + 2*x2 + 2*x3 ≤ 72. • Zapíšeme funkciu: function f = myfun(x) f = -x(1) * x(2) * x(3); • Nerovnice podmienok –x1–2*x2–2*x3 ≤ 0 x1 + 2*x2 + 2*x3≤ 72 • Obidve podmienky sú lineárne, zostavíme matice pravej a ľavej strany A = [-1 -2 -2; ... 1 2 2]; b = [0;72];

  7. Príklad 1. • x0 = [10;10;10]; %štartovacie body • [x,fval] = fmincon(@myfun,x0,A,b); • Po 11tich interáciach x x = 24.0000 12.0000 12.0000 Funkčná hodnota: fval fval = -3.4560e+03 • Overíme túto lineárnu nerovnosť podmienok (očakávame =<0|: A*x-b ans = -72 0

  8. Príklad z cvičenia    options = optimset('Algorithm','interior-point');    x = fmincon(@(x) myfun(x),[1;10],[],[],[],[],[],[],@(x) mycon(x),options)Do zvlášť súborov:   function [c,ceq] = mycon(x)         c = x(1)^2 + 4*x(2)^2 -100;         ceq = [];       function f = myfun(x)         f = x(1)^2 - 48*x(1) - 48*x(2);      

  9. Interior Point Algorithm • Problém (bariérova funkcia): • Možné riešenie pre μ>0

More Related