pattern search options
options for pattern search
set options for patternsearch
by using
optimoptions
.
options = optimoptions("patternsearch",... option1=value1,option2=value2);
some options are listed in
italics
. these options do not appear in the listing thatoptimoptions
returns. to see whyoptimoptions
hides these option values, see .ensure that you pass options to the solver. otherwise,
patternsearch
uses the default option values.[x,fval] = patternsearch(fun,x0,a,b,aeq,beq,lb,ub,nonlcon,options)
algorithm options
algorithm
specifies the algorithm used by
patternsearch
to solve a problem.
"classic"
— use the original algorithm as described in ."nups"
— use the nonuniform pattern search algorithm as described in ."nups-gps"
— use the nonuniform pattern search algorithm restricted to the gps (generalized pattern search) polling algorithm (no orthomads (orthogonal mesh adaptive direct search) polling)."nups-mads"
— use the nonuniform pattern search algorithm restricted to the orthomads polling algorithm (no gps polling).
for examples of algorithm effects, see and .
plot options
plotfcn
specifies the plot function or functions called at each
iteration by patternsearch
or
paretosearch
. set the plotfcn
option to be a
built-in plot function name or a handle to the plot function. you can stop the
algorithm at any time by clicking the stop button on the plot
window. for example, to display the best function value, set
options
as follows:
options = optimoptions("patternsearch",plotfcn="psplotbestf");
to display multiple plots, use a cell array of built-in plot function names or a cell array of function handles:
options = optimoptions("patternsearch",... plotfcn={@plotfun1, @plotfun2, ...});
where @plotfun1
, @plotfun2
, and so on are
function handles to the plot functions. if you specify more than one plot function,
all plots appear as subplots in the same window. right-click any subplot to obtain a
larger version in a separate figure window.
available plot functions for patternsearch
or for
paretosearch
with a single objective function:
"psplotbestf"
— plot the best objective function value."psplotfuncount"
— plot the number of function evaluations."psplotmeshsize"
— plot the mesh size."psplotbestx"
— plot the current best point."psplotmaxconstr"
— plot the maximum nonlinear constraint violation.you can also create and use your own plot function. structure of the plot functions describes the structure of a custom plot function. pass any custom function as a function handle.
for paretosearch
with multiple objective functions, you can
select a custom function that you pass as a function handle, or any of the following
functions.
"psplotfuncount"
— plot the number of function evaluations."psplotmaxconstr"
— plot the maximum nonlinear constraint violation."psplotdistance"
— plot the distance metric. see ."psplotparetof"
— plot the objective function values. applies to three or fewer objectives."psplotparetox"
— plot the current points in parameter space. applies to three or fewer dimensions."psplotspread"
— plot the spread metric. see ."psplotvolume"
— plot the volume metric. see .
for patternsearch
, the
plotinterval
option specifies the
number of iterations between consecutive calls to the plot function.
structure of the plot functions
the first line of a plot function has the form
function stop = plotfun(optimvalues, flag)
the input arguments to the function are
optimvalues
— structure containing information about the current state of the solver. the structure contains the following fields forpatternsearch
:x
— current pointiteration
— iteration numberfval
— objective function valuemeshsize
— current mesh sizefunccount
— number of function evaluationsmethod
— method used in last iterationtolfun
— tolerance on function value in last iterationtolx
— tolerance onx
value in last iterationnonlinineq
— nonlinear inequality constraints, displayed only when a nonlinear constraint function is specifiednonlineq
— nonlinear equality constraints, displayed only when a nonlinear constraint function is specified
the structure contains the following fields for
paretosearch
:x
— current pointfval
— objective function valueiteration
— iteration numberfunccount
— number of function evaluationsnonlinineq
— nonlinear inequality constraints, displayed only when a nonlinear constraint function is specifiednonlineq
— nonlinear equality constraints, always empty[]
volume
— volume measure (see )averagedistance
— distance measure (see )spread
— spread measure (see )
flag
— current state in which the plot function is called. the possible values forflag
are"init"
— initialization state"iter"
— iteration state"interrupt"
— intermediate stage"done"
— final state
for details of
flag
, see structure of the output function.
explains how to provide additional parameters to the function.
the output argument stop
provides a way to stop the
algorithm at the current iteration. stop
can have the
following values:
false
— the algorithm continues to the next iteration.true
— the algorithm terminates at the current iteration.
poll options
poll options control how the pattern search polls the mesh points at each iteration.
pollmethod
specifies the pattern the algorithm
uses to create the mesh. there are two patterns for each of the classes of direct
search algorithms: the generalized pattern search (gps) algorithm, the generating
set search (gss) algorithm, and the mesh adaptive direct search (mads) algorithm.
these patterns are the positive basis 2n and the positive basis
n 1:
the default pattern for
patternsearch
,"gpspositivebasis2n"
, consists of the following 2n vectors, where n is the number of independent variables for the objective function.[1 0 0...0] [0 1 0...0] ...[0 0 0...1] [–1 0 0...0] [0 –1 0...0] [0 0 0...–1].
for example, if the optimization problem has three independent variables, the pattern consists of the following six vectors.
[1 0 0] [0 1 0] [0 0 1] [–1 0 0] [0 –1 0] [0 0 –1].
the default pattern for
paretosearch
,"gpspositivebasis2np2"
, is the same as"gpspositivebasis2n"
with two more points: all ones and all minus ones.[1 1 1...1] [–1 –1 –1...–1]
for example, if the optimization problem has three independent variables, the pattern consists of the following eight vectors.
[1 0 0] [0 1 0] [0 0 1] [–1 0 0] [0 –1 0] [0 0 –1] [1 1 1] [–1 –1 –1].
the
"gsspositivebasis2n"
pattern is similar to"gpspositivebasis2n"
, but adjusts the basis vectors to account for linear constraints."gsspositivebasis2n"
is more efficient than"gpspositivebasis2n"
when the current point is near a linear constraint boundary.paretosearch
also has the"gsspositivebasis2np2"
pattern that is similar to"gpspositivebasis2np2"
.the
"madspositivebasis2n"
pattern consists of 2n randomly generated vectors, where n is the number of independent variables for the objective function. this is done by randomly generating n vectors which form a linearly independent set, then using this first set and the negative of this set gives 2n vectors. as shown above, the"gpspositivebasis2n"
pattern is formed using the positive and negative of the linearly independent identity, however, with the"madspositivebasis2n"
, the pattern is generated using a random permutation of an n-by-n linearly independent lower triangular matrix that is regenerated at each iteration.note
you cannot use mads polling when the problem has linear equality constraints.
the
"gpspositivebasisnp1"
pattern consists of the following n 1 vectors.[1 0 0...0] [0 1 0...0] ...[0 0 0...1] [–1 –1 –1...–1].
for example, if the objective function has three independent variables, the pattern consists of the following four vectors.
[1 0 0] [0 1 0] [0 0 1] [–1 –1 –1].
the
"gsspositivebasisnp1"
pattern is similar to"gpspositivebasisnp1"
, but adjusts the basis vectors to account for linear constraints."gsspositivebasisnp1"
is more efficient than"gpspositivebasisnp1"
when the current point is near a linear constraint boundary.the
"madspositivebasisnp1"
pattern consists of n randomly generated vectors to form the positive basis, where n is the number of independent variables for the objective function. then, one more random vector is generated, giving n 1 randomly generated vectors. each iteration generates a new pattern when the"madspositivebasisnp1"
is selected.note
you cannot use mads polling when the problem has linear equality constraints.
the
"orthomadspositivebasis2n"
pattern is the same as the"gpspositivebasis2n"
pattern followed by a random rotation in n dimensions.the
"orthomadspositivebasisnp1"
pattern is the same as the"gpspositivebasisnp1"
pattern followed by a random rotation in n dimensions.
usecompletepoll
specifies whether all the points in the current
mesh must be polled at each iteration. usecompletepoll
can have
the values true
or false
.
usecompletepoll
applies only when
algorithm
is "classic"
.
if you set
usecompletepoll
totrue
, the algorithm polls all the points in the mesh at each iteration and chooses the point with the smallest objective function value as the current point at the next iteration.if you set
usecompletepoll
tofalse
, the default value, the algorithm stops the poll as soon as it finds a point whose objective function value is less than that of the current point. the algorithm then sets that point as the current point at the next iteration.for
paretosearch
only, theminpollfraction
option specifies the fraction of poll directions that are investigated during a poll, instead of the binary value ofusecompletepoll
. to specify a complete poll, setminpollfraction
to1
. to specify that the poll stops as soon as it finds a point that improves all objective functions, setminpollfraction
to0
.
pollorderalgorithm
specifies the order in which the algorithm
searches the points in the current mesh. pollorderalgorithm
applies only when algorithm
is "classic"
. the
options are
"consecutive"
(default) — the algorithm polls the mesh points in consecutive order, that is, the order of the pattern vectors as described in ."random"
— the polling order is random."success"
— the first search direction at each iteration is the direction in which the algorithm found the best point at the previous iteration. after the first point, the algorithm polls the mesh points in the same order as"consecutive"
.
multiobjective options
the solver mainly uses patternsearch
options. several of the available built-in plot functions differ; see plot options. the
following options apply only to paretosearch
.
in the table, n
represents the number of decision
variables.
multiobjective pattern search options
option | definition | allowed and { default}
values |
---|---|---|
paretosetsize | number of points in the pareto set. | positive integer | {max(60,number of objectives)
} |
paretosetchangetolerance | tolerance on the change in volume or spread of solutions. when
either of these measures relatively changes by less than
paretosetchangetolerance , the iterations end.
for details, see . | positive scalar | {1e-4} |
minpollfraction | minimum fraction of the pattern to poll. | scalar from 0 through 1 | {0} |
initialpoints | initial points for
if there are missing entries in the
| matrix with |
search options
the searchfcn
option specifies an optional search that the
algorithm can perform at each iteration prior to the polling. if the search returns
a point that improves the objective function, the algorithm uses that point at the
next iteration and omits the polling. if you select the same
searchfcn
and pollmethod
, only the poll
method is used, although both are used when the selected options differ.
you can select a poll method as a search method only for the
"classic"
algorithm.
the values for searchfcn
are listed below.
[]
, the default, specifies no search step.any built-in poll algorithm:
"gpspositivebasis2n"
,"gpspositivebasisnp1"
,"gsspositivebasis2n"
,"gsspositivebasisnp1"
,"madspositivebasis2n"
,"madspositivebasisnp1"
,"orthomadspositivebasis2n"
, or"orthomadspositivebasisnp1"
."searchga"
specifies a search using the genetic algorithm. you can modify the genetic algorithm search using two additional parameters:options = optimoptions("patternsearch",searchfcn=... {@searchga,iterlim,optionsga})
iterlim
— positive integer specifying the number of iterations of the pattern search for which the genetic algorithm search is performed. the default foriterlim
is 1. the recommendation is not to change this value, because performing these time-consuming searches more than once is not likely to improve results.optionsga
— options for the genetic algorithm, which you can set usingoptimoptions
. if you do not specify anysearchga
options, thensearchga
uses the sameuseparallel
andusevectorized
option settings aspatternsearch
.
"searchlhs"
specifies a latin hypercube search.patternsearch
generates each point for the search as follows. for each component, take a random permutation of the vector[1,2,...,k]
minusrand(1,k)
, divided byk
. (k
is the number of points.) this yieldsk
points, with each component close to evenly spaced. the resulting points are then scaled to fit any bounds.latin hypercube
uses default bounds of-1
and1
.the way the search is performed depends on the setting for the
usecompletesearch
option.if you set
usecompletesearch
totrue
, the algorithm polls all the points that are randomly generated at each iteration by the latin hypercube search and chooses the one with the smallest objective function value.if you set
usecompletesearch
tofalse
(the default), the algorithm stops the poll as soon as it finds one of the randomly generated points whose objective function value is less than that of the current point, and chooses that point for the next iteration.
you can modify the latin hypercube search using two additional parameters:
options = optimoptions("patternsearch",searchfcn=... {@searchlhs,iterlim,level})
iterlim
— positive integer specifying the number of iterations of the pattern search for which the latin hypercube search is performed. the default foriterlim
is 1.level
— thelevel
is the number of pointspatternsearch
searches, a positive integer. the default forlevel
is 15 times the number of dimensions.
"searchneldermead"
specifies a search usingfminsearch
, which uses the nelder-mead algorithm. you can modify the nelder-mead search using two additional parameters:options = optimoptions("patternsearch",searchfcn=... {@searchneldermead,iterlim,optionsnm})
iterlim
— positive integer specifying the number of iterations of the pattern search for which the nelder-mead search is performed. the default foriterlim
is 1.optionsnm
— options for , which you can create using the function.
"rbfsurrogate"
specifies a search using a radial basis function surrogate, similar to thesurrogateopt
surrogate (see ). the surrogate is formed from the most recentn
1 or more evaluation points, wheren
is the number of variables (size ofx0
). after the algorithm evaluates 10*n
points, the surrogate is reset (erased) and the points for a new surrogate come from points after the reset. the radial basis function requires at leastn
1 points, so after a reset, the search does not run until the algorithm evaluates at leastn
1 additional points. the surrogate requires upper and lower bounds on all variables. if you do not supply a bound, the algorithm constructs one from the recent point list. therefore, when you do not provide a bound for some variables, the algorithm performs more computations and runs a bit slower. in any case, this search function is relatively time consuming, making it best suited for use with time-consuming objective functions.custom
enables you to write your own search function.options = optimoptions("patternsearch",searchfcn=@myfun);
to see a template that you can use to write your own search function, enter
edit searchfcntemplate
the following section describes the structure of the search function.
structure of the search function
your search function must have the following calling syntax.
function [successsearch,xbest,fbest,funccount] = ... searchfcntemplate(fun,x,a,b,aeq,beq,lb,ub, ... optimvalues,options)
the search function has the following input arguments:
fun
— objective functionx
— current pointa,b
— linear inequality constraintsaeq,beq
— linear equality constraintslb,ub
— lower and upper bound constraintsoptimvalues
— structure that enables you to set search options. the structure contains the following fields:x
— current pointfval
— objective function value atx
iteration
— current iteration numberfunccount
— counter for user function evaluationscale
— scale factor used to scale the design pointsproblemtype
— flag passed to the search routines, indicating whether the problem is'unconstrained'
,'boundconstraints'
, or'linearconstraints'
. this field is a subproblem type for nonlinear constrained problems.meshsize
— current mesh size used in search stepmethod
— method used in last iteration
options
— pattern search options
the function has the following output arguments:
successsearch
— a boolean identifier indicating whether the search is successful or notxbest,fbest
— best point and best function value found by search methodfunccount
— number of user function evaluation in search method
see search and poll for an example.
complete search
the usecompletesearch
option applies when you set
searchfcn
to "gpspositivebasis2n"
,
"gpspositivebasisnp1"
,
"gsspositivebasis2n"
,
"gsspositivebasisnp1"
,
"madspositivebasis2n"
,
"madspositivebasisnp1"
, or
"searchlhs"
. usecompletesearch
can have
the values true
or false
.
for search functions that are poll algorithms,
usecompletesearch
has the same meaning as the poll option
usecompletepoll
. for the meaning of
usecompletesearch
for latin hypercube search, see the
"searchlhs"
entry in search options.
mesh options
mesh options control the mesh that the pattern search uses. the following options are available.
initialmeshsize
specifies the size of the initial mesh, which is the length of the shortest vector from the initial point to a mesh point.initialmeshsize
must be a positive scalar. the default is1.0
.maxmeshsize
specifies a maximum size for the mesh. when the maximum size is reached, the mesh size does not increase after a successful iteration.maxmeshsize
must be a positive scalar, and is only used when a gps or gss algorithm is selected as the poll or search method. the default value isinf
. mads uses a maximum size of1
.acceleratemesh
specifies whether, when the mesh size is small, themeshcontractionfactor
is multiplied by0.5
after each unsuccessful iteration.acceleratemesh
can have the valuestrue
(use accelerator) orfalse
(do not use accelerator), the default.acceleratemesh
applies only to the gps and gss poll algorithms and to the"classic"
algorithm..meshrotate
applies only when thepollmethod
is"gpspositivebasisnp1"
or"gsspositivebasisnp1"
.meshrotate
="on"
specifies that the mesh vectors are multiplied by –1 when the mesh size is less than 1/100 of themeshtolerance
option after an unsuccessful poll. in other words, after the first unsuccessful poll with small mesh size, instead of polling in directions ei (unit positive directions) and –σei, the algorithm polls in directions –ei and σei.meshrotate
can have the values"off"
or"on"
(the default).meshrotate
is especially useful for discontinuous functions.when the problem has equality constraints,
meshrotate
is disabled.
scalemesh
specifies whether the algorithm scales the mesh points by carefully multiplying the pattern vectors by constants proportional to the logarithms of the absolute values of components of the current point (or, for unconstrained problems, of the initial point).scalemesh
can have the valuesfalse
ortrue
(the default). when the problem has equality constraints for the"classic"
algorithm,scalemesh
is disabled.meshexpansionfactor
specifies the factor by which the mesh size is increased after a successful poll. the default value is2.0
, which means that the size of the mesh is multiplied by2.0
after a successful poll.meshexpansionfactor
must be a positive scalar and is only used when a gps or gss method is selected as the poll or search method and thealgorithm
option is"classic"
. mads uses ameshexpansionfactor
of4.0
. see for more information.meshcontractionfactor
specifies the factor by which the mesh size is decreased after an unsuccessful poll. the default value is0.5
, which means that the size of the mesh is multiplied by0.5
after an unsuccessful poll.meshcontractionfactor
must be a positive scalar and is only used when a gps or gss method is selected as the poll or search method and thealgorithm
option is"classic"
. mads uses ameshcontractionfactor
of0.25
. see for more information.
constraint parameters
for information on the meaning of penalty parameters, see .
initialpenalty
— specifies an initial value of the penalty parameter that is used by the nonlinear constraint algorithm.initialpenalty
must be greater than or equal to1
, and has a default of10
.penaltyfactor
— increases the penalty parameter when the problem is not solved to required accuracy and constraints are not satisfied.penaltyfactor
must be greater than1
, and has a default of100
.
tolbind
specifies the tolerance for the
distance from the current point to the boundary of the feasible region with respect
to linear constraints. this means tolbind
specifies when a linear constraint is active.
tolbind
is not a stopping criterion.
active linear constraints change the pattern of points
patternsearch
uses for polling or searching. the default
value of tolbind
is
1e-3
.
cache options
the pattern search algorithm can keep a record of the points it has already polled, so that it does not have to poll the same point more than once. if the objective function requires a relatively long time to compute, the cache option can speed up the algorithm. the memory allocated for recording the points is called the cache. this option should only be used for deterministic objective functions, and not for stochastic ones.
cache
specifies whether a cache is used.
the options are "on"
and "off"
, the default.
when you set cache
to
"on"
, the algorithm does not evaluate the objective function
at any mesh points that are within cachetol
of a point in the cache.
cachetol
specifies how close a mesh point
must be to a point in the cache for the algorithm to omit polling it.
cachetol
must be a positive scalar.
the default value is eps
.
cachesize
specifies the size of the cache.
cachesize
must be a positive scalar.
the default value is 1e4
.
note
cache
does not work when you run the solver in parallel.
see for more information.
stopping criteria
stopping criteria determine what causes the pattern search algorithm to stop. pattern search uses the following criteria:
meshtolerance
specifies the minimum tolerance for mesh size.
the gps and gss algorithms stop if the mesh size becomes smaller than
meshtolerance
. mads 2n stops when the mesh size becomes
smaller than meshtolerance^2
. mads np1 stops when the mesh size
becomes smaller than (meshtolerance/nvar)^2
, where
nvar
is the number of elements of x0
. the
default value of meshtolerance
is 1e-6
.
maxiterations
specifies the maximum number of iterations the
algorithm performs. the algorithm stops if the number of iterations reaches
maxiterations
. the default value is 100 times the number of
independent variables.
maxfunctionevaluations
specifies the maximum number of
evaluations of the objective function. the algorithm stops if the number of function
evaluations reaches maxfunctionevaluations
. the default value is
2000 times the number of independent variables.
maxtime
specifies the maximum time in seconds the pattern
search algorithm runs before stopping. this also includes any specified pause time
for pattern search algorithms.
steptolerance
specifies the minimum distance between the
current points at two consecutive iterations. does not apply to mads polling. after
an unsuccessful poll, the algorithm stops if the distance between two consecutive
points is less than steptolerance
and the mesh size is smaller
than steptolerance
. the default value is
1e-6
.
functiontolerance
specifies the minimum tolerance for the
objective function. does not apply to mads polling. after an unsuccessful poll, the
algorithm stops if the difference between the function value at the previous best
point and function value at the current best point is less than
functiontolerance
, and if the mesh size is also smaller than
steptolerance
. the default value is
1e-6
.
see for an example.
constrainttolerance
is not used as stopping criterion. it is
used to determine the feasibility with respect to nonlinear constraints. the default
value is 1e-6
.
output function options
outputfcn
specifies functions that the pattern search algorithm
calls at each iteration. for an output function file myfun.m
,
set
options = optimoptions("patternsearch",outputfcn=@myfun);
for multiple output functions, enter a cell array of function handles:
options = optimoptions('patternsearch",... outputfcn={@myfun1,@myfun2,...});
to see a template that you can use to write your own output function, enter
edit psoutputfcntemplate
at the matlab® command prompt.
to pass extra parameters in the output function, use .
structure of the output function
your output function must have the following calling syntax:
[stop,options,optchanged] = myfun(optimvalues,options,flag)
matlab passes the optimvalues
,
options
, and flag
data to your output
function, and the output function returns stop
,
options
, and optchanged
data.
the output function has the following input arguments.
optimvalues
— structure containing information about the current state of the solver. the structure contains the following fields:x
— current pointiteration
— iteration numberfval
— objective function value atx
meshsize
— current mesh sizefunccount
— number of function evaluationsmethod
— method used in last iteration, such as'update multipliers'
or'increase penalty'
for a nonlinearly constrained problem, or'successful poll'
,'refine mesh'
, or'successful search'
, possibly with a'\rotate'
suffix, for a problem without nonlinear constraintstolfun
— absolute value of change in function value in last iterationtolx
— norm of change inx
in last iterationnonlinineq
— nonlinear inequality constraint function values atx
, displayed only when a nonlinear constraint function is specifiednonlineq
— nonlinear equality constraint function values atx
, displayed only when a nonlinear constraint function is specified
options
— optionsflag
— current state in which the output function is called. the possible values forflag
are'init'
— initialization state'iter'
— iteration state'interrupt'
— iteration of a subproblem of a nonlinearly constrained problemwhen
flag
is'interrupt'
, the values ofoptimvalues
fields apply to the subproblem iterations.when
flag
is'interrupt'
,patternsearch
does not accept changes inoptions
, and ignoresoptchanged
.
'done'
— final state
explains how to provide additional parameters to the output function.
the output function returns the following arguments to
patternsearch
:
stop
— provides a way to stop the algorithm at the current iteration.stop
can have the following values.false
— the algorithm continues to the next iteration.true
— the algorithm terminates at the current iteration.
options
—patternsearch
options.optchanged
— boolean flag indicating changes tooptions
. to changeoptions
for subsequent iterations, setoptchanged
totrue
.
display to command window options
display
specifies how much information is displayed at the
command line while the pattern search is running. the available options are
"final"
(default) — the reason for stopping is displayed."off"
or the equivalent"none"
— no output is displayed."iter"
— information is displayed for each iteration."diagnose"
— information is displayed for each iteration. in addition, the diagnostic lists some problem information and the options that are changed from the defaults.
both "iter"
and "diagnose"
display the
following information:
iter
— iteration numberfuneval
— cumulative number of function evaluationsmeshsize
— current mesh sizefunval
— objective function value of the current pointmethod
— outcome of the current poll (with no nonlinear constraint function specified). with a nonlinear constraint function,method
displays the update method used after a subproblem is solved.max constraint
— maximum nonlinear constraint violation (displayed only when a nonlinear constraint function has been specified)
vectorized and parallel options
you can choose to have your objective and constraint functions evaluated in
serial, parallel, or in a vectorized fashion. set the
usevectorized
or useparallel
options to
true
to use vectorized or parallel computation.
note
to use vectorized or parallel polling for the "classic"
algorithm, you must set usecompletepoll
to
true
. similarly for the "classic"
algorithm, set usecompletesearch
to true
for vectorized or parallel searching.
beginning in r2019a, when you set the
useparallel
option to true
,
patternsearch
internally overrides the
usecompletepoll
setting to true
so that the function
polls in parallel.
when
usevectorized
isfalse
,patternsearch
calls the objective function on one point at a time as it loops through the mesh points. (this assumesuseparallel
is at its default value offalse
.)usevectorized
istrue
,patternsearch
calls the objective function on all the points in the mesh at once, i.e., in a single call to the objective function.if there are nonlinear constraints, the objective function and the nonlinear constraints all need to be vectorized in order for the algorithm to compute in a vectorized manner.
for details and an example, see .
when
useparallel
istrue
,patternsearch
calls the objective function in parallel, using the parallel environment you established (see ). at the command line, set"useparallel"
tofalse
to compute serially.
note
you cannot simultaneously use vectorized and parallel computations. if you set
useparallel
to true
and
usevectorized
to true
,
patternsearch
evaluates your objective and constraint
functions in a vectorized manner, not in parallel.
how objective and constraint functions are evaluated
assume usecompletepoll =
true | usevectorized =
false | usevectorized =
true |
---|---|---|
useparallel = false | serial | vectorized |
useparallel = true | parallel | vectorized |
options table for pattern search algorithms
option availability table for all algorithms
option | description | algorithm availability |
---|---|---|
acceleratemesh | accelerate mesh size contraction. | gps and gss, |
cache | with note
| all |
cachesize | size of the cache, in number of points. | all |
cachetol | positive scalar specifying how close the current mesh point
must be to a point in the cache in order for
| all |
constrainttolerance | tolerance on nonlinear constraints. | all |
display | level of display to command window. | all |
functiontolerance | tolerance on function value. | all |
initialmeshsize | initial mesh size used in pattern search algorithms. | all |
initialpenalty | initial value of the penalty parameter. | all |
maxfunctionevaluations | maximum number of objective function evaluations. | all |
maxiterations | maximum number of iterations. | all |
maxmeshsize | maximum mesh size used in a poll/search step. | gps and gss |
maxtime | total time (in seconds) allowed for optimization. also includes any specified pause time for pattern search algorithms. | all |
meshcontractionfactor | mesh contraction factor, used when iteration is unsuccessful. | gps and gss, |
meshexpansionfactor | mesh expansion factor, expands mesh when iteration is successful. | gps and gss, |
meshrotate | rotate the pattern before declaring a point to be optimum. | gps np1 and gss np1 |
meshtolerance | tolerance on mesh size. | all |
outputfcn | user-specified function that a pattern search calls at each iteration. | all |
penaltyfactor | penalty update parameter. | all |
plotfcn | specifies function to plot at run time. | all |
plotinterval | specifies that plot functions will be called at every interval. | all |
pollorderalgorithm | order in which search directions are polled. | gps and gss, |
pollmethod | polling strategy used in pattern search. |
|
scalemesh | automatic scaling of variables. | all |
searchfcn | specifies search method used in pattern search. | all |
steptolerance | tolerance on independent variable. | all |
tolbind | binding tolerance used to determine if linear constraint is active. | all |
usecompletepoll | complete poll around current iterate. evaluate all the points in a poll step. |
|
usecompletesearch | complete search around current iterate when the search method is a poll method. evaluate all the points in a search step. |
|
useparallel | when | all |
usevectorized | specifies whether objective and constraint functions are vectorized. | all |