arsm

Find the constrained minimum of a real function.

Syntax

x = arsm(@func,x0)

x = arsm(@func,x0,A,b)

x = arsm(@func,x0,A,b,Aeq,beq)

x = arsm(@func,x0,A,b,Aeq,beq,lb,ub)

x = arsm(@func,x0,A,b,Aeq,beq,lb,ub,nonlcon)

x = arsm(@func,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)

[x,fval,info,output] = arsm(...)

Inputs

func
The function to minimize.
x0
An estimate of the location of the minimum.
A
A matrix used to compute A*x for inequality contraints.
Use [ ] if unneeded.
b
The upper bound of the inequality constraints A*x<=b.
Use [ ] if unneeded.
Aeq
A matrix used to compute Aeq*x for equality contraints.
Use [ ] if unneeded.
beq
The upper bound of the equality constraints Aeq*x=beq.
Use [ ] if unneeded.
lb
The design variable lower bounds.
Use [ ] if unbounded. Support for this option is limited. See Comments.
ub
The design variable upper bounds.
Use [ ] if unbounded. Support for this option is limited. See Comments.
nonlcon
The non-linear constraints function.
The function signature is as follows:
function [c, ceq] = ConFunc(x)
where c and ceq contain inequality and equality contraints, respectively. The inequality constraints are assumed to have upper bounds of 0.
The function can return 1 or 2 outputs.
options
A struct containing options settings.
See arsmoptimset for details.

Outputs

x
The location of the function minimum.
fval
The minimum of the function.
info
The convergence status flag.
  • info = 3: Converged with a constraint violation within TolCon.
  • info = 1: Function value converged to within TolX, TolFunAbs, or TolFunRel.
  • info = 0: Reached maximum number of iterations, or the algorithm aborted because it was not converging.
  • info = -2: The function did not converge.
output
A struct containing iteration details. The members are as follows.
iterations
The number of iterations.
nfev
The number of function evaluations.
xiter
The candidate solution at each iteration.
fvaliter
The objective function value at each iteration.
coniter
The constraint values at each iteration. The columns will contain the constraint function values in the following order:
  1. linear inequality contraints
  2. linear equality constraints
  3. nonlinear inequality contraints
  4. nonlinear equality constraints

Example

Minimize the function ObjFunc, subject to the linear inequality constraint: x1 + 4*x2 > 27.

The constraint must be expressed with an upper bound: -x1 - 4*x2 < -27.
function obj = ObjFunc(x)
    obj = 2*(x(1)-3)^2 - 5*(x(1)-3)*(x(2)-2) + 4*(x(2)-2)^2 + 6;
end

init = [8, 6];		% initial estimate
A = [-1, -4];		% inequality contraint matrix
b = [-27];		% inequality contraint bound
lb = [-10, -10];	% lower variable bounds
ub = [10, 10];		% upper variable bounds
[x,fval] = arsm(@ObjFunc,init,A,b,[],[],lb,ub)
x = [Matrix] 1 x 2
7.00001  5.00000
fval = 14

Comments

arsm uses an Adaptive Response Surface Method.

To pass additional parameters to a function argument, use an anonymous function.

See the fmincon optimization tutorial, Compose-4030: Optimization Algorithms in OML, for an example with nonlinear constraints.

Options are specified with arsmoptimset. The defaults are as follows:
  • MaxIter: 25
  • MaxFail: 20000
  • TolX: 0.001
  • TolCon: 0.5 (%)
  • TolFunAbs: 0.001
  • TolFunRel: 1.0 (%)
  • ConRet: 50.0 (%)
  • MoveLim: 0.15
  • PertM: 'initial'
  • PertV: 1.1
  • Seed: 0
  • Display: 'off'