patternsearch
Find minimum of function using pattern search
Syntax
Description
finds
a local minimum, x
= patternsearch(fun
,x0
)x
, to the function handle fun
that
computes the values of the objective function. x0
is
a real vector specifying an initial point for the pattern search algorithm.
Note
Passing Extra Parameters explains how to pass extra parameters to the objective function and nonlinear constraint functions, if necessary.
defines
a set of lower and upper bounds on the design variables in x
= patternsearch(fun
,x0
,A
,b
,Aeq
,beq
,lb
,ub
)x
,
so that the solution is always in the range lb
≤ x
≤ ub
.
If no linear equalities exist, set Aeq = []
and beq
= []
. If x(i)
has no lower bound, set lb(i)
= Inf
. If x(i)
has no upper bound, set ub(i)
= Inf
.
Examples
Unconstrained Pattern Search Minimization
Minimize an unconstrained problem using the patternsearch
solver.
Create the following twovariable objective function. On your MATLAB® path, save the following code to a file named psobj.m
.
function y = psobj(x)
y = exp(x(1)^2x(2)^2)*(1+5*x(1) + 6*x(2) + 12*x(1)*cos(x(2)));
Set the objective function to @psobj
.
fun = @psobj;
Find the minimum, starting at the point [0,0]
.
x0 = [0,0]; x = patternsearch(fun,x0)
Optimization terminated: mesh size less than options.MeshTolerance. x = 0.7037 0.1860
Pattern Search with a Linear Inequality Constraint
Minimize a function subject to some linear inequality constraints.
Create the following twovariable objective function. On your MATLAB® path, save the following code to a file named psobj.m
.
function y = psobj(x)
y = exp(x(1)^2x(2)^2)*(1+5*x(1) + 6*x(2) + 12*x(1)*cos(x(2)));
Set the objective function to @psobj
.
fun = @psobj;
Set the two linear inequality constraints.
A = [3,2; 4,7]; b = [1;8];
Find the minimum, starting at the point [0.5,0.5]
.
x0 = [0.5,0.5]; x = patternsearch(fun,x0,A,b)
Optimization terminated: mesh size less than options.MeshTolerance. x = 5.2827 1.8758
Pattern Search with Bounds
Find the minimum of a function that has only bound constraints.
Create the following twovariable objective function. On your MATLAB® path, save the following code to a file named psobj.m
.
function y = psobj(x)
y = exp(x(1)^2x(2)^2)*(1+5*x(1) + 6*x(2) + 12*x(1)*cos(x(2)));
Set the objective function to @psobj
.
fun = @psobj;
Find the minimum when and .
lb = [0,Inf]; ub = [Inf,3]; A = []; b = []; Aeq = []; beq = [];
Find the minimum, starting at the point [1,5]
.
x0 = [1,5]; x = patternsearch(fun,x0,A,b,Aeq,beq,lb,ub)
Optimization terminated: mesh size less than options.MeshTolerance. x = 0.1880 3.0000
Pattern Search with Nonlinear Constraints
Find the minimum of a function subject to a nonlinear inequality constraint.
Create the following twovariable objective function. On your MATLAB® path, save the following code to a file named psobj.m
.
function y = psobj(x)
y = exp(x(1)^2x(2)^2)*(1+5*x(1) + 6*x(2) + 12*x(1)*cos(x(2)));
Set the objective function to @psobj
.
fun = @psobj;
Create the nonlinear constraint
To do so, on your MATLAB path, save the following code to a file named ellipsetilt.m
.
function [c,ceq] = ellipsetilt(x)
ceq = [];
c = x(1)*x(2)/2 + (x(1)+2)^2 + (x(2)2)^2/2  2;
Start patternsearch
from the initial point [2,2]
.
x0 = [2,2]; A = []; b = []; Aeq = []; beq = []; lb = []; ub = []; nonlcon = @ellipsetilt; x = patternsearch(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon)
Optimization terminated: mesh size less than options.MeshTolerance and constraint violation is less than options.ConstraintTolerance. x = 1.5144 0.0875
Try Different patternsearch
Algorithms
Sometimes the different patternsearch
algorithms have noticeably different behavior. While it can be difficult to predict which algorithm works best for a problem, you can easily try different algorithms. For this example, use the sawtoothxy
objective function, which is available when you run this example, and which is described and plotted in Find Global or Multiple Local Minima.
type sawtoothxy
function f = sawtoothxy(x,y) [t r] = cart2pol(x,y); % change to polar coordinates h = cos(2*t  1/2)/2 + cos(t) + 2; g = (sin(r)  sin(2*r)/2 + sin(3*r)/3  sin(4*r)/4 + 4) ... .*r.^2./(r+1); f = g.*h; end
To see the behavior of the different algorithms when minimizing this objective function, set some asymmetric bounds. Also set an initial point x0
that is far from the true solution sol = [0 0]
, where sawtoothxy(0,0) = 0
.
rng default
x0 = 12*randn(1,2);
lb = [15,26];
ub = [26,15];
fun = @(x)sawtoothxy(x(1),x(2));
Minimize the sawtoothxy
function using the "classic"
patternsearch
algorithm.
optsc = optimoptions("patternsearch",Algorithm="classic"); [sol,fval,eflag,output] = patternsearch(fun,... x0,[],[],[],[],lb,ub,[],optsc)
Optimization terminated: mesh size less than options.MeshTolerance.
sol = 1×2
10^{5} ×
0.9825 0
fval = 1.3278e09
eflag = 1
output = struct with fields:
function: @(x)sawtoothxy(x(1),x(2))
problemtype: 'boundconstraints'
pollmethod: 'gpspositivebasis2n'
maxconstraint: 0
searchmethod: []
iterations: 52
funccount: 168
meshsize: 9.5367e07
rngstate: [1×1 struct]
message: 'Optimization terminated: mesh size less than options.MeshTolerance.'
The "classic"
algorithm reaches the global solution in 52 iterations and 168 function evaluations.
Try the "nups"
algorithm.
rng default % For reproducibility optsn = optimoptions("patternsearch",Algorithm="nups"); [sol,fval,eflag,output] = patternsearch(fun,... x0,[],[],[],[],lb,ub,[],optsn)
Optimization terminated: mesh size less than options.MeshTolerance.
sol = 1×2
6.3204 15.0000
fval = 85.9256
eflag = 1
output = struct with fields:
function: @(x)sawtoothxy(x(1),x(2))
problemtype: 'boundconstraints'
pollmethod: 'nups'
maxconstraint: 0
searchmethod: []
iterations: 29
funccount: 88
meshsize: 7.1526e07
rngstate: [1×1 struct]
message: 'Optimization terminated: mesh size less than options.MeshTolerance.'
This time the solver reaches a local solution in just 29 iterations and 88 function evaluations, but the solution is not the global solution.
Try using the "nupsmads"
algorithm, which takes no steps in the coordinate directions.
rng default % For reproducibility optsm = optimoptions("patternsearch",Algorithm="nupsmads"); [sol,fval,eflag,output] = patternsearch(fun,... x0,[],[],[],[],lb,ub,[],optsm)
Optimization terminated: mesh size less than options.MeshTolerance.
sol = 1×2
10^{4} ×
0.5275 0.0806
fval = 1.5477e08
eflag = 1
output = struct with fields:
function: @(x)sawtoothxy(x(1),x(2))
problemtype: 'boundconstraints'
pollmethod: 'nupsmads'
maxconstraint: 0
searchmethod: []
iterations: 55
funccount: 189
meshsize: 9.5367e07
rngstate: [1×1 struct]
message: 'Optimization terminated: mesh size less than options.MeshTolerance.'
This time, the solver reaches the global solution in 55 iterations and 189 function evaluations, which is similar to the 'classic'
algorithm.
Pattern Search with Nondefault Options
Set options to observe the progress of the patternsearch
solution
process.
Create the following twovariable objective function.
On your MATLAB^{®} path, save the following code to a file named psobj.m
.
function y = psobj(x)
y = exp(x(1)^2x(2)^2)*(1+5*x(1) + 6*x(2) + 12*x(1)*cos(x(2)));
Set the objective function to @psobj
.
fun = @psobj;
Set options
to give iterative display
and to plot the objective function at each iteration.
options = optimoptions('patternsearch','Display','iter','PlotFcn',@psplotbestf);
Find the unconstrained minimum of the objective starting
from the point [0,0]
.
x0 = [0,0]; A = []; b = []; Aeq = []; beq = []; lb = []; ub = []; nonlcon = []; x = patternsearch(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)
Iter fcount f(x) MeshSize Method 0 1 1 1 1 4 5.88607 2 Successful Poll 2 8 5.88607 1 Refine Mesh 3 12 5.88607 0.5 Refine Mesh 4 16 5.88607 0.25 Refine Mesh (output trimmed) 63 218 7.02545 1.907e06 Refine Mesh 64 221 7.02545 3.815e06 Successful Poll 65 225 7.02545 1.907e06 Refine Mesh 66 229 7.02545 9.537e07 Refine Mesh Optimization terminated: mesh size less than options.MeshTolerance. x = 0.7037 0.1860
Obtain Function Value And Minimizing Point
Find a minimum value of a function and report both the location and value of the minimum.
Create the following twovariable objective function. On your MATLAB® path, save the following code to a file named psobj.m
.
function y = psobj(x)
y = exp(x(1)^2x(2)^2)*(1+5*x(1) + 6*x(2) + 12*x(1)*cos(x(2)));
Set the objective function to @psobj
.
fun = @psobj;
Find the unconstrained minimum of the objective, starting from the point [0,0]
. Return both the location of the minimum, x
, and the value of fun(x)
.
x0 = [0,0]; [x,fval] = patternsearch(fun,x0)
Optimization terminated: mesh size less than options.MeshTolerance. x = 0.7037 0.1860 fval = 7.0254
Obtain All Outputs
To examine the patternsearch
solution process, obtain all outputs.
Create the following twovariable objective function. On your MATLAB® path, save the following code to a file named psobj.m
.
function y = psobj(x)
y = exp(x(1)^2x(2)^2)*(1+5*x(1) + 6*x(2) + 12*x(1)*cos(x(2)));
Set the objective function to @psobj
.
fun = @psobj;
Find the unconstrained minimum of the objective, starting from the point [0,0]
. Return the solution, x
, the objective function value at the solution, fun(x)
, the exit flag, and the output structure.
x0 = [0,0]; [x,fval,exitflag,output] = patternsearch(fun,x0)
Optimization terminated: mesh size less than options.MeshTolerance. x = 0.7037 0.1860 fval = 7.0254 exitflag = 1 output = struct with fields: function: @psobj problemtype: 'unconstrained' pollmethod: 'gpspositivebasis2n' maxconstraint: [] searchmethod: [] iterations: 66 funccount: 229 meshsize: 9.5367e07 rngstate: [1x1 struct] message: 'Optimization terminated: mesh size less than options.MeshTolerance.'
The exitflag
is 1
, indicating convergence to a local minimum.
The output
structure includes information such as how many iterations patternsearch
took, and how many function evaluations. Compare this output structure with the results from Pattern Search with Nondefault Options. In that example, you obtain some of this information, but did not obtain, for example, the number of function evaluations.
Input Arguments
fun
— Function to be minimized
function handle  function name
Function to be minimized, specified as a function handle or
function name. The fun
function accepts a vector x
and
returns a real scalar f
, which is the objective
function evaluated at x
.
You can specify fun
as a function handle
for a file
x = patternsearch(@myfun,x0)
Here, myfun
is a MATLAB function such
as
function f = myfun(x) f = ... % Compute function value at x
fun
can also be a function handle for an
anonymous function
x = patternsearch(@(x)norm(x)^2,x0,A,b);
Example: fun = @(x)sin(x(1))*cos(x(2))
Data Types: char
 function_handle
 string
