opti_fmincon

Solve a NLP using an OPTI solver (e.g. IPOPT)

Syntax

x = opti_fmincon(fun,x0,A,b)

x = opti_fmincon(fun,x0,A,b,Aeq,beq)

x = opti_fmincon(fun,x0,A,b,Aeq,beq,lb,ub)

x = opti_fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon)

[x,fval,exitflag,info,Opt] = opti_fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,opts)

Description

x = opti_fmincon(fun,x0,A,b) solves the constrained nonlinear optimization with nonlinear objective specified by fun, using initial guess x0, subject to linear inequality constraints A, b.

x = opti_fmincon(fun,x0,A,b,Aeq,beq) solves subject to the linear equality constraints, Aeq, beq.

x = opti_fmincon(fun,x0,A,b,Aeq,beq,lb,ub) solves subject to the decision variable bounds lb, ub.

x = opti_fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon) solves subject to the nonlinear constraints, specified by nonlcon. See below for a description on how to specify these.

[x,fval,exitflag,info,Opt] = opti_fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,opts) allows the user to specify additional options via opts, created from optiset. This includes being able to specify the solver used via the 'solver' field. Also returned is the function value at the solution, exitflag, plus information structure and internally created OPTI object.

Typical Use

This function is provided for users who are familiar with the Matlab Optimization Toolbox and its routines, and wish to experiment with OPTI toolbox routines without major code changes. It is suggested once you are familiar with the OPTI class and creating it, to use it explicitly rather than calling this function.

Specifying a Gradient

In order to specify the gradient of the objective function, it can be supplied in Matlab format as a second output argument of fun, for example:

function [fun,grad] = myfun(x)

Unlike the Matlab equivalent, the OPTI function will automatically determine the second argument and use it as the first derivative in the internal solver algorithm.

Nonlinear Constraints

In order to specify nonlinear inequality and equality constraints, they can be supplied in Matlab format as a two return argument function, as follows:

function [ineq,eq] = mycon(x)

%Inequalities of the form: ineq(x) <= 0

%Equalities of the form: eq(x) == 0

Currently Jacobians can not be supplied of the constraints.