Main Content

psoptimset

(Not recommended) Create pattern search options structure

psoptimset is not recommended. Use optimoptions instead. For more information, see Compatibility Considerations.

Syntax

psoptimset
options = psoptimset
options = psoptimset(@patternsearch)
options = psoptimset('param1',value1,'param2',value2,...)
options = psoptimset(oldopts,'param1',value1,...)
options = psoptimset(oldopts,newopts)

Description

psoptimset with no input or output arguments displays a complete list of parameters with their valid values.

options = psoptimset (with no input arguments) creates a structure called options that contains the options, or parameters, for patternsearch, and sets parameters to [], indicating patternsearch uses the default values.

options = psoptimset(@patternsearch) creates a structure called options that contains the default values for patternsearch.

options = psoptimset('param1',value1,'param2',value2,...) creates a structure options and sets the value of 'param1' to value1, 'param2' to value2, and so on. Any unspecified parameters are set to their default values. It is sufficient to type only enough leading characters to define the parameter name uniquely. Case is ignored for parameter names.

options = psoptimset(oldopts,'param1',value1,...) creates a copy of oldopts, modifying the specified parameters with the specified values.

options = psoptimset(oldopts,newopts) combines an existing options structure, oldopts, with a new options structure, newopts. Any parameters in newopts with nonempty values overwrite the corresponding old parameters in oldopts.

Options

The following table lists the options you can set with psoptimset. See Pattern Search Options for a complete description of the options and their values. Values in {} denote the default value. You can also view the optimization parameters and defaults by typing psoptimset at the command line.

optimoptions hides the options listed in italics, but psoptimset does not. See Options that optimoptions Hides.

Options for patternsearch

OptionDescriptionValues
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.

For examples of algorithm effects, see Explore patternsearch Algorithms and Explore patternsearch Algorithms in Optimize Live Editor Task.

{"classic"} | "nups" | "nups-gps" | "nups-mads"
Cache

With Cache set to "on", patternsearch keeps a history of the mesh points it polls. At subsequent iterations, patternsearch does not poll points close to those already polled. Use this option if patternsearch runs slowly while computing the objective function. If the objective function is stochastic, do not use this option.

Note

Cache does not work when you run the solver in parallel.

"on" | {"off"}

CacheSize

Size of the history.

Positive scalar | {1e4}

CacheTol

Largest distance from the current mesh point to any point in the history in order for patternsearch to avoid polling the current point. Use if the Cache option is set to "on".

Positive scalar | {eps}

ConstraintTolerance

Tolerance on constraints.

For an options structure, use TolCon.

Positive scalar | {1e-6}

Display

Level of display, meaning how much information psoptimset returns to the Command Line during the solution process.

"off" | "iter" | "diagnose" | {"final"}
FunctionTolerance

Tolerance on the function. Iterations stop if the change in function value is less than FunctionTolerance and the mesh size is less than StepTolerance. This option does not apply to MADS (mesh adaptive direct search) polling.

For an options structure, use TolFun.

Positive scalar | {1e-6}

InitialMeshSize

Initial mesh size for the algorithm. See How Pattern Search Polling Works.

Positive scalar | {1.0}

InitialPenalty

Initial value of the penalty parameter. See Nonlinear Constraint Solver Algorithm for Pattern Search.

Positive scalar | {10}

MaxFunctionEvaluations

Maximum number of objective function evaluations.

For an options structure, use MaxFunEvals.

Positive integer | {"2000*numberOfVariables"}, where numberOfVariables is the number of problem variables

MaxIterations

Maximum number of iterations.

For an options structure, use MaxIter.

Positive integer | {"100*numberOfVariables"}, where numberOfVariables is the number of problem variables

MaxMeshSize

Maximum mesh size used in a poll or search step. See How Pattern Search Polling Works.

Positive scalar | {Inf}

MaxTime

Total time (in seconds) allowed for optimization.

For an options structure, use TimeLimit.

Positive scalar | {Inf}

MeshContractionFactor

Mesh contraction factor for an unsuccessful iteration.

This option applies only when Algorithm is "classic".

For an options structure, use MeshContraction.

Positive scalar | {0.5}

MeshExpansionFactor

Mesh expansion factor for a successful iteration.

This option applies only when Algorithm is "classic".

For an options structure, use MeshExpansion.

Positive scalar | {2.0}

MeshRotate

