# 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. `b`- The upper bound of the inequality constraints
`A*x<=b`

. `Aeq`- A matrix used to compute
`Aeq*x`

for equality contraints. `beq`- The upper bound of the equality constraints
`Aeq*x=beq`

. `lb`- The design variable lower bounds.
`ub`- The design variable upper bounds.
`nonlcon`- The nonlinear constraints function.
`options`- A struct containing options settings.

## Outputs

- x
- The location of the function minimum.
- fval
- The minimum of the function.
- info
- The convergence status flag.
- 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:
- linear inequality contraints
- linear equality constraints
- nonlinear inequality contraints
- nonlinear equality constraints

## Examples

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

.

```
-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
```

```
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, Compose-4030: Optimization Algorithms in OML, for an example with nonlinear constraints.

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