x0
— Initial point
real vector
Initial point, specified as a real vector. patternsearch
uses
the number of elements in x0
to determine the number
of variables that fun
accepts.
Example: x0 = [1,2,3,4]
Data Types: double
A
— Linear inequality constraints
real matrix
Linear inequality constraints, specified as a real matrix. A
is an M
bynvars
matrix, where M
is the number of inequalities.
A
encodes the M
linear inequalities
A*x <= b
,
where x
is the column vector of nvars
variables x(:)
, and b
is a column vector with M
elements.
For example, to specify
x_{1} + 2x_{2} ≤ 10
3x_{1} + 4x_{2} ≤ 20
5x_{1} + 6x_{2} ≤ 30,
give these constraints:
A = [1,2;3,4;5,6]; b = [10;20;30];
Example: To specify that the control variables sum to 1 or less, give the constraints
A = ones(1,N)
and b = 1
.
Data Types: double
b
— Linear inequality constraints
real vector
Linear inequality constraints, specified as a real vector. b
is an M
element vector related to the A
matrix. If you pass b
as a row vector, solvers internally convert b
to the column vector b(:)
.
b
encodes the M
linear inequalities
A*x <= b
,
where x
is the column vector of N
variables x(:)
, and A
is a matrix of size M
byN
.
For example, to specify
x_{1} + 2x_{2} ≤ 10
3x_{1} + 4x_{2} ≤ 20
5x_{1} + 6x_{2} ≤ 30,
give these constraints:
A = [1,2;3,4;5,6]; b = [10;20;30];
Example: To specify that the control variables sum to 1 or less, give the constraints
A = ones(1,N)
and b = 1
.
Data Types: double
Aeq
— Linear equality constraints
real matrix
Linear equality constraints, specified as a real matrix. Aeq
is an Me
bynvars
matrix, where Me
is the number of equalities.
Aeq
encodes the Me
linear equalities
Aeq*x = beq
,
where x
is the column vector of N
variables x(:)
, and beq
is a column vector with Me
elements.
For example, to specify
x_{1}
+ 2x_{2} +
3x_{3} =
10
2x_{1}
+ 4x_{2} +
x_{3} =
20,
give these constraints:
Aeq = [1,2,3;2,4,1]; beq = [10;20];
Example: To specify that the control variables sum to 1, give the constraints Aeq =
ones(1,N)
and beq = 1
.
Data Types: double
beq
— Linear equality constraints
real vector
Linear equality constraints, specified as a real vector. beq
is an Me
element vector related to the Aeq
matrix. If you pass beq
as a row vector, solvers internally convert beq
to the column vector beq(:)
.
beq
encodes the Me
linear equalities
Aeq*x = beq
,
where x
is the column vector of N
variables x(:)
, and Aeq
is a matrix of size Meq
byN
.
For example, to specify
x_{1}
+ 2x_{2} +
3x_{3} =
10
2x_{1}
+ 4x_{2} +
x_{3} =
20,
give these constraints:
Aeq = [1,2,3;2,4,1]; beq = [10;20];
Example: To specify that the control variables sum to 1, give the constraints Aeq =
ones(1,N)
and beq = 1
.
Data Types: double
lb
— Lower bounds
real vector  real array
Lower bounds, specified as a real vector or real array. If the
number of elements in x0
is equal to that of lb
,
then lb
specifies that
x(i) >= lb(i)
for all i
.
If numel(lb) < numel(x0)
, then lb
specifies
that
x(i) >= lb(i)
for
1 <= i <= numel(lb)
In this case, solvers issue a warning.
Example: To specify that all control variables are positive, lb
= zeros(size(x0))
Data Types: double
ub
— Upper bounds
real vector  real array
Upper bounds, specified as a real vector or real array. If the
number of elements in x0
is equal to that of ub
,
then ub
specifies that
x(i) <= ub(i)
for all i
.
If numel(ub) < numel(x0)
, then ub
specifies
that
x(i) <= ub(i)
for
1 <= i <= numel(ub)
In this case, solvers issue a warning.
Example: To specify that all control variables are less than
one, ub = ones(size(x0))
Data Types: double
nonlcon
— Nonlinear constraints
function handle  function name
Nonlinear constraints, specified as a function handle or function
name. nonlcon
is a function that accepts a vector
or array x
and returns two arrays, c(x)
and ceq(x)
.
c(x)
is the array of nonlinear inequality constraints atx
.patternsearch
attempts to satisfyc(x) <= 0
for all entries of
c
.ceq(x)
is the array of nonlinear equality constraints atx
.patternsearch
attempts to satisfyceq(x) = 0
for all entries of
ceq
.
For example,
x = patternsearch(@myfun,x0,A,b,Aeq,beq,lb,ub,@mycon)
where mycon
is a MATLAB function such
as
function [c,ceq] = mycon(x) c = ... % Compute nonlinear inequalities at x. ceq = ... % Compute nonlinear equalities at x.
Data Types: char
 function_handle
 string