Flag to rotate the pattern before declaring a point to be optimum. See Mesh Options.

This option applies only when Algorithm is "classic".

"off" | {"on"}

MeshTolerance

Tolerance on the mesh size.

For an options structure, use TolMesh.

Positive scalar | {1e-6}

OutputFcn

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 OutputFcns.

Function handle or cell array of function handles | {[]}

PenaltyFactor

Penalty update parameter. See Nonlinear Constraint Solver Algorithm for Pattern Search.

Positive scalar | {100}

PlotFcn

Plots of output from the pattern search. Specify as the name of a built-in plot function, a function handle, or a cell array of names of built-in plot functions or function handles.

For an options structure, use PlotFcns.

{[]} | "psplotbestf" | "psplotfuncount" | "psplotmeshsize" | "psplotbestx" | "psplotmaxconstr" | custom plot function

PlotInterval

Number of iterations for plots. 1 means plot every iteration, 2 means plot every other iteration, and so on.

positive integer | {1}

PollMethod

Polling strategy used in the pattern search.

This option applies only when Algorithm is "classic".

Note

You cannot use MADS polling when the problem has linear equality constraints.

{"GPSPositiveBasis2N"} | "GPSPositiveBasisNp1" | "GSSPositiveBasis2N" | "GSSPositiveBasisNp1" | "MADSPositiveBasis2N" | "MADSPositiveBasisNp1"

PollOrderAlgorithm

Order of the poll directions in the pattern search.

This option applies only when Algorithm is "classic".

For an options structure, use PollingOrder.

"Random" | "Success" | {"Consecutive"}

ScaleMesh

Automatic scaling of variables.

For an options structure, use ScaleMesh = "on" or "off".

{true}| false

SearchFcn

Type of search used in the pattern search. Specify as a name or a function handle.

For an options structure, use SearchMethod.

"GPSPositiveBasis2N" | "GPSPositiveBasisNp1" | "GSSPositiveBasis2N" | "GSSPositiveBasisNp1" | "MADSPositiveBasis2N" | "MADSPositiveBasisNp1" | "searchga" | "searchlhs" | "searchneldermead" | "rbfsurrogate" | {[]} | custom search function

StepTolerance

Tolerance on the variable. Iterations stop if both the change in position and the mesh size are less than StepTolerance. This option does not apply to MADS polling.

For an options structure, use TolX.

Positive scalar | {1e-6}

TolBind

Binding tolerance. See Constraint Parameters.

Positive scalar | {1e-3}

UseCompletePoll

Flag to complete the poll around the current point. See How Pattern Search Polling Works.

This option applies only when Algorithm is "classic".

Note

For the "classic" algorithm, you must set UseCompletePoll to true for vectorized or parallel polling. Similarly, 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.

For an options structure, use CompletePoll = "on" or "off".

true | {false}

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 Algorithm is "classic".

Note

For the "classic" algorithm, you must set UseCompleteSearch to true for vectorized or parallel searching.

For an options structure, use CompleteSearch = "on" or "off".

true | {false}

UseParallel

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 "classic" algorithm, you must set UseCompletePoll to true for vectorized or parallel polling. Similarly, 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.

Note

Cache does not work when you run the solver in parallel.

true | {false}

UseVectorized

Specifies whether functions are vectorized. See Vectorized and Parallel Options and Vectorize the Objective and Constraint Functions.

Note

For the "classic" algorithm, you must set UseCompletePoll to true for vectorized or parallel polling. Similarly, set UseCompleteSearch to true for vectorized or parallel searching.

For an options structure, use Vectorized = "on" or "off".

true | {false}

Version History

Introduced before R2006a

collapse all

R2018b: psoptimset is not recommended

To set options, the gaoptimset, psoptimset, and saoptimset functions are not recommended. Instead, use optimoptions.

The main difference between using optimoptions and the other functions is that you include the solver name as the first argument in optimoptions. For example, to set an iterative display in ga:

options = optimoptions('ga','Display','iter');
% instead of
options = gaoptimset('Display','iter');

The other difference is that some option names have changed. You can continue to use the old names in optimoptions. For details, see Options Changes in R2016a.

optimoptions offers these advantages over the other functions:

  • optimoptions provides better automatic code suggestions and completions, especially in the Live Editor.

  • You can use a single option-setting function instead of a variety of functions.

There are no plans to remove gaoptimset, psoptimset, and saoptimset at this time.