0% found this document useful (0 votes)
5 views

Optimization of Stochastic Objective Function

This document provides an example of using patternsearch to find the minimum of a stochastic objective function, highlighting the unsuitability of Optimization Toolbox™ solvers for such problems. It initializes a simple 2-dimensional objective function, perturbed by noise, and sets bounds for optimization. Additionally, it includes MATLAB code to visualize the smooth objective function and the starting point for optimization.

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)
5 views

Optimization of Stochastic Objective Function

This document provides an example of using patternsearch to find the minimum of a stochastic objective function, highlighting the unsuitability of Optimization Toolbox™ solvers for such problems. It initializes a simple 2-dimensional objective function, perturbed by noise, and sets bounds for optimization. Additionally, it includes MATLAB code to visualize the smooth objective function and the starting point for optimization.

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

Optimization of Stochastic Objective Function

Open in MATLAB OnlineCopy Code Copy Command


This example shows how to find a minimum of a stochastic objective function
using patternsearch. It also shows how Optimization Toolbox™ solvers are not suitable for this
type of problem. The example uses a simple 2-dimensional objective function that is then
perturbed by noise.
Initialization
Get
X0 = [2.5 -2.5]; % Starting point.
LB = [-5 -5]; % Lower bound
UB = [5 5]; % Upper bound
range = [LB(1) UB(1); LB(2) UB(2)];
Objfcn = @smoothFcn; % Handle to the objective function.
% Plot the smooth objective function
fig = figure('Color','w');
showSmoothFcn(Objfcn,range);
hold on;
title('Smooth objective function');
ph = [];
ph(1) = plot3(X0(1),X0(2),Objfcn(X0)+30,'or','MarkerSize',10,'MarkerFaceColor','r');
hold off;
ax = gca;
ax.CameraPosition = [-31.0391 -85.2792 -281.4265];
ax.CameraTarget = [0 0 -50];
ax.CameraViewAngle = 6.7937;
% Add legend information
legendLabels = {'Start point'};
lh = legend(ph,legendLabels,'Location','SouthEast');
lp = lh.Position;
lh.Position = [1-lp(3)-0.005 0.005 lp(3) lp(4)];

You might also like