options
— Optimization options
object returned by optimoptions
 structure
Optimization options, specified as an object returned by optimoptions
(recommended), or a structure.
The following table describes the optimization options. optimoptions
hides the options shown in italics; see Options that optimoptions Hides. {}
denotes the default value. See option details in Pattern Search Options.
Options for patternsearch
Option  Description  Values 

Algorithm  Algorithm used by patternsearch . The
Algorithm setting affects the available options. For
algorithm details, see How Pattern Search Polling Works and Nonuniform Pattern Search (NUPS) Algorithm.  {"classic"}  "nups" 
"nupsgps"  "nupsmads" 
Cache  With Note


CacheSize  Size of the history.  Positive scalar  
CacheTol  Largest distance from the current mesh point to any point in the
history in order for  Positive scalar  
 Tolerance on constraints. For an options structure, use  Positive scalar  
 Level of display, meaning how much information  "off"  "iter"  "diagnose" 
{"final"} 
FunctionTolerance  Tolerance on the function. Iterations stop if the change in
function value is less than For an options structure, use
 Positive scalar  
InitialMeshSize  Initial mesh size for the algorithm. See How Pattern Search Polling Works.  Positive scalar  
InitialPenalty  Initial value of the penalty parameter. See Nonlinear Constraint Solver Algorithm.  Positive scalar  
 Maximum number of objective function evaluations. For an options structure, use  Positive integer  
 Maximum number of iterations. For an options structure, use  Positive integer  
