Fmincon
Fmincon
fmincon
Find minimum of constrained nonlinear multivariable function
b and beq are vectors, A and Aeq are matrices, c(x) and ceq(x) are functions that return vectors, and f(x) is a
function that returns a scalar. f(x), c(x), and ceq(x) can be nonlinear functions.
Syntax
x = fmincon(fun,x0,A,b)
x = fmincon(fun,x0,A,b,Aeq,beq)
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub)
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon)
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)
x = fmincon(problem)
[x,fval] = fmincon(___)
[x,fval,exitflag,output] = fmincon(___)
[x,fval,exitflag,output,lambda,grad,hessian] = fmincon(___)
Description
Look in the region where x has positive values, x(1) ≤ 1, and x(2) ≤ 2.
lb = [0,0];
ub = [1,2];
Try an initial point in the middle of the region. Find the minimum of fun, subject to the bound constraints.
x0 = [0.5,1];
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub)
Local minimum found that satisfies the constraints.
1.0000 2.0000
Find the point where Rosenbrock's function is minimized within a circle, also subject to bound constraints.
3
x =
0.5000 0.2500
Exercises.
1. Open script scr1_circecon.m. Carefully analyze the program code
and comments.
This script demonstrates the use of fmincon solver to solve the
problem of minimizing of Rosenbrock's function subject to bound
constraints (EXAMPLE 1, EXAMPLE 3) and additional nonlinear
constraint (EXAMPLE 2). Rosenbrock's function is minimized within
a circle. EXAMPLE 3 demonstrates the transfer of additional
parameters through the fmincon function header.
2. Run script scr1_circecon.m. Thoroughly analyze the printed in
command window results.
3. Open and run script scr1_circecon.m. This script demonstrates the
transfer of additional parameter through the global variable.
4. Analyze:
the location of the optimal points relative to the boundaries
of admissible sets;
the optimal values of objective function at these points;
the values of the components of the gradient;
the matrix of the second derivatives (hessian).