Searching and Polling
Definition of Search
patternsearch, a search is
an algorithm that runs before a poll. The search attempts to locate
a better point than the current point. (Better means one with lower
objective function value.) If the search finds a better point, the
better point becomes the current point, and no polling is done at
that iteration. If the search does not find a better point,
patternsearch does not use
search. To search, see How to Use a Search Method.
The figure patternsearch With a Search Method contains a flow chart of direct search including using a search method.
patternsearch With a Search Method
Iteration limit applies to all built-in search methods except those
that are poll methods. If you select an iteration limit for the search method, the
search is enabled until the iteration limit is reached. Afterward,
patternsearch stops searching and only polls.
How to Use a Search Method
To use search in
In the Optimize Live Editor task, select a search function in Specify solver options > Algorithm settings > Search function.
At the command line, create options with a search method using
optimoptions. For example, to use Latin hypercube search:
opts = optimoptions('patternsearch','SearchFcn',@searchlhs);
For more information, including a list of all built-in search methods, consult the
patternsearchfunction reference page, and the Search Options section of the options reference.
You can write your own search method. Use the syntax described
in Structure of the Search Function.
To use your search method in a pattern search, give its function handle
Custom Function (
Poll methods — You can use any poll method as a search algorithm.
patternsearchconducts one poll step as a search. For this type of search to be beneficial, your search type should be different from your poll type. (
patternsearchdoes not search if the selected search method is the same as the poll type.) Therefore, use a MADS search with a GSS or GPS poll, or use a GSS or GPS search with a MADS poll.
fminsearch, also called Nelder-Mead —
fminsearchis for unconstrained problems only.
fminsearchruns to its natural stopping criteria; it does not take just one step. Therefore, use
fminsearchfor just one iteration. This is the default setting. To change settings, see Search Options.
Latin hypercube search — Described in Search Options. By default, searches 15n points, where n is the number of variables, and only searches during the first iteration. To change settings, see Search Options.
When to Use Search
There are two main reasons to use a search method:
Search Methods for Increased Speed
Generally, you do not know beforehand whether a search method speeds an optimization or not. So try a search method when:
You are performing repeated optimizations on similar problems, or on the same problem with different parameters.
You can experiment with different search methods to find a lower solution time.
Search does not always speed an optimization. For one example where it does, see Search and Poll.
Search Methods for Better Solutions
Since search methods run before poll methods, using search can
be equivalent to choosing a different starting point for your optimization.
This comment holds for the Nelder-Mead,
Latin hypercube search methods, all of which, by default, run once
at the beginning of an optimization.
ga and Latin
hypercube searches are stochastic, and can search through several basins of attraction.