MaxMeshSize  Maximum mesh size used in a poll or search step. See How Pattern Search Polling Works.  Positive scalar  
 Total time (in seconds) allowed for optimization. For an options structure, use  Positive scalar  
MeshContractionFactor  Mesh contraction factor for an unsuccessful iteration. This option applies only when For an options structure, use
 Positive scalar  
MeshExpansionFactor  Mesh expansion factor for a successful iteration. This option applies only when For an options structure, use
 Positive scalar  
MeshRotate  Flag to rotate the pattern before declaring a point to be optimum. See Mesh Options. This option applies only when 

 Tolerance on the mesh size. For an options structure, use
 Positive scalar  
 Function called by an optimization function at each iteration. Specify as a function handle or a cell array of function handles. For an options
structure, use  
PenaltyFactor  Penalty update parameter. See Nonlinear Constraint Solver Algorithm.  Positive scalar  
 Plots of output from the pattern search. Specify as the name of a builtin plot function, a function handle, or a cell array of names of builtin plot functions or function handles. For an options structure, use


PlotInterval  Number of iterations for plots.  positive integer  
 Polling strategy used in the pattern search. This option applies only when Note You cannot use MADS polling when the problem has linear equality constraints. 

PollOrderAlgorithm  Order of the poll directions in the pattern search. This option applies only when For an options structure, use


