
where the parameter r is a positive number. The penalty function method is an
iterative minimization scheme in which the value of r is gradually increased at each
iteration, and Equation (8.18) is successively minimized to obtain a series of optimal
points. The penalty function is first minimized using a small value of r, say 1.0. The
optimum value of x obtained at this iteration is used as the starting guess value for
the next iteration, in which the value of r is increased. The increase in r with each
subsequent iteration shifts the optimum point of Equation (8.18) towards the
optimum x*off xðÞ.Whenr ! ∞, k hxðÞk!0, and the optimum of the penalty
function approaches the optimum of the objective function. Inequality constraints
can also be incorporated into a penalty function through the use of slack variables,
as demonstrated earlier in the Lagrange multiplier method.
Using MATLAB
The fmincon function in Optimization Toolbox performs constrained minimiza-
tion of a function of several variables. The constraints can be of the following types:
(1) linear inequality and equality constraints: Ax b; A
eq
x ¼ b
eq
,
(2) nonlinear inequality and equality constraints: Cx 0; C
eq
x ¼ 0,
(3) bounds: l ≤ x ≤ u, where l is the lower bound vector and u is the upper bound vector.
The syntax for fmincon is
x = fmincon(func, x0, A, b, Aeq, beq, lb, ub, confunc, options)
func returns the value of the objective function at any point x; x0 is the starting guess
point, A is the linear inequality coefficient matrix, b is the linear inequality constants
vector, Aeq is the linear equality coefficient matrix, and beq is the linear equality
constants vector. If there are no linear inequality constraints, assign a null vector [] to
A and b. Similarly, if no linear equality constraints exist, set Aeq = [] and beq=[].
Note that lb and ub are vectors that define the upper and lower bounds of the
variables. If no bounds exist, use a null vector as a place holder for lb and ub.
Also, confunc is a function that defines the nonlinear inequality and equality con-
straints. It calculates the values of Cx and C
eq
x. The objective function func is
minimized such that Cx 0andC
eq
x ¼ 0. If nonlinear constraints do not exist for
the problem, then the non-existent function should be represented by a null vector [].
There are several different ways in which the functi on can be called. See help
fmincon for more infor mation on its syntax.
Example 8.5
Use fmincon to solve the constrained optimization problem described in Example 8.4.
We create two functions m-files, one to evaluate the objective function, and the other to evaluate the
nonlinear constraint.
MATLAB program 8.20
function f = func(x)
f = (x(1) + 1)^2 - x(1)*x(2);
In MATLAB, we type the following. The output is also displayed below.
44
A = [-1 -1]; b = 4;
44
fmincon (‘func’, [0,1], A, b)
529
8.4 Constrained nonlinear optimization