Find minimum of function using pattern search
x = patternsearch(fun,x0)
x = patternsearch(fun,x0,A,b)
x = patternsearch(fun,x0,A,b,Aeq,beq)
x = patternsearch(fun,x0,A,b,Aeq,beq,LB,UB)
x = patternsearch(fun,x0,A,b,Aeq,beq,LB,UB,nonlcon)
x = patternsearch(fun,x0,A,b,Aeq,beq,LB,UB,nonlcon,options)
x = patternsearch(problem)
[x,fval] = patternsearch(fun,x0, ...)
[x,fval,exitflag] = patternsearch(fun,x0, ...)
[x,fval,exitflag,output] = patternsearch(fun,x0, ...)
patternsearch finds the minimum of a function
using a pattern search.
x = patternsearch(fun,x0) finds a local
x, to the function handle
computes the values of the objective function. For details on writing
see Compute Objective Functions.
an initial point for the pattern search algorithm, a real vector.
To write a function with additional parameters to the independent
variables that can be called by
x = patternsearch(fun,x0,A,b) finds a local
x to the function
subject to the linear inequality constraints represented in matrix
form by , see Linear Inequality Constraints.
If the problem has
m linear inequality constraints
n variables, then
A is a matrix of size
b is a vector of length
x = patternsearch(fun,x0,A,b,Aeq,beq) finds
a local minimum
x to the function
x0, and subject to the constraints
where represents the linear equality
constraints in matrix form, see Linear Equality Constraints. If the problem has
equality constraints and
n variables, then
Aeq is a matrix of size
beq is a vector of length
If there are no inequality constraints, pass empty matrices,
x = patternsearch(fun,x0,A,b,Aeq,beq,LB,UB) defines
a set of lower and upper bounds on the design variables,
so that a solution is found in the range
UB, see Bound Constraints.
If the problem has n variables,
vectors of length n. If
empty (or not provided), it is automatically expanded to
respectively. If there are no inequality or equality constraints,
pass empty matrices for
x = patternsearch(fun,x0,A,b,Aeq,beq,LB,UB,nonlcon) subjects
the minimization to the constraints defined in
a nonlinear constraint function. The function
returns the vectors C and Ceq,
representing the nonlinear inequalities and equalities respectively.
that C(x) ≤ 0 and Ceq(x) = 0. (Set
no bounds exist.)
x = patternsearch(fun,x0,A,b,Aeq,beq,LB,UB,nonlcon,options) minimizes
the default optimization parameters replaced by values in
options can be created using
x = patternsearch(problem) finds the minimum
a structure containing the following fields:
objective — Objective function
X0 — Starting point
Aineq — Matrix for linear
bineq — Vector for linear
Aeq — Matrix for linear
beq — Vector for linear
lb — Lower bound for
ub — Upper bound for
nonlcon — Nonlinear constraint
options — Options structure
rngstate — Optional field
to reset the state of the random number generator
Create the structure
problem by exporting
a problem from the Optimization app, as described in Importing and Exporting Your Work in
the Optimization Toolbox documentation.
[x,fval] = patternsearch(fun,x0, ...) returns
the value of the objective function
fun at the
[x,fval,exitflag] = patternsearch(fun,x0, ...) returns
exitflag, which describes the exit condition of
Possible values of
exitflag and the corresponding
Without nonlinear constraints —
Magnitude of the mesh size is less than the specified tolerance and
constraint violation is less than
With nonlinear constraints —
Magnitude of the complementarity measure (defined
after this table) is less than
Magnitude of step smaller than machine precision and
the constraint violation is less than
Maximum number of function evaluations or iterations 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 ciλi, where ci is the nonlinear inequality constraint violation, and λi is the corresponding Lagrange multiplier.
[x,fval,exitflag,output] = patternsearch(fun,x0, ...) returns
output containing information about
the search. The output structure contains the following fields:
function — Objective function.
problemtype — String describing
the type of problem, one of:
pollmethod — Polling technique.
searchmethod — Search technique
used, if any.
iterations — Total number
funccount — Total number
of function evaluations.
meshsize — Mesh size at
maxconstraint — Maximum
constraint violation, if any.
rngstate — State of the MATLAB® random
number generator, just before the algorithm started. You can use the
rngstate to reproduce the output when
you use a random search method or random poll method. See Reproduce Results, which discusses
the identical technique for
message — Reason why the
Given the following constraints
the following code finds the minimum of the function,
that is provided with your software:
A = [1 1; -1 2; 2 1]; b = [2; 2; 3]; lb = zeros(2,1); [x,fval,exitflag] = patternsearch(@lincontest6,[0 0],... A,b,,,lb) Optimization terminated: mesh size less than options.TolMesh. x = 0.6667 1.3333 fval = -8.2222 exitflag = 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.
 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.
 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.
 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.
 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.
 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 SAND2006-5315, Sandia National Laboratories, August 2006.
 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.