ScaleMesh  Automatic scaling of variables. For an options
structure, use 

SearchFcn  Type of search used in the pattern search. Specify as a name or a function handle. For an options structure, use


StepTolerance  Tolerance on the variable. Iterations stop if both the change in
position and the mesh size are less than
For an options structure, use
 Positive scalar  
TolBind  Binding tolerance. See Constraint Parameters.  Positive scalar  
UseCompletePoll  Flag to complete the poll around the current point. See How Pattern Search Polling Works. This option applies only when Note For the Beginning in R2019a, when you set the
For an options structure, use 

UseCompleteSearch  Flag to complete the search around the current point when the search method is a poll method. See Searching and Polling. This option applies only when Note For the For an options structure, use 

 Flag to compute objective and nonlinear constraint functions in parallel. See Vectorized and Parallel Options and How to Use Parallel Processing in Global Optimization Toolbox. Note For the Beginning in R2019a, when you set the
Note


 Specifies whether functions are vectorized. See Vectorized and Parallel Options and Vectorize the Objective and Constraint Functions. Note For the For an options structure, use 

Example: options =
optimoptions("patternsearch",MaxIterations=150,MeshTolerance=1e4)
problem
— Problem structure
structure
Problem structure, specified as a structure with the following fields:
objective
— Objective functionx0
— Starting pointAineq
— Matrix for linear inequality constraintsbineq
— Vector for linear inequality constraintsAeq
— Matrix for linear equality constraintsbeq
— Vector for linear equality constraintslb
— Lower bound forx
ub
— Upper bound forx
nonlcon
— Nonlinear constraint functionsolver
—'patternsearch'
options
— Options created withoptimoptions
or a structurerngstate
— Optional field to reset the state of the random number generator
Note
All fields in problem
are required except for
rngstate
.
Data Types: struct
Output Arguments
fval
— Objective function value at the solution
real number
Objective function value at the solution, returned as a real number. Generally, fval
= fun(x)
.
exitflag
— Reason patternsearch
stopped
integer
Reason patternsearch
stopped, returned
as an integer.
Exit Flag  Meaning 

 Without nonlinear constraints —
The magnitude of the mesh size is less than the specified tolerance,
and the constraint violation is less than 
With nonlinear constraints — The magnitude of the
complementarity measure (defined after
this table) is less than
 
 The change in 
 The change in 
 The magnitude of the step is smaller than machine precision,
