arsm

Find the constrained minimum of a real function.

Attention: Available only with Activate commercial edition.

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 nonlinear constraints function.
The function signature is as follows:
function [c, ceq] = ConFunc(x)
, where
c and ceq contain inequality and equality contraints, respectively. The ceq output can be omitted if it is empty.
Inequality constraints are assumed to have upper bounds of 0, and equality constraints are equal to 0. For constraints of the form g(x) < b, where b ~= 0, the recommended best practice is to write the constraint as (g(x) - b) / abs(b) < 0.
Use [ ] if unused and the options argument is needed.
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.
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

Examples

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
Modify the previous example to pass an extra parameter to the function using a function handle.
function obj = ObjFunc(x,offset)
    obj = 2*(x(1)-3)^2 - 5*(x(1)-3)*(x(2)-2) + 4*(x(2)-2)^2 + offset;
end
handle = @(x) ObjFunc(x,7);
[x,fval] = arsm(handle,init,A,b,[],[],lb,ub)
x = [Matrix] 1 x 2
7.00001  5.00000
fval = 15

Comments

arsm uses an Adaptive Response Surface Method.

See the fmincon optimization tutorial, Activate-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
  • Display: 'off'

Unbounded limits design variable limits are not fully supported and are set to -1000 and 1000. Use of large limits is discouraged due to the size of the search area.

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