optiprob

Create a structure describing the optimization problem

Syntax

prob = optiprob('param1',value1,'param2',value2,...)

optiprob

prob = optiprob

prob = optiprob(oldprob,'param1',value1,...)

Description

Note from v1.53 this function is no longer required to build an opti object.

The function optiprob creates the problem structure that you pass to opti for building an optimization problem.

prob = optiprob('param1',value1,'param2',value2,...) creates a OPTI problem structure in which the specified parameters (param) have the specified values (value).

optiprob with no input or output arguments displays a complete list of parameters with their valid names.

prob = optiprob with no input arguments creates a default problem structure

options = optiprob(oldprob,'param1',value1,...) updates the existing object structure, oldprob, with the new values specified.

Fields

The following table lists the available fields for optiprob, noting some field have more than one name associated for ease of use:

Parameter Value Description Default
Name string Optional Problem Name 'OPTI Problem'
f / c / grad 1) double column vector or
2) function handle
1) LP / QP linear gradient vector
2) Nonlinear Objective Function Gradient
[]
H / hess 1) double matrix or
2) function handle
1) QP Quadratic Hessian Matrix
2) Nonlinear Hessian of the Lagrangian
[]
Hstr function handle (sparse) Nonlinear Hessian Structure []
fun / obj function handle

Nonlinear Objective Function

[]
sense double scalar Optimization Sense (1 Minimization, -1 Maximization) 1
objbias double scalar Linear or Quadratic Objective Bias Term 0
A double matrix Linear Inequality Constraints LHS (Ax <= b) or
System of Linear Equations LHS (A)
[]
b double column vector Linear Inequality Constraints RHS or
System of Linear Equations RHS (b)
[]
Aeq double matrix Linear Equality Constraints LHS (Aeqx = beq) []
beq double column vector Linear Equality Constraints RHS []
rl double column vector Linear Constraint Lowed Bound (rl <= A*x <= ru) []
ru double column vector Linear Constraint Upper Bound []
lb double column vector Lower Bounds (lb <= x <= ub) []
ub double column vector Upper Bounds []
Q 1) double matrix or
2) column cell array of double matrices
1) Quadratic Constraint Quadratic LHS (x'Qx + l'x <= r)
2) A cell array of (1)
[]
l 1) double column vector or
2) double matrix
1) Quadratic Constraint Linear LHS
2) A matrix of (1), each column representing a quadratic constraint l
[]
qrl 1) double scalar or
2) double column vector
1) Quadratic Constraint Lower Bound
2) A vector of (1), each row representing a quadratic constraint qrl
[]
qru 1) double scalar or
2) double column vector
1) Quadratic Constraint Upper Bound
2) A vector of (1), each row representing a quadratic constraint qru
[]
sdcone 1) double matrix
2) column cell array of double matrices
1) Semidefinite constraint (sum(xi*Fi) - F0 >= 0) as [F0(:) F1(:) ... Fn(:)]
2) A cell array of (1)
[]
sedumi structure A structure with fields At, b, c, and K representing a SeDuMi problem []
nlcon function handle Nonlinear Constraint Function []
nljac function handle (sparse) Nonlinear Constraint Function Jacobian []
nljacstr function handle (sparse) Nonlinear Constraint Function Jacobian Structure []
nlrhs double column vector Nonlinear Constraint RHS []
nle double column vector Nonlinear Constraint Type (-1 <=, 0 ==, 1 >=) []
cl double column vector Nonlinear Constraint Lower Bound (cl <= nlcon(x) <= cu) []
cu double column vector Nonlinear Constraint Upper Bound []
int / ctype / vtype / ivars 1) character row vector
2) double column vector
1) Integer Variable String (C Continuous, I Integer, B Binary)
2) Integer Variable Indices (e.g. [1 3 5] for 'ICICI')
[]
sos structure SOS constraint structure (.type, .index, .weight) []
xdata double column vector Data Fitting Problem x data []
ydata double column vector Data Fitting Problem y data []
x0 / theta0 double column vector Initial Solution Guess []
ode function handle Dynamic Optimization ODE Function []
z0 / odez0 double column vector Dynamic Optimization ODE Initial State Vector []

Alternative Entry Groups

To make entering groups of fields easier, several extra arguments are recognized by optiprob for entering common groups:

Group Parameters Description Example
ineq A, b Linear Inequality Constraints, A + b optiprob('ineq',A,b)
eq Aeq, beq Linear Equality Constraints, Aeq + beq optiprob('eq',Aeq,beq)
lin A, rl, ru Linear Constraints A + rl + ru optiprob('lin',A,rl,ru)
bounds lb, ub Lower and Upper Bounds optiprob('bounds',lb,ub)
mix A, b, e Mixed Linear Constraints and Type, A + b + e where e is (-1 <=, 0 ==, 1 >=) optiprob('mix',A,b,e)
ndec x0 = NaN(ndec,1) Sets the number of decision variables in a nonlinear problem optiprob('ndec',2)
nlmix nlcon, nlrhs, nle Mixed Nonlinear Constraints and Type, nlcon + nlrhs + nle optiprob('nlmix',nlcon,nlrhs,nle)
nl nlcon, cl, cu Nonlinear Constraints nlcon + cl + cu optiprob('nl',nlcon,cl,cu)
sle A, b System of Linear Equations, A + b optiprob('sle',A,b)
qp H, f Quadratic Objective Function, H + f optiprob('qp',H,f)
qc Q, l, qru Quadratic Inequality Constraints, Q + l + qru optiprob('qc',Q,l,qru)
qcrow Q, l, qrl, qru Quadratic Inequality Constraints, Q + l + qrl + qru optiprob('qcrow',Q,l,qrl,qru)
sos sostype, sosind, soswt Special Ordered Set (SOS) type + indices + weights optiprob('sos',type,index,weight)
data xdata, ydata Data Fitting Problem data optiprob('data',xdata,ydata)

Examples

Creating a LP

% LP Objective & Constraints
f = -[6 5]';
A = ([1,4; 6,4; 2, -5]);
b = [16;28;6];

% Build Problem
prob = optiprob('grad',f,'ineq',A,b,'bounds',[0;0],[10;10]);

Creating a MILP

% MILP Objective & Constraints
f = -[6 5]';
A = ([1,4; 6,4; 2, -5]);
b = [16;28;6];

% Build Problem
prob = optiprob('grad',f,'ineq',A,b,'bounds',[0;0],[10;10],'int','II');

Creating a NLP

% NLP Objective
obj   = @(x) (x(1) - x(2))^2 + (x(2) + x(3) - 2)^2 + (x(4) - 1)^2 + (x(5) - 1)^2;

% NLP Constraints
nlcon = @(x) [ x(1) + 3*x(2);
               x(3) + x(4) - 2*x(5);
               x(2) - x(5) ];
nlrhs = [4 0 0]';
nle   = [0 0 0]';

% Build Problem
prob = optiprob('obj',obj,'nlmix',nlcon,nlrhs,nle,'ndec',5);