and the constraint violation is less than 
 The maximum number of function evaluations or iterations is reached. 
 Optimization terminated by an output function or plot function. 
 No feasible point found. 
In the nonlinear constraint solver, the complementarity measure is the norm of the vector whose elements are c_{i}λ_{i}, where c_{i} is the nonlinear inequality constraint violation, and λ_{i} is the corresponding Lagrange multiplier.
output
— Information about the optimization process
structure
Information about the optimization process, returned as a structure with these fields:
function
— Objective function.problemtype
— Problem type, one of:'unconstrained'
'boundconstraints'
'linearconstraints'
'nonlinearconstr'
pollmethod
— Polling technique.searchmethod
— Search technique used, if any.iterations
— Total number of iterations.funccount
— Total number of function evaluations.meshsize
— Mesh size atx
.maxconstraint
— Maximum constraint violation, if any.rngstate
— State of the MATLAB random number generator, just before the algorithm started. You can use the values inrngstate
to reproduce the output when you use a random search method or random poll method. See Reproduce Results, which discusses the identical technique forga
.message
— Reason why the algorithm terminated.
Algorithms
By default and in the absence of linear constraints, patternsearch
looks
for a minimum based on an adaptive mesh that is aligned with the coordinate directions. See
What Is Direct Search? and How Pattern Search Polling Works.
When you set the Algorithm
option to "nups"
or one
of its variants, patternsearch
uses the algorithm described in Nonuniform Pattern Search (NUPS) Algorithm. This algorithm is different
from the default algorithm in several ways; for example, it has fewer options to
set.
Alternative Functionality
App
The Optimize Live Editor task provides a visual interface for patternsearch
.
References
[1] Audet, Charles, and J. E. Dennis Jr. “Analysis of Generalized Pattern Searches.” SIAM Journal on Optimization. Volume 13, Number 3, 2003, pp. 889–903.
[2] Conn, A. R., N. I. M. Gould, and Ph. L. Toint. “A Globally Convergent Augmented Lagrangian Barrier Algorithm for Optimization with General Inequality Constraints and Simple Bounds.” Mathematics of Computation. Volume 66, Number 217, 1997, pp. 261–288.
[3] Abramson, Mark A. Pattern Search Filter Algorithms for Mixed Variable General Constrained Optimization Problems. Ph.D. Thesis, Department of Computational and Applied Mathematics, Rice University, August 2002.
[4] Abramson, Mark A., Charles Audet, J. E. Dennis, Jr., and Sebastien Le Digabel. “ORTHOMADS: A deterministic MADS instance with orthogonal directions.” SIAM Journal on Optimization. Volume 20, Number 2, 2009, pp. 948–966.
[5] Kolda, Tamara G., Robert Michael Lewis, and Virginia Torczon. “Optimization by direct search: new perspectives on some classical and modern methods.” SIAM Review. Volume 45, Issue 3, 2003, pp. 385–482.
[6] Kolda, Tamara G., Robert Michael Lewis, and Virginia Torczon. “A generating set direct search augmented Lagrangian algorithm for optimization with a combination of general and linear constraints.” Technical Report SAND20065315, Sandia National Laboratories, August 2006.
[7] Lewis, Robert Michael, Anne Shepherd, and Virginia Torczon. “Implementing generating set search methods for linearly constrained minimization.” SIAM Journal on Scientific Computing. Volume 29, Issue 6, 2007, pp. 2507–2530.
Extended Capabilities
Automatic Parallel Support
Accelerate code by automatically running computation in parallel using Parallel Computing Toolbox™.
To run in parallel, set the 'UseParallel'
option to true
.
options = optimoptions('
solvername
','UseParallel',true)
For more information, see How to Use Parallel Processing in Global Optimization Toolbox.
Version History
Introduced before R2006a
See Also
ga
 optimoptions
 paretosearch
 Optimize
Topics
 Optimize Using the GPS Algorithm
 Coding and Minimizing an Objective Function Using Pattern Search
 Constrained Minimization Using Pattern Search, SolverBased
 Effects of Pattern Search Options
 Optimize ODEs in Parallel
 Pattern Search Climbs Mount Washington
 Optimization Workflow
 What Is Direct Search?
 Pattern Search Terminology
 How Pattern Search Polling Works
 Polling Types
 Search and Poll
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)