0% found this document useful (0 votes)
11 views2 pages

Run 1

The document discusses using fmincon, a constrained optimization solver, on a stochastic and non-smooth objective function. It highlights the potential unreliability of derivative estimates due to noise, which may lead to suboptimal stopping points. The example illustrates the optimization process and results, including the final local minimum and a plot of the start and solution points.

Uploaded by

milad.gholamifar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Run 1

The document discusses using fmincon, a constrained optimization solver, on a stochastic and non-smooth objective function. It highlights the potential unreliability of derivative estimates due to noise, which may lead to suboptimal stopping points. The example illustrates the optimization process and results, including the final local minimum and a plot of the start and solution points.

Uploaded by

milad.gholamifar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Run fmincon on a Stochastic Objective Function

The perturbed objective function is stochastic and not smooth. fmincon is a general constrained
optimization solver which finds a local minimum using derivatives of the objective function. If
you do not provide the first derivatives of the objective function, fmincon uses finite differences
to approximate the derivatives. In this example, the objective function is random, so finite
difference estimates derivatives hence can be unreliable. fmincon can potentially stop at a point
that is not a minimum. This may happen because the optimal conditions seems to be satisfied at
the final point because of noise, or fmincon could not make further progress.
Get
[Xop,Fop] = fmincon(Objfcn,X0,[],[],[],[],LB,UB,[],options)
First-order Norm of
Iter F-count f(x) Feasibility optimality step
0 3 -1.925772e+01 0.000e+00 2.126e+08
1 6 -7.107849e+01 0.000e+00 2.623e+08 8.873e+00
2 11 -8.055890e+01 0.000e+00 2.401e+08 6.715e-01
3 20 -8.325315e+01 0.000e+00 7.348e+07 3.047e-01
4 48 -8.366302e+01 0.000e+00 1.762e+08 1.593e-07
5 64 -8.591081e+01 0.000e+00 1.569e+08 3.111e-10

Local minimum possible. Constraints satisfied.

fmincon stopped because the size of the current step is less than
the value of the step size tolerance and constraints are
satisfied to within the value of the constraint tolerance.
Xop = 1×2

-4.9628 2.6673

Fop =
-85.9108
Get
figure(fig);
hold on;
ph = [];
ph(1) = plot3(X0(1),X0(2),Objfcn(X0)+30,'or','MarkerSize',10,'MarkerFaceColor','r');
ph(2) = plot3(Xop(1),Xop(2),Fop,'dm','MarkerSize',10,'MarkerFaceColor','m');
% Add legend to plot
legendLabels = {'Start point','|fmincon| solution'};
lh = legend(ph,legendLabels,'Location','SouthEast');
lp = lh.Position;
lh.Position = [1-lp(3)-0.005 0.005 lp(3) lp(4)];
hold off;

You might also like