« Previous « Start » Next »
3 TOMLAB /SOL Solver Reference
The SOL solvers are a set of Fortran solvers that were developed
by the Stanford Systems Optimization Laboratory (SOL). Table
1 lists the solvers included in TOMLAB /SOL. The
solvers are called using a set of MEXfile interfaces developed as
part of TOMLAB. All functionality of the SOL solvers are available
and changeable in the TOMLAB framework in Matlab.
Detailed descriptions of the TOMLAB /SOL solvers are given in the
following sections. Also see the Mfile help for each solver.
The solvers reference guides for the TOMLAB /SOL solvers are
available for download from the TOMLAB home page
http://tomopt.com. There is also detailed instruction for
using the solvers in Section
4. Extensive TOMLAB mfile
help is also available, for example
help snoptTL in Matlab
will display the features of the SNOPT solver using the TOMLAB
format.
TOMLAB /SOL solves
nonlinear optimization problems
(
con) defined as


f(x) 


s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 
c_{L} 
≤ 
c(x) 
≤ 
c_{U} 


(1) 
where
x,
x_{L},
x_{U} R^{n},
f(
x)
R,
A
R^{m1 × n},
b_{L},
b_{U} R^{m1}
and
c_{L},
c(
x),
c_{U} R^{m2}.
quadratic programming (
qp) problems defined as


f(x) = 

x^{T} F x + c^{T} x 



s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 


(2) 
where
c,
x,
x_{L},
x_{U} R^{n},
F R^{n
× n},
A R^{m1 × n}, and
b_{L},
b_{U}
R^{m1}.
linear programming (
lp) problems defined as


f(x) = c^{T} x 


s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 


(3) 
where
c,
x,
x_{L},
x_{U} R^{n},
A R^{m1
× n}, and
b_{L},
b_{U} R^{m1}.
linear least squares (
lls) problems defined as





s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 


(4) 
where
x,
x_{L},
x_{U} R^{n},
d R^{M},
C
R^{M × n},
A R^{m1 × n},
b_{L},
b_{U} R^{m1}.
and
constrained nonlinear least squares problems defined as





s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 
c_{L} 
≤ 
c(x) 
≤ 
c_{U} 


(5) 
where
x,
x_{L},
x_{U} R^{n},
r(
x)
R^{M},
A R^{m1 × n},
b_{L},
b_{U}
R^{m1} and
c_{L},
c(
x),
c_{U} R^{m2}.
Table 1: The SOL optimization solvers in TOMLAB /SOL.

Function 
Description 
Reference 

MINOS 5.5 
Sparse linear and nonlinear programming with linear and nonlinear constraints. 
[27] 
LPMINOS 
A special version of the MINOS 5.5 MEXfile interface for sparse linear programming. 
[27] 
QPMINOS 
A special version of the MINOS 5.5 MEXfile interface for sparse quadratic programming. 
[27] 
LPOPT 1.010 
Dense linear programming. 
[16] 
QPOPT 1.010 
Nonconvex quadratic programming with dense constraint matrix and sparse or dense quadratic matrix. 
[16] 
LSSOL 1.054 
Dense linear and quadratic programs (convex), and constrained linear least squares problems. 
[15] 
NLSSOL 5.02 
Constrained nonlinear least squares. NLSSOL is based on NPSOL. No reference except for general NPSOL 
[20] 
NPSOL 5.02 
Dense linear and nonlinear programming with linear and nonlinear constraints. 
[20] 
SNOPT 7.11 
Large, sparse linear and nonlinear programming with linear and nonlinear constraints. 
[19, 17] 
SQOPT 7.11 
Sparse convex quadratic programming. 
[18] 

3.1.1 Direct Solver Call
A direct solver call is not recommended unless the user is 100 %
sure that no other solvers will be used for the problem. Please
refer to Section
3.1.2 for information on how to use MINOS
with TOMLAB.
Purpose
minos solves nonlinear optimization
problems defined as


f(x) 


s/t 


x 

, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 


c(x) 




(6) 
where
x R^{n},
f(
x)
R,
A
R^{m1 × n},
b_{L},
b_{U} R^{n+m1+m2}
and
c(
x)
R^{m2}.
or quadratic optimization problems defined as


f(x) = 

x^{T} F x + c^{T} x 



s/t 


x 

, 
b_{L} 
≤ 
g(x) 
≤ 
b_{U} 


A x 




(7) 
where
c,
x R^{n},
F R^{n × n},
A R^{m1 × n}, and
b_{L},
b_{U}
R^{m1}.
The full input matrix A has three parts A = [d/dx g(x); A; c'];
Calling Syntax
The file 'funfdf.m' must be defined and contain: function [mode,
f, g] = funfdf(x, Prob, mode, nstate) to compute the objective
function f and the gradient g at the point x.
The file 'funcdc.m' must be defined and contain: function [mode ,c
,dcS] = funcdc(x, Prob, mode, nstate) to compute the nonlinear
constraint value c and the constraint Jacobian dcS for the
nonlinear constraints at the point x.
NOTE: The matrix dcS MUST be a SPARSE MATLAB matrix. Do dcS =
sparse(dcS); after dcS has been computed.
[hs, xs, pi, rc, Inform, nS, nInf, sInf, Obj, iwCount, gObj, fCon,
gCon] = minos(H, A, bl, bu, nnCon, nnObj, nnJac, Prob, iObj,
optPar, Warm, hs, xs, pi, nS, SpecsFile, PrintFile, SummFile,
PriLev, ObjAdd, moremem, ProbName );
Description of Inputs
The following fields are used: 

H 
Matrix n x n in a quadratic programming (QP) problem.
DENSE or SPARSE. Leave empty if LP, or NLP problem. 

A 
Constraint matrix, m x n SPARSE (nonlinear, linear and
objective) m > 0 always!!! Define dummy constraint for
unconstrained problems. 

bl 
Lower bounds on (x,g(x),Ax,c'). 

bu 
Upper bounds on (x,g(x),Ax,c'). 


NOTE! The bl and bu values for the last nonlinear
constraint c must have reverse signs and be put in each other
places: If c_{L} <= c(x) <= c_{U} , then bl = −c_{U} and bu =
−c_{L}. This is because the bounds acts as the constraints on the
slack variables for the nonlinear constraints. 

nnCon 
Number of nonlinear constraints. 

nnObj 
Number of nonlinear objective variables. 

nnJac 
Number of nonlinear Jacobian variables. 

Prob 
Must be a structure. No check is made in the MEX
interface. If TOMLAB calls minos, then Prob is the standard TOMLAB
problem structure, otherwise the user should set: 


Prob.P = ProblemNumber, where ProblemNumber is some
integer. 


If the problem is a LP or QP problem (H defined), the
user does not have to specify anything else in the
structure. 


For a general nonlinear objective or nonlinear
constraints names of two user written routines must be given: 


funfdf, actual name stored in Prob.FUNCS.fg, with
syntax [mode, f, g] = funfdf(x, Prob, mode, nstate). 


funcdc, actual name stored in Prob.FUNCS.cdc, with
syntax [mode, c, dcS] = funcdc(x, Prob, mode, nstate). 


MINOS is calling the TOMLAB routines nlp_fg.m and
nlp_cdcS.m in the callback, and they call funfdf and funcdc,
respectively. 


If these fields in Prob are empty (Prob.FUNCS.fg,
Prob.FUNCS.cdc), the TOMLAB callback routines calls the usual
function routines. Then the Prob struct should be normally defined,
and the fields Prob.FUNCS.f, Prob.FUNCS.g, Prob.FUNCS.c,
Prob.FUNCS.dc be set in the normal way (e.g. by the routine
mFiles.m, or one of the Assignroutines like conAssign.m). 


If the mode parameter is 0, funfdf should return f,
otherwise both f and the gradient vector g. If the mode parameter
is 0, funcdc should return c, otherwise both c and dcS. Note that
each row in dcS corresponds to a constraint, and that dcS must be
a SPARSE matrix. 


The user could also write his own versions of the
routines nlp_fg.m and nlp_cdcS.m and put them before in the
path. 

iObj 
Says which row of A is a free row containing a
linear objective vector c. If there is no such vector, iObj = 0.
Otherwise, this row must come after any nonlinear rows, so that
nnCon <= iObj <= m. 

optPar 
Vector with optimization parameters overriding
defaults and the optionally specified SPECS file. If using only
default options, set optPar as an empty matrix. 

Warm 
Flag, if true: warm start. Default cold start (if
empty). If 'Warm Start' xs, nS and hs must be supplied with
correct values. 

hs 
Basis status of variables + constraints (n+m x 1
vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu) 2=superbasic (between bounds), 3=basic (between bounds). 

xs 
Initial vector, optionally including m slacks at
the end. If warm start, full xs must be supplied. 

pi 
Lagrangian multipliers for the nnCon nonlinear
constraints. If empty, set as 0. 

nS 
# of superbasics. Only used if calling again
with a Warm Start. 

SpecsFile 
Name of the SPECS input parameter file, see TOMLAB
Guide. 

PrintFile 
Name of the Print file. Name includes the path,
maximal number of characters = 500. 

SummFile 
Name of the Summary file. Name includes the path,
maximal number of characters = 500. 

PriLev 
Printing level in the minos mfile and minos
MEXinterface. 


= 0 Silent 

= 1 Summary information 

= 2 More detailed information 

ObjAdd 
Constant added to the objective for printing
purposes, typically 0. 

moremem 
Add extra memory for the sparse LU, might speed
up the optimization. If empty, set as 0. 

ProbName 
Name of the problem. <=100 characters are used
in the MEX interface. In the MINOS solver the first 8 characters
are used in the printed solution and in some routines that output
BASIS files. Blank is OK. 

Description of Outputs
The following fields are used: 

hs 
Basis status of variables + constraints (n+m x 1
vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu) 2=superbasic (between bounds), 3=basic (between bounds). 

Basic and superbasic variables may be outside
their bounds by as much as the Feasibility tolerance.
Note that if scaling is specified, the Feasibility tolerance
applies to the variables of the scaled problem.
In this case, the variables of the original problem may be
as much as 0.1 outside their bounds, but this is unlikely
unless the problem is very badly scaled. Check the
“Primal infeasibility" printed after the EXIT
message. 


Very occasionally some nonbasic variables may be outside
their bounds by as much as the Feasibility tolerance,
and there may be some nonbasics for which
xn(j) lies strictly between its bounds. 


If ninf > 0, some basic and superbasic variables
may be outside their bounds by an arbitrary amount
(bounded by sinf if scaling was not used). 

xs 
Solution vector (n+m by 1) with n decision variable
values together with the m slack variables. 

pi 
Lagrangian multipliers (dual solution vector) (m x 1
vector) 

rc 
Vector of reduced costs, g − ( A I )^{T}π, where g
is the gradient of the objective function if xn
is feasible, or the gradient of the Phase1 objective otherwise.
If ninf = 0, the last m entries are −π.
Reduced costs vector is of n+m length. 

Inform 
Result of MINOS run. 


0 Optimal solution found. 

1 The problem is infeasible. 

2 The problem is unbounded (or badly scaled). 

3 Too many iterations. 

4 Apparent stall. The solution has not changed for a
large number of iterations (e.g. 1000). 

5 The Superbasics limit is too small. 

6 User requested termination (by returning bad value). 

7 Gradient seems to be giving incorrect derivatives. 

8 Jacobian seems to be giving incorrect derivatives. 

9 The current point cannot be improved. 

10 Numerical error in trying to satisfy the linear constraints
(or the linearized nonlinear constraints). The basis is
very illconditioned. 

11 Cannot find a superbasic to replace a basic variable. 

12 Basis factorization requested twice in a row.
Should probably be treated as inform = 9. 

13 Nearoptimal solution found.
Should probably be treated as inform = 9. 


20 Not enough storage for the basis factorization. 

21 Error in basis package. 

22 The basis is singular after several attempts to
factorize it (and add slacks where necessary). 

30 An OLD BASIS file had dimensions that did not match the
current problem. 

32 System error. Wrong number of basic variables. 

40 Fatal errors in the MPS file. 

41 Not enough storage to read the MPS file. 

42 Not enough storage to solve the problem. 

nS 
# of superbasics. 

nInf 
Number of infeasibilities. 

sInf 
Sum of infeasibilities. 

Obj 
Objective function value at optimum. 

iwCount 
Number of iterations (major and minor), function and constraint
calls. 

gObj 
Gradient of the nonlinear objective. 

fCon 
Nonlinear constraint vector. 

gCon 
Gradient vector (nonzeros) of the nonlinear constraint
vector. 

3.1.2 Using TOMLAB
Purpose
minosTL solves nonlinear optimization
problems defined as


f(x) 


s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 
c_{L} 
≤ 
c(x) 
≤ 
c_{U} 


(8) 
where
x,
x_{L},
x_{U} R^{n},
f(
x)
R,
A
R^{m1 × n},
b_{L},
b_{U} R^{m1}
and
c_{L},
c(
x),
c_{U} R^{m2}.
Calling Syntax
Using the driver routine
tomRun:
Prob = ◇Assign( ... );
Result = tomRun('minos', Prob, 1);
Description of Inputs
Prob, The following fields are used: 

x_L, x_U 
Bounds on variables. 

b_L, b_U 
Bounds on linear constraints. 

c_L, c_U 
Bounds on nonlinear constraints. 

A 
Linear constraint matrix. 

QP.c 
Linear coefficients in objective function. 

PriLevOpt 
Print level. 

WarmStart 
If true, use warm start, otherwise cold
start. 

SOL.xs 
Solution and slacks from previous run. 

SOL.hs 
State for solution and slacks from previous
run. 

SOL.nS 
Number of superbasics from previous run. 

SOL.SpecsFile 
Name of user defined SPECS file, read BEFORE optPar() is
used. 

SOL.PrintFile 
Name of SOL Print file. Amount and type of printing determined by SPECS parameters or optPar parameters. 

SOL.SummFile 
Name of SOL Summary File. 

SOL.optPar 
Elements > 999 takes precedence over corresponding TOMLAB
params. 

Description of Outputs
Result, The following fields are used: 


Result 
The structure with results (see ResultDef.m). 
f_k 
Function value at optimum. 
x_k 
Solution vector. 
x_0 
Initial solution vector. 
g_k 
Gradient of the function. 
c_k 
Nonlinear constraint residuals. 

cJac 
Nonlinear constraint gradients. 

xState 
State of variables. Free == 0; On lower == 1; On upper == 2; Fixed == 3; 
bState 
State of linear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 
cState 
State of nonlinear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 

v_k 
Lagrangian multipliers (for bounds + dual solution
vector). 

ExitFlag 
Exit status from minos.m (similar to
TOMLAB). 

Inform 
Result of MINOS run. 


0 Optimal solution found. 

1 The problem is infeasible. 

2 The problem is unbounded (or badly scaled). 

3 Too many iterations. 

4 Apparent stall. The solution has not changed for a
large number of iterations (e.g. 1000). 

5 The Superbasics limit is too small. 

6 User requested termination (by returning bad value). 

7 Gradient seems to be giving incorrect derivatives. 

8 Jacobian seems to be giving incorrect derivatives. 

9 The current point cannot be improved. 

10 Numerical error in trying to satisfy the linear constraints
(or the linearized nonlinear constraints). The basis is
very illconditioned. 

11 Cannot find a superbasic to replace a basic variable. 

12 Basis factorization requested twice in a row.
Should probably be treated as inform = 9. 

13 Nearoptimal solution found.
Should probably be treated as inform = 9. 


20 Not enough storage for the basis factorization. 

21 Error in basis package. 

22 The basis is singular after several attempts to
factorize it (and add slacks where necessary). 

30 An OLD BASIS file had dimensions that did not match the
current problem. 

32 System error. Wrong number of basic variables. 

40 Fatal errors in the MPS file. 

41 Not enough storage to read the MPS file. 

42 Not enough storage to solve the problem. 

rc 
Vector of reduced costs, g − ( A I )^{T}π, where g
is the gradient of the objective function if xn
is feasible, or the gradient of the Phase1 objective otherwise.
If ninf = 0, the last m entries are −π.
Reduced costs vector is of n+m length. 

Iter 
Number of iterations. 
FuncEv 
Number of function evaluations. 
GradEv 
Number of gradient evaluations. 
ConstrEv 
Number of constraint evaluations. 

QP.B 
Basis vector in TOMLAB QP standard. 

MinorIter 
Number of minor iterations. 

Solver 
Name of the solver (minos). 
SolverAlgorithm 
Description of the solver. 

SOL.xs 
Solution and slack variables. 

SOL.hs 
Basis status of variables + constraints (n+m x 1
vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu) 2=superbasic (between bounds), 3=basic (between bounds). 

Basic and superbasic variables may be outside
their bounds by as much as the Feasibility tolerance.
Note that if scaling is specified, the Feasibility tolerance
applies to the variables of the scaled problem.
In this case, the variables of the original problem may be
as much as 0.1 outside their bounds, but this is unlikely
unless the problem is very badly scaled. Check the
“Primal infeasibility" printed after the EXIT
message. 


Very occasionally some nonbasic variables may be outside
their bounds by as much as the Feasibility tolerance,
and there may be some nonbasics for which
xn(j) lies strictly between its bounds. 


If ninf > 0, some basic and superbasic variables
may be outside their bounds by an arbitrary amount
(bounded by sinf if scaling was not used). 

SOL.nS 
# of superbasics. 

SOL.nInf 
# of infeasibilities. 

SOL.sInf 
Sum of infeasibilities. 

Description
Use missing value (999 or less), when no change of parameter
setting is wanted. The default value will then be used by MINOS,
unless the value is altered in the SPECS file.
Definition: nnL = max(nnObj,nnJac))
Description of Inputs
The following fields are used: 

# 
SPECS keyword text 
Lower 
Default 
Upper 
Comment 



Printing 
1. 
PRINT LEVEL 
0 
0 
11111 
JFLXB: Jac, fCon, lambda, x, B=LU
stats 

Frequencies I 
5. 
PRINT FREQUENCY 
0 
100 

6. 
SUMMARY FREQUENCY 
0 
100 

7. 
SOLUTION YES/NO 
0 
1 
1 
1 = YES; 0 =
NO 
8. 
SUPPRESS PARAMETERS 
0 
0 
1 
1 =
True 

Convergence Tolerances 
9. 
ROW TOLERANCE 
>0 
1E6 
10. 
OPTIMALITY TOLERANCE 
>0 
max(1E−6,(10eps_{R})^{0.5}) =
1.73E6 
11. 
FEASIBILITY TOLERANCE 
>0 
1E6 

Derivative checking 
13. 
VERIFY LEVEL 
1 
1 
3 
1,0,1,2,3 
14. 
START OBJECTIVE CHECK AT COL 
0 
1 
nnObj 
15. 
STOP OBJECTIVE CHECK AT COL 
0 
nnObj 
nnObj 
16. 
START CONSTRAINT CHECK AT COL 
0 
1 
nnJac 
17. 
STOP CONSTRAINT CHECK AT COL 
0 
nnJac 
nnJac 

Scaling 
18. 
SCALE OPTION 
0 
1 or 2 
2 
2 if LP,1 if
NLP 

See Section 6.2 for more information. 
19. 
SCALE TOLERANCE 
>0 
0.9 
<1 
20. 
SCALE PRINT 
0 
0 
1 
1 =
True 
21. 
CRASH TOLERANCE 
0 
0.1 
<1 

Other Tolerances 
22. 
LINESEARCH TOLERANCE 
>0 
0.1 
<1 

LU I 
23. 
LU FACTORIZATION TOLERANCE 
1 
100 or 5 

100 if LP 
24. 
LU UPDATE TOLERANCE 
1 
10 or 5 

10 if LP 
25. 
LU SWAP TOLERANCE 
>0 
1.22E4 

eps^{1/4} 
26. 
LU SINGULARITY TOLERANCE 
>0 
3.25E11 

eps^{0.67} 

LP or LC subproblems 
27. 
PIVOT TOLERANCE 
>0 
3.25E11 

eps^{0.67} 
28. 
CRASH OPTION 
0 
3 
3 
0,1,2,3 
29. 
WEIGHT ON LINEAR OBJECTIVE 
0.0 
0.0 

during Phase
1 
30. 
ITERATIONS LIMIT 
0 
3(m+m3) + 10nnL 

m3=1 if length(Prob.QP.c) > 0, otherwise m3=0. 

TOMLAB default: max(10000,3(m+m3) + 10nnL). 
31. 
PARTIAL PRICE 
1 
10 or 1 

10 for LP 

SLC method 
32. 
MAXIMIZE 
0 
0 
1 
1=maximize 
33. 
LAGRANGIAN 
0 
1 
1 
1=YES, 0=NO 
34. 
PENALTY PARAMETER 
0.0 
1.0 
35. 
MAJOR ITERATIONS LIMIT 
>0 
50 
36. 
MINOR ITERATIONS LIMIT 
>0 
40 
37. 
MAJOR DAMPING PARAMETER 
>0 
2.0 
38. 
MINOR DAMPING PARAMETER 
>0 
2.0 
39. 
DERIVATIVE LEVEL 
0 
3 
3 
0,1,2,3 

Is always set by minosTL dependent on Prob.ConsDiff, Prob.NumDiff. 
40. 
RADIUS OF CONVERGENCE 
0.0 
0.01 
41. 
FUNCTION PRECISION 
>0 
3.0E13 

eps^{0.8}=eps_{R} 
42. 
DIFFERENCE INTERVAL 
>0 
5.48E7 

eps^{0.4} 
43. 
CENTRAL DIFFERENCE INTERVAL 
>0 
6.69E5 

eps^{0.8/3} 
44. 
COMPLETION 
0 
1 LC, 0 NC 
1 
0=PARTIAL
1=FULL 
45. 
UNBOUNDED STEP SIZE 
>0 
1E10 
46. 
UNBOUNDED OBJECTIVE 
>0 
1E20 

Hessian approximation 
47. 
HESSIAN DIMENSION 
1 
50 
1+nnL 
48. 
SUPERBASICS LIMIT 
1 
50 
1+nnL 

TOMLAB default (to avoid termination with Superbasics Limit too small): 

If n <= 5000: max(50,n+1) 

If n > 5000: max(500,n+200−size(A,1)−length(c_{L})) 

Avoid setting REDUCED HESSIAN (number of columns in reduced Hessian). 

It will then be set to the same value as the SUPERBASICS LIMIT by MINOS. 

Frequencies II 
51. 
CHECK FREQUENCY 
>0 
60 
52. 
EXPAND FREQUENCY 
>0 
10000 
53. 
FACTORIZATION FREQUENCY 
>0 
50 

LU II 
63. 
LU PARTIAL PIVOTING 
0 
0 
3 
0=partial 

or LU COMPLETE PIVOTING 



1=complete 

or LU ROOK PIVOTING 



2=rook 

Additional parameters 
67. 
AIJ TOLERANCE 
0 
1E10 

Elements a(i,j) < AIJ TOLERANCE are set as 0 
70. 
SUBSPACE 
>0 
0.5 
1 
Subspace tolerance 

Convergence tolerance in current subspace before consider moving off 

another constraint. 

3.2 LPMINOS
3.2.1 Using TOMLAB
Purpose
minosLPTL solves linear optimization
problems defined as


f(x) = c^{T} x 


s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 


(9) 
where
c,
x,
x_{L},
x_{U} R^{n},
A R^{m1
× n}, and
b_{L},
b_{U} R^{m1}.
Calling Syntax
Using the driver routine
tomRun:
Prob = lpAssign( ... );
Result = tomRun('lpminos', Prob ... );
or
Prob = ProbCheck( ... );
Result = minosLPTL(Prob);
Call Prob = lpAssign( ... ) or Prob = ProbDef to define the Prob
for the second option.
Description of Inputs
Prob, The following fields are used: 

x_L, x_U 
Bounds on variables. 

b_L, b_U 
Bounds on linear constraints. 

A 
Linear constraint matrix. 

QP.c 
Linear coefficients in objective function. 

PriLevOpt 
Print level. 

WarmStart 
If true, use warm start, otherwise cold
start. 

SOL.xs 
Solution and slacks from previous run. 

SOL.hs 
State for solution and slacks from previous
run. 

SOL.nS 
Number of superbasics from previous run (always 0 for LP). 

SOL.SpecsFile 
Name of user defined SPECS file, read BEFORE optPar() is
used. 

SOL.PrintFile 
Name of SOL Print file. Amount and type of printing determined by SPECS parameters or optPar parameters. 

SOL.SummFile 
Name of SOL Summary File. 

SOL.optPar 
Elements > 999 takes precedence over corresponding TOMLAB
params. 

Description of Outputs
Result, The following fields are used: 


Result 
The structure with results (see ResultDef.m). 
f_k 
Function value at optimum. 
x_k 
Solution vector. 
x_0 
Initial solution vector. 
g_k 
Gradient c (linear objective). 

xState 
State of variables. Free == 0; On lower == 1; On upper == 2; Fixed == 3; 
bState 
State of linear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 

v_k 
Lagrangian multipliers (for bounds + dual solution
vector). 

ExitFlag 
Exit status from minos.m (similar to
TOMLAB). 

Inform 
Result of MINOS run. 


0 Optimal solution found. 

1 The problem is infeasible. 

2 The problem is unbounded (or badly scaled). 

3 Too many iterations. 

4 Apparent stall. The solution has not changed for a
large number of iterations (e.g. 1000). 

5 The Superbasics limit is too small. 

6 User requested termination (by returning bad value). 

7 Gradient seems to be giving incorrect derivatives. 

8 Jacobian seems to be giving incorrect derivatives. 

9 The current point cannot be improved. 

10 Numerical error in trying to satisfy the linear constraints
(or the linearized nonlinear constraints). The basis is
very illconditioned. 

11 Cannot find a superbasic to replace a basic variable. 

12 Basis factorization requested twice in a row.
Should probably be treated as inform = 9. 

13 Nearoptimal solution found.
Should probably be treated as inform = 9. 


20 Not enough storage for the basis factorization. 

21 Error in basis package. 

22 The basis is singular after several attempts to
factorize it (and add slacks where necessary). 

30 An OLD BASIS file had dimensions that did not match the
current problem. 

32 System error. Wrong number of basic variables. 

40 Fatal errors in the MPS file. 

41 Not enough storage to read the MPS file. 

42 Not enough storage to solve the problem. 

rc 
Vector of reduced costs, g − ( A I )^{T}π, where g
is the gradient of the objective function if xn
is feasible, or the gradient of the Phase1 objective otherwise.
If ninf = 0, the last m entries are −π.
Reduced costs vector is of n+m length. 

Iter 
Number of iterations. 
FuncEv 
Number of function evaluations. 
ConstrEv 
Number of constraint evaluations. 

QP.B 
Basis vector in TOMLAB QP standard. 

MinorIter 
Number of minor iterations. 

Solver 
Name of the solver (minos). 
SolverAlgorithm 
Description of the solver. 

SOL.xs 
Solution and slack variables. 

SOL.hs 
Basis status of variables + constraints (n+m x 1
vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu) 2=superbasic (between bounds), 3=basic (between bounds). 

Basic and superbasic variables may be outside
their bounds by as much as the Feasibility tolerance.
Note that if scaling is specified, the Feasibility tolerance
applies to the variables of the scaled problem.
In this case, the variables of the original problem may be
as much as 0.1 outside their bounds, but this is unlikely
unless the problem is very badly scaled. Check the
“Primal infeasibility" printed after the EXIT
message. 


Very occasionally some nonbasic variables may be outside
their bounds by as much as the Feasibility tolerance,
and there may be some nonbasics for which
xn(j) lies strictly between its bounds. 


If ninf > 0, some basic and superbasic variables
may be outside their bounds by an arbitrary amount
(bounded by sinf if scaling was not used). 

SOL.nS 
# of superbasics. 

SOL.nInf 
# of infeasibilities. 

SOL.sInf 
Sum of infeasibilities. 

Description
Use missing value (999 or less), when no change of parameter
setting is wanted. The default value will then be used by MINOS,
unless the value is altered in the SPECS file.
Description of Inputs
The following fields are used: 

# 
SPECS keyword text 
Lower 
Default 
Upper 
Comment 



Printing 
1. 
PRINT LEVEL 
0 
0 
1 
0=brief 1=LU stats 

Frequencies I 
5. 
PRINT FREQUENCY 
0 
100 
6. 
SUMMARY FREQUENCY 
0 
100 
7. 
SOLUTION YES/NO 
0 
1 
1 
1 = YES; 0 = NO 
8. 
SUPPRESS PARAMETERS 
0 
0 
1 
1 = True 

Convergence Tolerances 
10. 
OPTIMALITY TOLERANCE 
>0 
1E6 
11. 
FEASIBILITY TOLERANCE 
>0 
1E6 

Scaling 
18. 
SCALE OPTION 
0 
2 
2 
0,1,2 

See Section 6.2 for more information. 
19. 
SCALE TOLERANCE 
>0 
0.9 
<1 
20. 
SCALE PRINT 
0 
0 
1 
1 = True 
21. 
CRASH TOLERANCE 
0 
0.1 
<1 

LU I 
23. 
LU FACTORIZATION TOLERANCE 
1 
100 
24. 
LU UPDATE TOLERANCE 
1 
10 
25. 
LU SWAP TOLERANCE 
>0 
1.22e4 

eps^{1/4} 

26. 
LU SINGULARITY TOLERANCE 
>0 
3.25E11 

eps^{0.67} 

LP parameters 
27. 
PIVOT TOLERANCE 
>0 
3.25E11 

eps^{0.67} 
28. 
CRASH OPTION 
0 
3 
3 
0,1,2,3 
29. 
WEIGHT ON LINEAR OBJECTIVE 
0.0 
0.0 

during Phase 1 
30. 
ITERATIONS LIMIT 
0 
3m 
31. 
PARTIAL PRICE 
1 
10 

Solve with tight or loose tols (applies to LP but probably not useful) 
44. 
COMPLETION 
0 
1 
1 
0=PARTIAL
1=FULL 

Frequencies II 
51. 
CHECK FREQUENCY 
>0 
60 
52. 
EXPAND FREQUENCY 
>0 
10000 
53. 
FACTORIZATION FREQUENCY 
>0 
100 

LU II 
63. 
LU PARTIAL PIVOTING 
0 
0 
3 
0=partial 

or LU COMPLETE PIVOTING 



1=complete 

or LU ROOK PIVOTING 



2=rook 

Additional parameters 
67. 
AIJ TOLERANCE 
0 
1E10 

Elements a(i,j) < AIJ TOLERANCE are set as 0 
70. 
SUBSPACE 
>0 
0.5 
1 
Subspace tolerance 

Convergence tolerance in current subspace before consider moving off 

another constraint. 

3.3 QPMINOS
3.3.1 Using TOMLAB
Purpose
minosQPTL solves quadratic optimization
problems defined as


f(x) = 

x^{T} F x + c^{T} x 



s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 


(10) 
where
c,
x,
x_{L},
x_{U} R^{n},
F R^{n
× n},
A R^{m1 × n}, and
b_{L},
b_{U}
R^{m1}.
Calling Syntax
Using the driver routine
tomRun:
Prob = qpAssign( ... );
Result = tomRun('qpminos', Prob ... );
or
Prob = ProbCheck( ... );
Result = minosQPTL(Prob);
Call Prob = qpAssign( ... ) or Prob=ProbDef to define the Prob for
the second option.
Description of Inputs
Prob, The following fields are used: 

x_L, x_U 
Bounds on variables. 

b_L, b_U 
Bounds on linear constraints. 

A 
Linear constraint matrix. 

QP.c 
Linear coefficients in objective function. 

QP.F 
Quadratic matrix of size nnObj x nnObj. nnObj < n is
OK. 

PriLevOpt 
Print level. 

WarmStart 
If true, use warm start, otherwise cold
start. 

SOL.xs 
Solution and slacks from previous run. 

SOL.hs 
State for solution and slacks from previous
run. 

SOL.nS 
Number of superbasics from previous run. 

SOL.SpecsFile 
Name of user defined SPECS file, read BEFORE optPar() is
used. 

SOL.PrintFile 
Name of SOL Print file. Amount and type of printing determined by SPECS parameters or optPar parameters. 

SOL.SummFile 
Name of SOL Summary File. 

SOL.optPar 
Elements > 999 takes precedence over corresponding TOMLAB
params. 

Description of Outputs
Result, The following fields are used: 


Result 
The structure with results (see ResultDef.m). 
f_k 
Function value at optimum. 
x_k 
Solution vector. 
x_0 
Initial solution vector. 
g_k 
Gradient c (linear objective). 

xState 
State of variables. Free == 0; On lower == 1; On upper == 2; Fixed == 3; 
bState 
State of linear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 

v_k 
Lagrangian multipliers (for bounds + dual solution
vector). 

ExitFlag 
Exit status from minos.m (similar to
TOMLAB). 

Inform 
Result of MINOS run. 


0 Optimal solution found. 

1 The problem is infeasible. 

2 The problem is unbounded (or badly scaled). 

3 Too many iterations. 

4 Apparent stall. The solution has not changed for a
large number of iterations (e.g. 1000). 

5 The Superbasics limit is too small. 

6 User requested termination (by returning bad value). 

7 Gradient seems to be giving incorrect derivatives. 

8 Jacobian seems to be giving incorrect derivatives. 

9 The current point cannot be improved. 

10 Numerical error in trying to satisfy the linear constraints
(or the linearized nonlinear constraints). The basis is
very illconditioned. 

11 Cannot find a superbasic to replace a basic variable. 

12 Basis factorization requested twice in a row.
Should probably be treated as inform = 9. 

13 Nearoptimal solution found.
Should probably be treated as inform = 9. 


20 Not enough storage for the basis factorization. 

21 Error in basis package. 

22 The basis is singular after several attempts to
factorize it (and add slacks where necessary). 

30 An OLD BASIS file had dimensions that did not match the
current problem. 

32 System error. Wrong number of basic variables. 

40 Fatal errors in the MPS file. 

41 Not enough storage to read the MPS file. 

42 Not enough storage to solve the problem. 

rc 
Vector of reduced costs, g − ( A I )^{T}π, where g
is the gradient of the objective function if xn
is feasible, or the gradient of the Phase1 objective otherwise.
If ninf = 0, the last m entries are −π.
Reduced costs vector is of n+m length. 

Iter 
Number of iterations. 
FuncEv 
Number of function evaluations. Set to Iter. 
GradEv 
Number of gradient evaluations. Set to Iter. 
ConstrEv 
Number of constraint evaluations. Set to 0. 

QP.B 
Basis vector in TOMLAB QP standard. 

MinorIter 
Number of minor iterations. NOT SET. 

Solver 
Name of the solver (minos). 
SolverAlgorithm 
Description of the solver. 

SOL.xs 
Solution and slack variables. 

SOL.hs 
Basis status of variables + constraints (n+m x 1
vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu) 2=superbasic (between bounds), 3=basic (between bounds). 

Basic and superbasic variables may be outside
their bounds by as much as the Feasibility tolerance.
Note that if scaling is specified, the Feasibility tolerance
applies to the variables of the scaled problem.
In this case, the variables of the original problem may be
as much as 0.1 outside their bounds, but this is unlikely
unless the problem is very badly scaled. Check the
“Primal infeasibility" printed after the EXIT
message. 


Very occasionally some nonbasic variables may be outside
their bounds by as much as the Feasibility tolerance,
and there may be some nonbasics for which
xn(j) lies strictly between its bounds. 


If ninf > 0, some basic and superbasic variables
may be outside their bounds by an arbitrary amount
(bounded by sinf if scaling was not used). 

SOL.nS 
# of superbasics. 

SOL.nInf 
# of infeasibilities. 

SOL.sInf 
Sum of infeasibilities. 

Description
Use missing value (999 or less), when no change of parameter
setting is wanted. The default value will then be used by MINOS,
unless the value is altered in the SPECS file.
Description of Inputs
The following fields are used: 

# 
SPECS keyword text 
Lower 
Default 
Upper 
Comment 



Printing 
1. 
PRINT LEVEL 
0 
0 
1 
0=brief 1=LU stats 

Frequencies I 
5. 
PRINT FREQUENCY 
0 
100 
6. 
SUMMARY FREQUENCY 
0 
1 
7. 
SOLUTION YES/NO 
0 
1 
1 
1 = YES; 0 =
NO 
8. 
SUPPRESS PARAMETERS 
0 
0 
1 
1 =
True 

Convergence Tolerances 
10. 
OPTIMALITY TOLERANCE 
>0 
max(1E−6,(10eps_{R})^{0.5}) =
1.73E6 
11. 
FEASIBILITY TOLERANCE 
>0 
1E6 

Derivative checking 
13. 
VERIFY LEVEL 
1 
1 
3 
1,0,1,2,3 
14. 
START OBJECTIVE CHECK AT COL 
0 
1 
nnObj 
15. 
STOP OBJECTIVE CHECK AT COL 
0 
nnObj 
nnObj 

Scaling 
18. 
SCALE OPTION 
0 
1 
2 

See Section 6.2 for more information. 
19. 
SCALE TOLERANCE 
>0 
0.9 
<1 
20. 
SCALE PRINT 
0 
0 
1 
1 = True 
21. 
CRASH TOLERANCE 
0 
0.1 
<1 

Other Tolerances 
22. 
LINESEARCH TOLERANCE 
>0 
0.1 
<1 

LU I 
23. 
LU FACTOR TOLERANCE 
1 
5.0 
24. 
LU UPDATE TOLERANCE 
1 
5.0 
25. 
LU SWAP TOLERANCE 
>0 
1.22E4 

eps^{1/4} 
26. 
LU SINGULARITY TOLERANCE 
>0 
3.25E11 

eps^{0.67} 

LP parameters 
27. 
PIVOT TOLERANCE 
>0 
3.25E11 

eps^{0.67} 
28. 
CRASH OPTION 
0 
3 
3 
0,1,2,3 
29. 
WEIGHT ON LINEAR OBJECTIVE 
0.0 
0.0 

during Phase
1 
30. 
ITERATIONS LIMIT 
0 
3(m+m3) + 10nnL 

m3=1 if length(Prob.QP.c) > 0, otherwise m3=0. 

TOMLAB default: max(10000,3(m+m3) + 10nnL). 
31. 
PARTIAL PRICE 
1 
1 
32. 
MAXIMIZE 
0 
0 
1 
1=maximize 

Reducedgradient method 
39. 
DERIVATIVE LEVEL 
0 
3 
3 
0,1,2,3 

Is always set by minosqpTL to 3. 
41. 
FUNCTION PRECISION 
>0 
3.0E13 

eps^{0.8}=eps_{R} 
42. 
DIFFERENCE INTERVAL 
>0 
5.48E8 

eps^{0.4} 
43. 
CENTRAL DIFFERENCE INTERVAL 
>0 
6.69E5 

eps^{0.8/3} 
44. 
COMPLETION 
0 
1 LC, 0 NC 
1 
0=PARTIAL
1=FULL 
45. 
UNBOUNDED STEP SIZE 
>0 
1E10 
46. 
UNBOUNDED OBJECTIVE 
>0 
1E20 

Hessian approximation 
47. 
HESSIAN DIMENSION 
1 
50 
1+nnL 
48. 
SUPERBASICS LIMIT 
1 
50 
1+nnL 

TOMLAB default (to avoid termination with Superbasics Limit too small): 

If n <= 5000: max(50,n+1) 

If n > 5000: max(500,n+200−size(A,1)−length(c_{L})) 

Avoid setting REDUCED HESSIAN (number of columns in reduced Hessian). 

It will then be set to the same value as the SUPERBASICS LIMIT by MINOS. 

Frequencies II 
51. 
CHECK FREQUENCY 
>0 
60 
52. 
EXPAND FREQUENCY 
>0 
10000 
53. 
FACTORIZATION FREQUENCY 
>0 
50 

LU II 
63. 
LU PARTIAL PIVOTING 
0 
0 
3 
0=partial 

or LU COMPLETE PIVOTING 



1=complete 

or LU ROOK PIVOTING 



2=rook 

Additional parameters 
67. 
AIJ TOLERANCE 
0 
1E10 

Elements a(i,j) < AIJ TOLERANCE are set as 0 
70. 
SUBSPACE 
>0 
0.5 
1 
Subspace tolerance 

Convergence tolerance in current subspace before consider moving off 

another constraint. 

3.4.1 Direct Solver Call
A direct solver call is not recommended unless the user is 100 %
sure that no other solvers will be used for the problem. Please
refer to Section
3.4.2 for information on how to use LPOPT
with TOMLAB.
Purpose
lpopt solves dense linear optimization
problems defined as
where
c,
x R^{n},
A R^{m1 ×
n}, and
b_{L},
b_{U} R^{n+m1}.
If isempty(c) (or all(c==0), then a feasible point problem is
solved (FP). Otherwise a standard linear programming problem is
solved (LP)
Calling Syntax
[Inform, Iter, iState, Ax, cLamda, Obj, x] = lpopt(A, bl, bu, c,
Warm, x, iState, SpecsFile, PrintFile, SummFile, PriLev, optPar );
Description of Inputs
The following fields are used: 

A 
Constraint matrix, m x n (DENSE). 

bl 
Lower bounds on (x,Ax), m+n x 1 vector (DENSE). 

bu 
Upper bounds on (x,Ax), m+n x 1 vector (DENSE). 

c 
Linear objective function cost coeffs, n x 1
(DENSE). If length(c) < n, setting c(1:n)=0; 

Warm 
If Warm > 0, then warm start, otherwise cold Start. Default 0.
If warm start, then x and iState must be set properly.
Normally the values from last call to lpopt are
used. 

x 
Initial estimate of solution vector x. (DENSE) If length(x) < n,
the rest of the elements in x are set to 0. 

iState 
Working set (if Warm start) (n+m) x 1 (DENSE)
If length(iState) < n+m, setting iState(1:n+m)=0; 

iState(i)=0: 
Corresponding constraint not in the initial QP working
set. 
iState(i)=1: 
Inequality constraint at its lower bound in QP working
set. 
iState(i)=2: 
Inequality constraint at its upper bound in QP working
set. 
iState(i)=3: 
Equality constraint in the initial QP working
set,bl(i)==bu(i). 

SpecsFile 
Name of the OPTIONS File, see TOMLAB Guide. 

PrintFile 
Name of the Print file. Name includes the path, maximal number of characters = 500. 

SummFile 
Name of the Summary file. Name includes the path, maximal number of characters = 500. 

PriLev 
Print level in the lpopt MEXinterface. 

= 0 Silent. 

= 1 Summary information. 

= 2 More detailed information. 

if isempty(PriLev), set as 0. 

optPar 
Vector with optimization parameters overriding defaults and the
optionally specified SPECS file.
If length(optPar) < 62, lpopt sets the rest of the values to
missing value (999). 

Description of Outputs
The following fields are used: 


Inform 
Result of LPOPT run. 

0 = Optimal solution with unique minimizer found. 

1 = A dead point was reached. 

2 = The solution appears to be unbounded (or badly
scaled). 

3 = The constraints could not be satisfied. The problem has no feasible
solution. 

4 = Too many iterations, in either phase. 

5 = The Maximum degrees of freedom is too small. The reduced Hessian must expand if further progress
is too be made. 

6 = An input parameter was invalid. 

7 = The problem type was not recognized. 

Other = UNKNOWN LPOPT Inform value. 

Iter 
Number of iterations. 

iState 
Status of working set, se input description of
iState. 

Ax 
A*x. 

cLamda 
Lagrangian multipliers (dual solution vector) (m x 1
vector). 

Obj 
Objective function value at optimum. 

x 
Solution vector with decision variable values (n x 1
vector). 

3.4.2 Using TOMLAB
Purpose
lpoptTL solves dense linear optimization
problems defined as


f(x) = c^{T} x 


s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 


(12) 
where
c,
x,
x_{L},
x_{U} R^{n},
A R^{m1
× n}, and
b_{L},
b_{U} R^{m1}.
Calling Syntax
Using the driver routine
tomRun:
Prob = lpAssign( ... );
Result = tomRun('lpopt', Prob ... );
or
Prob = ProbCheck( ... );
Result = lpoptTL(Prob);
Call Prob = lpAssign( ... ) or Prob=ProbDef to define the Prob for
the second option.
Description of Inputs
Prob, The following fields are used: 

x_L, x_U 
Bounds on variables. 

b_L, b_U 
Bounds on linear constraints. 

A 
Linear constraint matrix. 

QP.c 
Linear coefficients in objective function. 

PriLevOpt 
Print level. 

WarmStart 
If true, use warm start, otherwise cold
start. 

SOL.xs 
Solution and slacks from previous run. 

SOL.iState 
Working set (if Warm start) (n+m) x 1 (DENSE)
If length(iState) < n+m, setting iState(1:n+m)=0; 

iState(i)=0: 
Corresponding constraint not in the initial QP working
set. 
iState(i)=1: 
Inequality constraint at its lower bound in QP working
set. 
iState(i)=2: 
Inequality constraint at its upper bound in QP working
set. 
iState(i)=3: 
Equality constraint in the initial QP working
set, bl(i)==bu(i). 

SOL.SpecsFile 
Name of user defined SPECS file, read BEFORE optPar() is
used. 

SOL.PrintFile 
Name of SOL Print file. Amount and type of printing determined by SPECS parameters or optPar parameters. 

SOL.SummFile 
Name of SOL Summary File. 

SOL.optPar 
Elements > 999 takes precedence over corresponding TOMLAB
params. 

Description of Outputs
Result, The following fields are used: 


Result 
The structure with results (see ResultDef.m). 
f_k 
Function value at optimum. 
x_k 
Solution vector. 
x_0 
Initial solution vector. 
g_k 
Gradient c (linear objective). 

xState 
State of variables. Free == 0; On lower == 1; On upper == 2; Fixed == 3; 
bState 
State of linear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 

v_k 
Lagrangian multipliers (for bounds + dual solution
vector). 

ExitFlag 
Exit status from lpopt.m (similar to
TOMLAB). 
Inform 
LPOPT information parameter. 

0 = Optimal solution with unique minimizer found. 

1 = A dead point was reached. 

2 = The solution appears to be unbounded (or badly
scaled). 

3 = The constraints could not be satisfied. The problem has no feasible
solution. 

4 = Too many iterations, in either phase. 

5 = The Maximum degrees of freedom is too small. The reduced Hessian must expand if further progress
is too be made. 

6 = An input parameter was invalid. 

7 = The problem type was not recognized. 

Other = UNKNOWN LPOPT Inform value. 


rc 
Reduced costs. If ninf=0, last m == v_k. 

Iter 
Number of iterations. 
FuncEv 
Number of function evaluations. 
ConstrEv 
Number of constraint evaluations. 

QP.B 
Basis vector in TOMLAB QP standard. 

MinorIter 
Number of minor iterations. Not Set. 

Solver 
Name of the solver (lpopt). 
SolverAlgorithm 
Description of the solver. 

SOL.xs 
Solution and slack variables. 

SOL.iState 
State for variables and constraints in iState. 

Description
Use missing value (999 or less), when no change of parameter
setting is wanted. No call is then done to internal routines
lpprmi, lpprmr and lpprm. The default value will then be used by
LPOPT, unless the value is altered in the SPECS file.
Description of Inputs
The following fields are used: 

# 
SPECS keyword text 
Lower 
Default 
Upper 
Comment 



Printing 
1. 
PRINT LEVEL 
0 
10 

0,1,5,10,20,30 

Convergence Tolerances 
10. 
OPTIMALITY TOLERANCE 
>0 
1.1E8 

sqrt(eps) 
11. 
FEASIBILITY TOLERANCE 
>0 
1.1E8 

sqrt(eps) 

Other Tolerances 
21. 
CRASH TOLERANCE 
>0 
0.01 
<1 
27. 
RANK TOLERANCE 
>0 
1.1E14 

100*eps 
30. 
ITERATION LIMIT 
>0 
max(50,5(n+m)) 
33. 
MIN SUM YES (or NO) 
0 
0 
1 
1=min
infeas. 

IF 1 (MIN SUM YES), minimize the infeasibilities before
return. 
36. 
FEASIBILITY PHASE ITERATIONS 
>0 
max(50,5(n+m)) 
45. 
INFINITE STEP SIZE 
>0 
1E20 

Frequencies 
51. 
CHECK FREQUENCY 
>0 
50 
52. 
EXPAND FREQUENCY 
>0 
5 

3.5.1 Direct Solver Call
A direct solver call is not recommended unless the user is 100 %
sure that no other solvers will be used for the problem. Please
refer to Section
3.5.2 for information on how to use QPOPT
with TOMLAB.
Purpose
qpopt solves dense quadratic optimization
problems defined as


f(x) = 

x^{T} F x + c^{T} x + d^{T} x 



s/t 


(13) 
where
c,
x R^{n},
F R^{n × n},
A R^{m1 × n}, and
b_{L},
b_{U}
R^{n+m1}.
If isempty(H) and isempty(c), then a feasible point problem is
solved (FP).
If isempty(H), then a linear programming problem is solved (LP).
If isempty(c), then a quadratic programming problem is solved
(QP1).
Otherwise a standard quadratic programming problem is solved
(QP2).
Calling Syntax
[Inform, Iter, iState, Ax, cLamda, Obj, x] = qpopt (H, A, bl, bu,
c, Warm, x, iState, SpecsFile, PrintFile, SummFile, PriLev,
optPar);
Description of Inputs
The following fields are used: 

H 
Matrix H in quadratic part of objective function (SPARSE or DENSE). 

A 
Constraint matrix, m x n. (DENSE). 

bl 
Lower bounds on (x, Ax), m+n x 1 vector (DENSE). 

bu 
Upper bounds on (x, Ax), m+n x 1 vector (DENSE). 

c 
Linear objective function cost coeffs, n x 1. (DENSE)
If length(c) < n, setting c(1:n)=0;. 

Warm 
If Warm > 0, then warm start, otherwise cold
Start. Default 0. If warm start, then x and iState must be set
properly. Normally the values from last call to qpopt are used. 

x 
Initial estimate of solution vector x. (DENSE) If length(x) < n,
the rest of the elements in x are set to 0. 

iState 
Working set (if Warm start) (n+m) x 1 (DENSE)
If length(iState) < n+m, setting iState(1:n+m)=0; 

iState(i)=0: 
Corresponding constraint not in the initial QP working
set. 
iState(i)=1: 
Inequality constraint at its lower bound in QP working
set. 
iState(i)=2: 
Inequality constraint at its upper bound in QP working
set. 
iState(i)=3: 
Equality constraint in the initial QP working
set, bl(i)==bu(i). 

SpecsFile 
Name of the OPTIONS File, see TOMLAB Guide. 

PrintFile 
Name of the Print file. Name includes the path, maximal number of characters =
500. 

SummFile 
Name of the Summary file.
Name includes the path, maximal number of characters =
500. 

PriLev 
Print level in the qpopt MEXinterface. 

= 0 Silent. 

= 1 Summary information. 

= 2 More detailed information. 

if isempty(PriLev), set as 0. 

optPar 
Vector with optimization parameters overriding defaults and the
optionally specified SPECS file.
If length(optPar) < 62, qpopt sets the rest of the values to
missing value (999). 

Description of Outputs
The following fields are used: 


Inform 
Result of QPOPT run.
0 = Optimal solution found. 


0: x is a unique local minimizer. This means that x is
feasible (it satisfies the constraints to the accuracy
requested by the Feasibility tolerance), the reduced gradient is
negligible, the Lagrange multipliers are optimal, and the reduced
Hessian is positive definite.
If H is positive definite or positive semidefinite, x
is a global minimizer. (All other feasible points
give a higher objective value.)
Otherwise, the solution is a local minimizer,
which may or may not be global.
(All other points in the immediate neighborhood give a higher
objective.) 

1: A deadpoint was reached.
This might occur if H is not sufficiently positive definite.
If H is positive semidefinite, the solution is a weak minimizer.
(The objective value is a global optimum, but there may be infinitely
many neighboring points with the same objective value.)
If H is indefinite, a feasible direction of decrease
may or may not exist (so the point may not be a local or weak
minimizer). 


At a deadpoint, the necessary conditions for optimality are
satisfied (x is feasible, the reduced gradient is negligible,
the Lagrange multipliers are optimal, and the reduced Hessian is
positive semidefinite.) However, the reduced Hessian is nearly
singular, and/or there are some very small multipliers. If H is
indefinite, x is not necessarily a local solution of the
problem. Verification of optimality requires further information,
and is in general an NPhard problem [39]. 


2: The solution appears to be unbounded.
The objective is not bounded below in the feasible region, if the
elements of x are allowed to be arbitrarily large. This occurs
if a step larger than Infinite Step would have to be taken in
order to continue the algorithm, or the next step would result in a
component of x having magnitude larger than Infinite Bound.
It should not occur if H is sufficiently positive definite. 


3: The constraints could not be satisfied. The
problem has no feasible solution. 


4: One of the iteration limits
was reached before normal termination occurred. See Feasibility
Phase Iterations and Optimality Phase Iterations. 


5: The Maximum degrees of freedom is too small.
The reduced Hessian must expand if further progress is to be made. 


6: An input parameter was invalid. 


7: The Problem type was not recognized. 

Iter 
Number of iterations. 

iState 
Status of working set, se input description of
iState. 

Ax 
A*x. 

cLamda 
Lagrangian multipliers (dual solution vector) (m x 1
vector). 

Obj 
Objective function value at optimum. 

x 
Solution vector with decision variable values (n x 1
vector). 

3.5.2 Using TOMLAB
Purpose
qpoptTL solves quadratic optimization
problems defined as


f(x) = 

x^{T} F x + c^{T} x 



s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 


(14) 
where
c,
x,
x_{L},
x_{U} R^{n},
F R^{n
× n},
A R^{m1 × n}, and
b_{L},
b_{U}
R^{m1}.
Calling Syntax
Using the driver routine
tomRun:
Prob = qpAssign( ... );
Result = tomRun('qpopt', Prob ... );
or
Prob = ProbCheck( ... );
Result = qpoptTL(Prob);
Call Prob = qpAssign( ... ) or Prob=ProbDef to define the Prob for
the second option.
Description of Inputs
Prob, The following fields are used: 

x_L, x_U 
Bounds on variables. 

b_L, b_U 
Bounds on linear constraints. 

A 
Linear constraint matrix. 

QP.c 
Linear coefficients in objective function. 

QP.F 
Quadratic matrix of size nnObj x nnObj. nnObj < n is
OK. 

PriLevOpt 
Print level. 

WarmStart 
If true, use warm start, otherwise cold
start. 

SOL.xs 
Solution and slacks from previous run. 

SOL.iState 
Working set (if Warm start) (n+m) x 1 (DENSE)
If length(iState) < n+m, setting iState(1:n+m)=0; 

iState(i)=0: 
Corresponding constraint not in the initial QP working
set. 
iState(i)=1: 
Inequality constraint at its lower bound in QP working
set. 
iState(i)=2: 
Inequality constraint at its upper bound in QP working
set. 
iState(i)=3: 
Equality constraint in the initial QP working
set, bl(i)==bu(i). 

SOL.cLamda 
Lagrangian multipliers from previous run (Warm start). 

SOL.SpecsFile 
Name of user defined SPECS file, read BEFORE optPar() is
used. 

SOL.PrintFile 
Name of SOL Print file. Amount and type of printing determined by SPECS parameters or optPar parameters. 

SOL.SummFile 
Name of SOL Summary File. 

SOL.optPar 
Elements > 999 takes precedence over corresponding TOMLAB
params. 

Description of Outputs
Result, The following fields are used: 


Result 
The structure with results (see ResultDef.m). 

f_k 
Function value at optimum. 

x_k 
Solution vector. 

x_0 
Initial solution vector. 

g_k 
Exact gradient computed at optimum. 

xState 
State of variables. Free == 0; On lower == 1; On upper == 2; Fixed == 3; 

bState 
State of linear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 

v_k 
Lagrangian multipliers (for bounds + dual solution
vector). 

ExitFlag 
Exit status from qpopt.m (similar to
TOMLAB). 

Inform 
Result of QPOPT run.
0 = Optimal solution found. 


0: x is a unique local minimizer. This means that x is
feasible (it satisfies the constraints to the accuracy
requested by the Feasibility tolerance), the reduced gradient is
negligible, the Lagrange multipliers are optimal, and the reduced
Hessian is positive definite.
If H is positive definite or positive semidefinite, x
is a global minimizer. (All other feasible points
give a higher objective value.)
Otherwise, the solution is a local minimizer,
which may or may not be global.
(All other points in the immediate neighborhood give a higher
objective.) 

1: A deadpoint was reached.
This might occur if H is not sufficiently positive definite.
If H is positive semidefinite, the solution is a weak minimizer.
(The objective value is a global optimum, but there may be infinitely
many neighboring points with the same objective value.)
If H is indefinite, a feasible direction of decrease
may or may not exist (so the point may not be a local or weak
minimizer). 


At a deadpoint, the necessary conditions for optimality are
satisfied (x is feasible, the reduced gradient is negligible,
the Lagrange multipliers are optimal, and the reduced Hessian is
positive semidefinite.) However, the reduced Hessian is nearly
singular, and/or there are some very small multipliers. If H is
indefinite, x is not necessarily a local solution of the
problem. Verification of optimality requires further information,
and is in general an NPhard problem [39]. 


2: The solution appears to be unbounded.
The objective is not bounded below in the feasible region, if the
elements of x are allowed to be arbitrarily large. This occurs
if a step larger than Infinite Step would have to be taken in
order to continue the algorithm, or the next step would result in a
component of x having magnitude larger than Infinite Bound.
It should not occur if H is sufficiently positive definite. 


3: The constraints could not be satisfied. The
problem has no feasible solution. 


4: One of the iteration limits
was reached before normal termination occurred. See Feasibility
Phase Iterations and Optimality Phase Iterations. 


5: The Maximum degrees of freedom is too small.
The reduced Hessian must expand if further progress is to be made. 


6: An input parameter was invalid. 


7: The Problem type was not recognized. 

rc 
Reduced costs. If ninf=0, last m == v_k. 

Iter 
Number of iterations. 
FuncEv 
Number of function evaluations. Set to Iter. 
GradEv 
Number of gradient evaluations. Set to Iter. 
ConstrEv 
Number of constraint evaluations. Set to 0. 

QP.B 
Basis vector in TOMLAB QP standard. 

MinorIter 
Number of minor iterations. Not Set. 

Solver 
Name of the solver (QPOPT). 
SolverAlgorithm 
Description of the solver. 

SOL.xs 
Solution and slack variables. 

SOL.cLamda 
Lagrangian multipliers. 

SOL.iState 
State for variables and constraints in iState. 

Description
Use missing value (999 or less), when no change of parameter
setting is wanted. The default value will then be used by QPOPT,
unless the value is altered in the SPECS file.
Description of Inputs
The following fields are used: 

# 
SPECS keyword text 
Lower 
Default 
Upper 
Comment 



Printing 
1. 
PRINT LEVEL 
0 
10 

0,1,5,10,20,30 

Convergence Tolerances 
10. 
OPTIMALITY TOLERANCE 
>0 
1.1E8 

sqrt(eps) 
11. 
FEASIBILITY TOLERANCE 
>0 
1.1E8 

sqrt(eps) 

Other Tolerances 
21. 
CRASH TOLERANCE 
0 
0.01 
<1 
27. 
RANK TOLERANCE 
>0 
1.1E14 

100*eps 
30. 
ITERATION LIMIT 
>0 
max(50,5(n+m)) 
33. 
MIN SUM YES (or NO) 
0 
0 
1 
1=min
infeas. 

IF 1 (MIN SUM YES), minimize the infeasibilities before
return. 

36. 
FEASIBILITY PHASE ITERATIONS 
>0 
max(50,5(n+m)) 
45. 
INFINITE STEP SIZE 
>0 
1E20 
47. 
HESSIAN ROWS 
0 
n 
n 
0 if FP or
LP 

Implicitly given by the dimensions of H in the call
from Matlab 

48. 
MAX DEGREES OF FREEDOM 
0 
n 
n 

ONLY USED IF HESSIAN ROWS == N 

Frequencies 
51. 
CHECK FREQUENCY 
>0 
50 
52. 
EXPAND FREQUENCY 
>0 
5 

3.6.1 Direct Solver Call
A direct solver call is not recommended unless the user is 100 %
sure that no other solvers will be used for the problem. Please
refer to Section
3.6.2 for information on how to use LSSOL
with TOMLAB.
Purpose
lssol solves least squares optimization
problems defined as


f(x) = 

(y − H x)^{T} (y − H x) + c^{T} x 



s/t 


(15) 
where
x R^{n},
y R^{M},
H
R^{M × n},
A R^{m1 × n},
b_{L},
b_{U} R^{n+m1}.
Dependent on the input of H, y, c and Upper, any of the following
ten problems are solved. If m == length(y) > 0, then a LS problem
is assumed Upper is > 0 ==> H is upper trapezodial.
Table 2: Problems solved by LSSOL.

H 
y 
c 
Upper 
Description 

empty 
empty 
empty 
– 
Feasible point problem 
(FP) 
empty 
empty 
n x 1 
– 
Linear programming problem 
(LP) 
n x n 
empty 
empty 
0 
Quadratic programming problem 
(QP1) 
n x n 
empty 
n x 1 
0 
Quadratic programming problem 
(QP2) 
n x n 
empty 
empty 
1 
Quadratic programming problem 
(QP3) 
n x n 
empty 
n x 1 
1 
Quadratic programming problem 
(QP4) 
m x n 
m 
empty 
0 
Least squares problem 
(LS1) 
m x n 
m 
n x 1 
0 
Least squares problem 
(LS2) 
m x n 
m 
empty 
1 
Least squares problem 
(LS3) 
m x n 
m 
n x 1 
1 
Least squares problem 
(LS4) 


Calling Syntax
[x, Inform, iState, cLamda, Iter, fObj, r, kx] = lssol(A, bl, bu,
c, x, optPar, H, y, Warm, iState, Upper, kx, SpecsFile, PrintFile,
SummFile, PriLev, ProbName );
Description of Inputs
The following fields are used: 

A 
Constraint matrix, nclin x n (DENSE). 

bl 
Lower bounds on (x,Ax), nclin+n x 1 vector (DENSE). 

bu 
Upper bounds on (x,Ax), nclin+n x 1 vector (DENSE). 

c 
Linear objective function cost coeffs, n x 1 (DENSE). If isempty(c), setting c(1:n)=0;. 

x 
Initial estimate of solution vector x. If isempty(x), x(1:n)=0. 

optPar 
Vector with optimization parameters overriding
defaults and the optionally specified SPECS file. If
length(optPar) < 62, lssol sets the rest of the values to missing value (999). 

H 
Matrix H in quadratic part of objective function
(DENSE). H is either empty (FP, LP), or quadratic n x n (QP), or m x n (LS). 

y 
Data vector of length m for LS problem, otherwise empty. 

Warm 
If Warm > 0, then warm start, otherwise cold
Start. Default 0. If warm start, then x and iState must be set
properly. Normally the values from last call to lssol are used. 

iState 
Working set (if Warm start) (nclin+m) x 1 (DENSE). If length(iState) < nclin+m, setting iState(1:n+m)=0 & Warm=0. 

iState(i)=0: 
Corresponding constraint not in the initial working set. 
iState(i)=1: 
Inequality constraint at its lower bound in working set. 
iState(i)=2: 
Inequality constraint at its upper bound in working set. 
iState(i)=3: 
Equality constraint in the initial working set, bl(i)==bu(i). 

Upper 
If > 0, then H must be an uppertrapezoidal matrix. 

kx 
Order of the n columns in A for the QP3, QP4, LS3 or LS4 problem. 

SpecsFile 
Name of the OPTIONS File, see TOMLAB Guide. 

PrintFile 
Name of the Print file. Name includes the path, maximal number of characters = 500. 

SummFile 
Name of the Summary file. Name includes the path, maximal number of characters = 500. 

PriLev 
Print level in the lssol MEXinterface.. 


= 0 Silent 

= 10 Dimensions are printed 

if isempty(PriLev), set as 0. 

Description of Outputs
The following fields are used: 


x 
Solution vector with decision variable values (n x 1 vector). 
Inform 
Result of LSSOL run. 

0 = Optimal solution with unique minimizer found. 

1 = Weak local solution (nonunique) was reached. 

2 = The solution appears to be unbounded. 

3 = The constraints could not be satisfied. The problem has no feasible solution. 

4 = Too many iterations, in either phase. 

5 = 50 changes of working set without change in x, cycling? 

6 = An input parameter was invalid. 

Other = UNKNOWN LSSOL Inform value. 

iState 
Status of working set, se input description of
iState. 

cLamda 
Lagrangian multipliers (dual solution vector) (m x 1
vector). 

Iter 
Number of iterations. 

Ax 
A*x. 

fObj 
Value of objective function if feasible, or sum of infeasibilities. 

r 
Residual for LS problem. 

3.6.2 Using TOMLAB
Purpose
lssolTL solves least squares optimization
problems defined as





s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 


(16) 
where
x,
x_{L},
x_{U} R^{n},
d R^{M},
C
R^{M × n},
A R^{m1 × n},
b_{L},
b_{U} R^{m1}.
Calling Syntax
Using the driver routine
tomRun:
Prob = ◇Assign( ... );
Result = tomRun('lssol', Prob ... );
or
Prob = ProbCheck( ... );
Result = lssolTL(Prob);
Call Prob = ◇Assign( ... ) or Prob = ProbDef; to define
the Prob for the second option.
Description of Inputs
Prob, The following fields are used: 

x_L, x_U 
Bounds on variables. 

b_L, b_U 
Bounds on linear constraints. 

A 
Linear constraint matrix. 

QP.c 
Linear coefficients in objective function. 

QP.F 
Quadratic matrix of size nnObj x nnObj. 

PriLevOpt 
Print level. 

Warm 
If true, use warm start, otherwise cold start. 

SOL.xs 
Solution (and slacks not used) from previous run (Warm start). 

SOL.iState 
Working set (if Warm start) (n+m) x 1 (DENSE)
If length(iState) < n+m, setting iState(1:n+m)=0; 

iState(i)=0: 
Corresponding constraint not in the initial QP working
set. 
iState(i)=1: 
Inequality constraint at its lower bound in QP working
set. 
iState(i)=2: 
Inequality constraint at its upper bound in QP working
set. 
iState(i)=3: 
Equality constraint in the initial QP working
set, bl(i)==bu(i). 

SOL.cLamda 
Lagrangian multipliers from previous run (Warm start). 

SpecsFile 
Name of user defined SPECS file, read BEFORE optPar() is used. 

PrintFile 
Name of SOL Print file. Amount and type of
printing determined by SPECS parameters or optPar parameters. 

SummFile 
Name of SOL Summary File. 

optPar 
Elements > 999 takes precedence over corresponding TOMLAB params. 

Description of Outputs
Result, The following fields are used: 


Result 
The structure with results (see ResultDef.m). 
f_k 
Function value at optimum. 
x_k 
Solution vector. 
x_0 
Initial solution vector. 
g_k 
Exact gradient computed at optimum. 

xState 
State of variables. Free == 0; On lower == 1; On upper == 2; Fixed == 3; 
bState 
State of linear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 

v_k 
Lagrangian multipliers (for bounds + dual solution
vector). 

ExitFlag 
Exit status from lssol.m (similar to TOMLAB). 
Inform 
LSSOL information parameter. 

0 = Optimal solution with unique minimizer found. 

1 = Weak local solution (nonunique) was reached. 

2 = The solution appears to be unbounded. 

3 = The constraints could not be satisfied. The problem has no feasible solution. 

4 = Too many iterations, in either phase. 

5 = 50 changes of working set without change in x, cycling? 

6 = An input parameter was invalid. 

Other = UNKNOWN LSSOL Inform value. 


rc 
Reduced costs. If ninf=0, last m == v_k. 

Iter 
Number of iterations. 
FuncEv 
Number of function evaluations. Set to Iter. 
GradEv 
Number of gradient evaluations. Set to Iter. 
ConstrEv 
Number of constraint evaluations. Set to 0. 

QP.B 
Basis vector in TOMLAB QP standard. 

MinorIter 
Number of minor iterations. NOT SET. 

Solver 
Name of the solver (LSSOL). 
SolverAlgorithm 
Description of the solver. 

SOL.xs 
Solution and slack variables. 

SOL.cLamda 
Lagrangian multipliers. 

SOL.iState 
State for variables and constraints in iState. 

Description
Use missing value (999 or less), when no change of parameter
setting is wanted. The default value will then be used by LSSOL,
unless the value is altered in the SPECS file.
Description of Inputs
The following fields are used: 

# 
SPECS keyword text 
Lower 
Default 
Upper 
Comment 



Printing 
1. 
PRINT LEVEL 
0 
10 

0,1,5,10,20,30 

Convergence Tolerances 
10. 
OPTIMALITY TOLERANCE 
>0 
1.1E8 

sqrt(eps) 
11. 
FEASIBILITY TOLERANCE 
>0 
1.1E8 

sqrt(eps) 

Other Tolerances 
21. 
CRASH TOLERANCE 
>0 
0.01 
<1 
27. 
RANK TOLERANCE 
>0 
1.1E14 

100*eps 
30. 
ITERATIONS LIMIT 
>0 
max(50,5(n+m)) 
36. 
FEASIBILITY PHASE ITERATIONS 
>0 
max(50,5(n+m)) 
45. 
INFINITE STEP SIZE 
>0 
1E20 
46. 
INFINITE BOUND SIZE 
>0 
1E20 

3.7 NLSSOL
3.7.1 Direct Solver Call
A direct solver call is not recommended unless the user is 100 %
sure that no other solvers will be used for the problem. Please
refer to Section
3.7.2 for information on how to use
NLSSOL with TOMLAB.
Purpose
nlssol solves constrained nonlinear least squares problems defined as





s/t 


x, 


b_{L} 
≤ 
A x 
≤ 
b_{U} 


c(x) 




(17) 
where
x R^{n},
r(
x)
R^{M},
A
R^{m1 × n},
b_{L},
b_{U} R^{n+m1+m2}
and
c(
x)
R^{m2}.
nlssol uses a sequential quadratic programming algorithm, with a
positivedefinite quasiNewton approximation to the transformed
Hessian Q'HQ of the Lagrangian function (which will be stored in
the array R).
Calling Syntax
The file 'funfdf.m' must be defined and contain: function [r, J] =
funfdf(x, Prob, mode, nstate) to compute the residual vector r and
the Jacobian matrix J at the point x.
The file 'funcdc.m' must be defined and contain: function [c, dc]
= funcdc(x, Prob, mode, nstate) to compute the nonlinear
constraint value c and the constraint Jacobian dc for the
nonlinear constraints at the point x.
[x, Inform, iState, cLamda, iwCount, fObj, gObj, r, J, fCon, gCon,
H] = nlssol( A, bl, bu, x, Prob, y, optPar, Warm, H, iState,
cLamda, SpecsFile, PrintFile, SummFile, PriLev, ProbName );
Description of Inputs
The following fields are used: 

A 
Constraint matrix, nb x n (DENSE). 

bl 
Lower bounds on (x,Ax,c(x)). 

bu 
Upper bounds on (x,Ax,c(x)). 

x 
Initial x vector (n x 1). If Warm start x must correspond to values in H and iState. 

Prob 
Must be a structure. No check is made in the MEX
interface! 


If TOMLAB calls nlssol, then Prob is the standard TOMLAB problem structure, otherwise the user should
set: 


Prob.P = ProblemNumber, where ProblemNumber is some
integer. 


Two user written routines must be written: 


funfdf, name stored in Prob.FUNCS.rJ, with syntax [mode, r, J] = funfdf(x, Prob, mode,
nstate) 


funcdc, name stored in Prob.FUNCS.cdc, with syntax [mode, c, dc] = funcdc(x, Prob, mode,
nstate) 


NLSOL is calling the TOMLAB routines nlp_rJ.m and nlp_cdc.m in the callback, and they call funfdf and funcdc,
respectively. 


If these fields in Prob are empty (Prob.FUNCS.rJ, Prob.FUNCS.cdc), the TOMLAB callback routines calls the usual function routines.
Then the Prob struct should be normally defined, and the fields
Prob.FUNCS.r, Prob.FUNCS.J, Prob.FUNCS.c, Prob.FUNCS.dc be set in
the normal way (e.g. by the routine mFiles.m, or one of the
Assignroutines like clsAssign.m). 


If the mode parameter is 0, funfdf should return r, otherwise both r and the Jacobian matrix J. If the mode parameter is 0, funcdc should return c, otherwise
both c and dc. Note that each row in dc corresponds to a constraint, and that dc should be a dense matrix. If the matrix dc is returned as a sparse Matlab matrix, nlp_cdc will do full(dc) to get a dense
matrix. 


The user could also write his own versions of the routines nlp_rJ.m and nlp_cdc.m and put them before in the
path. 

y 
Data vector of length. Number of residuals == length(y) == m. 

optPar 
Vector with optimization parameters overriding
defaults and the optionally specified SPECS file. Set empty if only using default parameters. 

Warm 
Flag for Warm start (==1) or Cold Start (==0 ),
i.e. normal mode. If 'Warm Start', iState, cLamda, H and x must supply correct values. 

H 
Hessian matrix, only accessed if Warm start. Must
select: Hessian = Yes in order to do a warm start. Hessian Yes is equivalent to optPar(50) = 1 (default is 0). 

iState 
Working set (if Warm start) (nb =
n+nclin+ncnln) x 1. If length(iState) < nb, setting iState(1:nb)=0; 

iState(i)=0: 
Corresponding constraint not in the initial working set. 
iState(i)=1: 
Inequality constraint at its lower bound in working set. 
iState(i)=2: 
Inequality constraint at its upper bound in working set. 
iState(i)=3: 
Equality constraint in the initial working set, bl(i)==bu(i). 

cLamda 
Lagrangian multipliers for the n + nclin +
ncnln constraints. If Warm start, cLamda(n+nclin+1:n+nclin+ncnln),
the nonlinear Lagrange multipliers, must correspond to values in iState. 

SpecsFile 
Name of the OPTIONS File, see TOMLAB Guide. 

PrintFile 
Name of the Print file. Name includes the path, maximal number of characters = 500. 

SummFile 
Name of the Summary file. Name includes the path, maximal number of characters = 500. 

PriLev 
Print level in the nlssol MEXinterface. 


= 0 Silent 

= 10 Dimensions are printed 

if isempty(PriLev), set as 0. 

ProbName 
Name of the problem. <=100 characters are used
in the MEX interface (Not used by MEXinterface). 

Description of Outputs
The following fields are used: 


x 
Solution vector (n by 1) with n decision variable values. 
Inform 
Result of NLSSOL run. 

0 = Optimal solution found. 

1 = Optimal solution found but not to requested accuracy. 

2 = No feasible point for the linear constraints. 

3 = No feasible point for the nonlinear constraints. 

4 = Too many major iterations. 

5 = Problem is unbounded, or badly scaled. 

6 = The current point cannot be improved on. 

7 = Large errors found in the derivatives. 

9 = An input parameter is invalid. 

Other = User requested termination 

iState 
Status of working set, se input description of iState. 

cLamda 
Lagrangian multipliers (dual solution vector) (nb x 1 vector). 

iwCount 
Number of iterations (iwCount(1)), function evaluations (iwCount(2)) and constraint evaluations (iwCount(3)). 

fObj 
Objective function value at optimum. 

gObj 
Gradient of the objective, n x 1. 

r 
Residual vector m x 1. 

J 
Jacobian matrix m x n. 

fCon 
Nonlinear constraint vector, ncnln x 1. 

gCon 
Gradient matrix of the nonlinear constraint vector, ncnln x n. 

H 
Cholesky factor of Hessian approximation. Hessian no  reordered variables. Hessian yes  natural order of variables, used for Warm start. 

3.7.2 Using TOMLAB
Purpose
nlssolTL solves constrained nonlinear least squares problems defined as





s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 
c_{L} 
≤ 
c(x) 
≤ 
c_{U} 


(18) 
where
x,
x_{L},
x_{U} R^{n},
r(
x)
R^{M},
A R^{m1 × n},
b_{L},
b_{U}
R^{m1} and
c_{L},
c(
x),
c_{U} R^{m2}.
Calling Syntax
Using the driver routine
tomRun:
Prob = clsAssign( ... );
Result = tomRun('nlssol', Prob ... );
Description of Inputs
Prob, The following fields are used: 

x_L, x_U 
Bounds on variables. 

b_L, b_U 
Bounds on linear constraints. 

c_L, c_U 
Bounds on nonlinear constraints. 

A 
Linear constraint matrix. 

PriLevOpt 
Print level. 

WarmStart 
If true, use warm start, otherwise cold
start. 

SOL.xs 
Solution from previous run, elements xs[1:n]. 

SOL.iState 
Working set (if Warm start) (n+m) x 1 (DENSE)
If length(iState) < n+m, setting iState(1:n+m)=0; 

iState(i)=0: 
Corresponding constraint not in the initial QP working
set. 
iState(i)=1: 
Inequality constraint at its lower bound in QP working
set. 
iState(i)=2: 
Inequality constraint at its upper bound in QP working
set. 
iState(i)=3: 
Equality constraint in the initial QP working
set, bl(i)==bu(i). 

SOL.cLamda 
Lagrangian multipliers (dual solution vector) (nb x 1 vector). 

SOL.H 
Cholesky factor of Hessian approximation. Hessian no  reordered variables. Hessian yes 
natural order of variables, used for Warm start. 

SOL.SpecsFile 
Name of user defined SPECS file, read BEFORE optPar() is
used. 

SOL.PrintFile 
Name of SOL Print file. Amount and type of printing determined by SPECS parameters or optPar parameters. 

SOL.SummFile 
Name of SOL Summary File. 

SOL.optPar 
Elements > 999 takes precedence over corresponding TOMLAB
params. 

Description of Outputs
Result, The following fields are used: 


Result 
The structure with results (see ResultDef.m). 
f_k 
Function value at optimum. 
x_k 
Solution vector. 
x_0 
Initial solution vector. 
g_k 
Gradient of the function. 

r_k 
Residual vector. 
J_k 
Jacobian matrix. 
c_k 
Nonlinear constraint residuals. 

cJac 
Nonlinear constraint gradients. 

xState 
State of variables. Free == 0; On lower == 1; On upper == 2; Fixed == 3; 
bState 
State of linear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 
cState 
State of nonlinear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 

v_k 
Lagrangian multipliers (for bounds + dual solution
vector). 

ExitFlag 
Exit status from nlssol.m (similar to
TOMLAB). 
Inform 
NLSSOL information parameter. 

0 = Optimal solution found. 

1 = Optimal solution found but not to requested accuracy. 

2 = No feasible point for the linear constraints. 

3 = No feasible point for the nonlinear constraints. 

4 = Too many major iterations. 

5 = Problem is unbounded, or badly scaled. 

6 = The current point cannot be improved on. 

7 = Large errors found in the derivatives. 

9 = An input parameter is invalid. 

Other = User requested termination 


rc 
Reduced costs. If ninf=0, last m == v_k. 

Iter 
Number of iterations. 
FuncEv 
Number of function evaluations. 
GradEv 
Number of gradient evaluations. 
ConstrEv 
Number of constraint evaluations. 

QP.B 
Basis vector in TOMLAB QP standard. 

MinorIter 
Number of minor iterations. 

Solver 
Name of the solver (nlssol). 
SolverAlgorithm 
Description of the solver. 

SOL.x 
Solution vector (n by 1) with n decision variable values. 

SOL.iState 
basis status of constraints + variables, (m + n x 1 vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on bu),
2=superbasic (between bounds), 3=basic (between bounds). 

SOL.cLamda 
Lagrangian multipliers (dual solution vector) (m x 1 vector). 

SOL.H 
Cholesky factor of Hessian approximation. Hessian no  reordered
variables. Hessian yes  natural order of variables, used for Warm start. 

Description
Use missing value (999 or less), when no change of parameter
setting is wanted. The default value will then be used by NLSSOL,
if not the value is altered in the SPECS file (input SpecsFile)
Description of Inputs
The following fields are used: 

# 
SPECS keyword text 
Lower 
Default 
Upper 
Comment 



Printing 
1. 
PRINT LEVEL 
0 
10 

0,1,5,10,20,30 

or MAJOR PRINT LEVEL 
2. 
MINOR PRINT LEVEL 
0 
0 

0,1,5,10,20,30 

Convergence Tolerances 
9. 
NONLINEAR FEASIBILITY TOLERANCE 
>0 
1.1E8 

sqrt(eps) 
10. 
OPTIMALITY TOLERANCE 
>0 
3.0E13 

eps^{0.8} 
11. 
LINEAR FEASIBILITY TOLERANCE 
>0 
1.1E8 

sqrt(eps) 

Derivative checking 
13. 
VERIFY LEVEL 
1 
1 
3 
1,0,1,2,3 
14. 
START OBJECTIVE CHECK AT COL 
0 
1 
n 
15. 
STOP OBJECTIVE CHECK AT COL 
0 
n 
n 
16. 
START CONSTRAINT CHECK AT COL 
0 
1 
n 
17. 
STOP CONSTRAINT CHECK AT COL 
0 
n 
n 

Other Tolerances 
21. 
CRASH TOLERANCE 
>0 
0.01 
<1 
22. 
LINESEARCH TOLERANCE 
>0 
0.9 
<1 
30. 
ITERATIONS LIMIT 
>0 
max(50,3(n+m_L)+10*m_N) 
36. 
MINOR ITERATIONS LIMIT 
>0 
max(50,3(n+m_L+m_N)) 
37. 
STEP LIMIT 
>0 
2 
39. 
DERIVATIVE LEVEL 
0 
3 
3 
0,1,2,3 
41. 
FUNCTION PRECISION 
>0 
3.0E13 

eps^{0.8}=eps_{R} 
42. 
DIFFERENCE INTERVAL 
>0 
5.48E8 

eps^{0.4} 
43. 
CENTRAL DIFFERENCE INTERVAL 
>0 
6.70E5 

eps^{0.8/3} 
45. 
INFINITE STEP SIZE 
>0 
max(BIGBND,1E10) 
46. 
INFINITE BOUND SIZE 
>0 
1E10 

= BIGBND 
47. 
JTJ INITIAL HESSIAN 
0 
1 

0 = UNIT 
48. 
RESET FREQUENCY 
0 
2 

Reset to (47) 
50. 
HESSIAN YES or NO 
0 
0 

1 = YES 

3.8.1 Direct Solver Call
A direct solver call is not recommended unless the user is 100 %
sure that no other solvers will be used for the problem. Please
refer to Section
3.8.2 for information on how to use NPSOL
with TOMLAB.
Purpose
npsol solves dense nonlinear optimization
problems defined as


f(x) 


s/t 


x, 


b_{L} 
≤ 
A x 
≤ 
b_{U} 


c(x) 




(19) 
where
x R^{n},
f(
x)
R,
A
R^{m1 × n},
b_{L},
b_{U} R^{n+m1+m2}
and
c(
x)
R^{m2}.
Calling Syntax
The file 'funfdf.m' must be defined and contain: function [mode,
f, g] = funfdf(x, Prob, mode, nstate) to compute the objective
function f and the gradient g at the point x.
The file 'funcdc.m' must be defined and contain: function [mode, c
,dcS] = funcdc(x, Prob, mode, nstate) to compute the nonlinear
constraint value c and the constraint Jacobian dcS for the
nonlinear constraints at the point x.
[x, Inform, iState, cLamda, iwCount, fObj, gObj, fCon, gCon, H] =
npsol( A, bl, bu, x, Prob, optPar, Warm, H, iState, cLamda,
SpecsFile, PrintFile, SummFile, PriLev, ProbName );
Description of Inputs
The following fields are used: 

A 
Constraint matrix, m x n. (DENSE). 

bl 
Lower bounds on (x,Ax,c(x)). 

bu 
Upper bounds on (x,Ax,c(x)). 

x 
Initial x vector (n x 1). If Warm start x must correspond to values in H and iState. 

Prob 
Must be a structure. No check is made in the MEX
interface. 


If TOMLAB calls npsol, then Prob is the standard
TOMLAB problem structure, otherwise the user should
set: 


Prob.P = ProblemNumber, where ProblemNumber is some
integer. 


Two user written routines must be written: 


funfdf, actual name stored in Prob.FUNCS.fg, with
syntax [mode, f, g] = funfdf(x, Prob, mode, nstate). 


funcdc, actual name stored in Prob.FUNCS.cdc, with
syntax [mode, c, dc] = funcdc(x, Prob, mode, nstate). 


NPSOL is calling the TOMLAB routines nlp_fg.m and
nlp_cdc.m in the callback, and they call funfdf and funcdc,
respectively. 


If these fields in Prob are empty (Prob.FUNCS.fg,
Prob.FUNCS.cdc), the TOMLAB callback routines calls the usual
function routines. Then the Prob struct should be normally defined,
and the fields Prob.FUNCS.f, Prob.FUNCS.g, Prob.FUNCS.c,
Prob.FUNCS.dc be set in the normal way (e.g. by the routine
mFiles.m, or one of the Assignroutines like conAssign.m). 


If the mode parameter is 0, funfdf should return f,
otherwise both f and the gradient vector g. If the mode parameter
is 0, funcdc should return c, otherwise both c and dc. Note that
each row in dc corresponds to a constraint, and that dc should be
a dense matrix. If the matrix dc is returned as a sparse Matlab
matrix, nlp_cdc will do full(dc) to get a dense matrix. 


The user could also write his own versions of the
routines nlp_fg.m and nlp_cdc.m and put them before in the path. 

optPar 
Vector with optimization parameters overriding
defaults and the optionally specified SPECS file. Set empty if only using default parameters. 

Warm 
Flag for Warm start (==1) or Cold Start (==0 ),
i.e. normal mode. If 'Warm Start', iState, cLamda, H and x must supply correct values. 

H 
Hessian matrix, only accessed if Warm start.
Must select: Hessian = Yes in order to do a warm start
Hessian Yes is equivalent to optPar(50) = 1 (default is 0). 

iState 
Working set (if Warm start) (nb =
n+nclin+ncnln) x 1 (DENSE). If length(iState) < nb, setting iState(1:nb)=0;; 

iState(i)=0: 
Corresponding constraint not in the initial working set. 
iState(i)=1: 
Inequality constraint at its lower bound in working set. 
iState(i)=2: 
Inequality constraint at its upper bound in working set. 
iState(i)=3: 
Equality constraint in the initial working set, bl(i)==bu(i). 

cLamda 
Lagrangian multipliers for the n + nclin + ncnln
constraints. If Warm start, cLamda(n+nclin+1:n+nclin+ncnln), the
nonlinear Lagrange multipliers, must correspond to values in iState. 

SpecsFile 
Name of the input parameter file, see TOMLAB Guide. 

PrintFile 
Name of the Print file. Name includes the path, maximal number of characters = 500. 

SummFile 
Name of the Summary file. Name includes the path, maximal number of characters = 500. 

PriLev 
Print level in the npsol MEXinterface. 

= 0 Silent 

= 10 Dimensions are printed. 

ProbName 
Name of the problem. <=100 characters are used
in the MEX interface. (Not used by MEXinterface). 

Description of Outputs
The following fields are used: 


x 
Solution vector (n by 1) with n decision variable values. 
Inform 
Result of NPSOL run. 

0 = Optimal solution found. 

1 = Optimal solution found but not to requested accuracy. 

2 = No feasible point for the linear constraints. 

3 = No feasible point for the nonlinear constraints. 

4 = Too many major iterations. 

6 = The current point cannot be improved on. 

7 = Large errors found in the derivatives. 

9 = An input parameter is invalid. 

Other = User requested termination 

iState 
Status of working set, se input description of iState. 

cLamda 
Lagrangian multipliers (dual solution vector) (m x 1 vector). 

iwCount 
Number of iterations (iwCount(1)), function evaluations (iwCount(2)) and constraint evaluations (iwCount(3)). 

fObj 
Objective function value at optimum. 

gObj 
Gradient of the nonlinear objective. 

fCon 
Nonlinear constraint vector. 

gCon 
Gradient matrix of the nonlinear constraint vector. 

H 
Cholesky factor of Hessian approximation. Hessian no  reordered variables. Hessian yes  natural order of variables, used for Warm start. 

3.8.2 Using TOMLAB
Purpose
npsolTL solves dense nonlinear optimization
problems defined as


f(x) 


s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 
c_{L} 
≤ 
c(x) 
≤ 
c_{U} 


(20) 
where
x,
x_{L},
x_{U} R^{n},
f(
x)
R,
A
R^{m1 × n},
b_{L},
b_{U} R^{m1}
and
c_{L},
c(
x),
c_{U} R^{m2}.
Calling Syntax
Using the driver routine
tomRun:
Prob = ◇Assign( ... );
Result = tomRun('npsol', Prob ... );
Description of Inputs
Prob, The following fields are used: 

x_L, x_U 
Bounds on variables. 

b_L, b_U 
Bounds on linear constraints. 

c_L, c_U 
Bounds on nonlinear constraints. 

A 
Linear constraint matrix. 

PriLevOpt 
Print level. 

WarmStart 
If true, use warm start, otherwise cold
start. 

SOL.xs 
Solution from previous run, elements xs[1:n]. 

SOL.iState 
Working set (if Warm start) (n+m) x 1 (DENSE)
If length(iState) < n+m, setting iState(1:n+m)=0; 

iState(i)=0: 
Corresponding constraint not in the initial QP working
set. 
iState(i)=1: 
Inequality constraint at its lower bound in QP working
set. 
iState(i)=2: 
Inequality constraint at its upper bound in QP working
set. 
iState(i)=3: 
Equality constraint in the initial QP working
set, bl(i)==bu(i). 

SOL.cLamda 
Lagrangian multipliers (dual solution vector) (nb x 1 vector). 

SOL.H 
Cholesky factor of Hessian approximation
Hessian no  reordered variables
Hessian yes  natural order of variables, used for Warm start. 

SOL.SpecsFile 
Name of user defined SPECS file, read BEFORE optPar() is
used. 

SOL.PrintFile 
Name of SOL Print file. Amount and type of printing determined by SPECS parameters or optPar parameters. 

SOL.SummFile 
Name of SOL Summary File. 

SOL.optPar 
Elements > 999 takes precedence over corresponding TOMLAB
params. 

Description of Outputs
Result, The following fields are used: 


Result 
The structure with results (see ResultDef.m). 
f_k 
Function value at optimum. 
x_k 
Solution vector. 
x_0 
Initial solution vector. 
g_k 
Gradient of the function. 
c_k 
Nonlinear constraint residuals. 

cJac 
Nonlinear constraint gradients. 

xState 
State of variables. Free == 0; On lower == 1; On upper == 2; Fixed == 3; 
bState 
State of linear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 
cState 
State of nonlinear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 

v_k 
Lagrangian multipliers (for bounds + dual solution
vector). 

ExitFlag 
Exit status from npsol.m (similar to
TOMLAB). 
Inform 
NPSOL information parameter. 

0 = Optimal solution found. 

1 = Optimal solution found but not to requested accuracy. 

2 = No feasible point for the linear constraints. 

3 = No feasible point for the nonlinear constraints. 

4 = Too many major iterations. 

6 = The current point cannot be improved on. 

7 = Large errors found in the derivatives. 

9 = An input parameter is invalid. 

Other = User requested termination 

rc 
Reduced costs. If ninf=0, last m == v_k. 

Iter 
Number of iterations. 
FuncEv 
Number of function evaluations. 
GradEv 
Number of gradient evaluations. 
ConstrEv 
Number of constraint evaluations. 

QP.B 
Basis vector in TOMLAB QP standard. 

MinorIter 
Number of minor iterations. 

Solver 
Name of the solver (npsol). 
SolverAlgorithm 
Description of the solver. 

SOL.x 
Solution vector (n by 1) with n decision variable values. 

SOL.iState 
basis status of constraints + variables, (m + n x 1
vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu), 2=superbasic (between bounds), 3=basic (between bounds). 

SOL.cLamda 
Lagrangian multipliers (dual solution vector) (m x 1 vector). 

SOL.H 
Cholesky factor of Hessian approximation.
Hessian no  reordered variables.
Hessian yes  natural order of variables, used for Warm start. 

Description
Use missing value (999 or less), when no change of parameter
setting is wanted. The default value will then be used by NPSOL,
if not the value is altered in the SPECS file (input SpecsFile).
Description of Inputs
The following fields are used: 

# 
SPECS keyword text 
Lower 
Default 
Upper 
Comment 



Printing 
1. 
PRINT LEVEL 
0 
10 

0,1,5,10,20,30 

or MAJOR PRINT LEVEL 
2. 
MINOR PRINT LEVEL 
0 
0 

0,1,5,10,20,30 

Convergence Tolerances 
9. 
NONLINEAR FEASIBILITY TOLERANCE 
>0 
1.1E8 

sqrt(eps) 
10. 
OPTIMALITY TOLERANCE 
>0 
3.0E13 

eps^{0.8} 
11. 
LINEAR FEASIBILITY TOLERANCE 
>0 
1.1E8 

sqrt(eps) 

Derivative checking 
13. 
VERIFY LEVEL 
1 
1 
3 
1,0,1,2,3 
14. 
START OBJECTIVE CHECK AT COL 
0 
1 
n 
15. 
STOP OBJECTIVE CHECK AT COL 
0 
n 
n 
16. 
START CONSTRAINT CHECK AT COL 
0 
1 
n 
17. 
STOP CONSTRAINT CHECK AT COL 
0 
n 
n 

Other Tolerances 
21. 
CRASH TOLERANCE 
>0 
0.01 
<1 

Note: Decision variables will be set to the closest bound to the starting point 

based on this tolerance before running the optimization. 
22. 
LINESEARCH TOLERANCE 
>0 
0.9 
<1 

30. 
ITERATIONS LIMIT 
>0 
max(50,3(n+m_L)+10*m_N) 
36. 
MINOR ITERATIONS LIMIT 
>0 
max(50,3(n+m_L+m_N)) 
37. 
STEP LIMIT 
>0 
2 
39. 
DERIVATIVE LEVEL 
0 
3 
3 
0,1,2,3 

Is set by npsolTL dependent on Prob.ConsDiff, Prob.NumDiff 
41. 
FUNCTION PRECISION 
>0 
3.0E13 

eps^{0.8}=eps_{R} 
42. 
DIFFERENCE INTERVAL 
>0 
5.48E8 

eps^{0.4} 
43. 
CENTRAL DIFFERENCE INTERVAL 
>0 
6.70E5 

eps^{0.8/3} 
45. 
INFINITE STEP SIZE 
>0 
max(BIGBND,1E10) 
46. 
INFINITE BOUND SIZE 
>0 
1E10 

= BIGBND 
50. 
HESSIAN YES or NO 
0 
0 

1 = YES 

3.9.1 Direct Solver Call
A direct solver call is not recommended unless the user is 100 %
sure that no other solvers will be used for the problem. Please
refer to Section
3.9.2 for information on how to use SNOPT
with TOMLAB.
Purpose
snopt solves sparse nonlinear optimization
problems defined as


f(x) 


s/t 


x 

, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 


c(x) 




(21) 
where
x,
R^{n},
f(
x)
R,
A
R^{m1 × n},
b_{L},
b_{U} R^{n+m1+m2}
and
c(
x)
R^{m2}.
Calling Syntax
The file 'funfdf.m' must be defined and contain: function [mode,
f, g] = funfdf(x, Prob, mode, nstate) to compute the objective
function f and the gradient g at the point x.
The file 'funcdc.m' must be defined and contain: function [mode ,c
,dcS] = funcdc(x, Prob, mode, nstate) to compute the nonlinear
constraint value c and the constraint Jacobian dcS for the
nonlinear constraints at the point x.
Note that Matlab has dynamic sparse matrix handling and Fortran
has static handling. The returned vector of constraint gradient
values must always match the pattern of nonzeros as defined in the
call to snopt. One approach for a general solution to this is
given in the Tomlab callback routine nlp_cdcS.m, which calls the
user defined 'funcdc' function.
The fields Prob.P and Prob.ConsPattern must be set, see below.
[hs, xs, pi, rc, Inform, nS, nInf, sInf, Obj, iwCount, gObj, fCon,
gCon] = snopt( A, bl, bu, nnCon, nnObj, nnJac, Prob, iObj, optPar,
Warm, hs, xs, pi, nS, SpecsFile, PrintFile, SummFile, PriLev, ObjAdd,
moremem, ProbName);
Description of Inputs
The following fields are used: 

A 
Constraint matrix, m x n SPARSE (A consists of
nonlinear part, linear part and one row for the linear objective). m > 0 always. 

bl 
Lower bounds on (x,g(x),Ax,c'). 

bu 
Upper bounds on (x,g(x),Ax,c'). 

nnCon 
Number of nonlinear constraints. 

nnObj 
Number of nonlinear objective variables. 

nnJac 
Number of nonlinear Jacobian variables. 

Prob 
Must be a structure. No check is made in the MEX
interface! 


If TOMLAB calls snopt, then Prob is the standard
TOMLAB problem structure, otherwise the user should
set: 


Prob.P = ProblemNumber, where ProblemNumber is some
integer. 


Prob.ConsPattern = []; or as the nonzero pattern for the constraint Jacobian as
Prob.ConsPattern = ConsPattern; 


ConsPattern is a nnCon x n zeroone sparse or dense matrix,
where 0 values indicate zeros in the constraint Jacobian and
ones indicate values that might be nonzero. 


If the problem is a LP or QP problem (H defined), then the user
does not have to specify anything more in the
structure. 


For a general nonlinear objective, or nonlinear constraints
names of two user written routines must be given: 


funfdf, actual name stored in Prob.FUNCS.fg, with syntax
[mode, f, g] = funfdf(x, Prob, mode, nstate) 


funcdc, actual name stored in Prob.FUNCS.cdc, with syntax
[mode, c, dcS] = funcdc(x, Prob, mode, nstate) 


SNOPT is calling the TOMLAB routines nlp_fg.m and nlp_cdcS.m
in the callback, and they call funfdf and funcdc,
respectively. 


If these fields in Prob are empty (Prob.FUNCS.fg, Prob.FUNCS.cdc),
the TOMLAB callback routines calls the usual function routines.
Then the Prob struct should be normally defined, and
the fields Prob.FUNCS.f, Prob.FUNCS.g, Prob.FUNCS.c, Prob.FUNCS.dc
be set in the normal way (e.g. by the routine
mFiles.m). 


If the mode parameter is 0, funfdf should return f, otherwise
both f and the gradient vector g.
If the mode parameter is 0, funcdc should return c, otherwise
both c and dcS. Note that each row in dcS corresponds to a
constraint, and that dcS must be a SPARSE matrix. 


The user could also write his own versions of the routines
nlp_fg.m and nlp_cdcS.m and put them before in the
path. 

iObj 
Says which row of A is a free row containing a
linear objective vector c. If there is no such vector, iObj = 0.
Otherwise, this row must come after any nonlinear rows, so that nnCon <= iObj <= m. 

optPar 
Vector with optimization parameters overriding
defaults and the optionally specified SPECS file. If using only default options, set optPar as an empty matrix. 

Warm 
Flag, if true: warm start. Default cold start (if
empty). If 'Warm Start' xS, nS and hs must be supplied with correct values. 

hs 
Basis status of variables + constraints (n+m x 1
vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu) 2=superbasic (between bounds), 3=basic (between bounds). 

xs 
Initial vector, optionally including m slacks at
the end. If warm start, full xs must be supplied. 

pi 
Lagrangian multipliers for the nnCon nonlinear
constraints. If empty, set as 0. 

nS 
# of superbasics. Only used if calling again with a Warm Start. 

SpecsFile 
Name of the SPECS input parameter file, see
SNOPT User's Guide. 

PrintFile 
Name of the Print file. Name includes the path,
maximal number of characters = 500. 

SummFile 
Name of the Summary file. Name includes the path,
maximal number of characters = 500. 

PriLev 
Printing level in the snopt mfile and snopt MEXinterface. 


= 0 Silent 

= 1 Summary information 

= 2 More detailed information 

ObjAdd 
Constant added to the objective for printing purposes, typically 0. 

moremem 
Add extra memory for the sparse LU, might speed
up the optimization. If empty, set as 0. 

ProbName 
Name of the problem. <=100 characters are used
in the MEX interface. In the SNOPT solver the first 8 characters
are used in the printed solution and in some routines that output BASIS files. Blank is OK. 

Description of Outputs
The following fields are used: 


hs 
Basis status of variables + constraints (n+m x 1
vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu), 2=superbasic (between bounds), 3=basic (between bounds). 


Basic and superbasic variables may be outside their bounds by
as much as the Minor feasibility tolerance.
Note that if scaling is specified, the feasibility tolerance
applies to the variables of the scaled problem.
In this case, the variables of the
original problem may be as much as 0.1 outside their bounds,
but this is unlikely unless the problem is very badly scaled. 


Very occasionally some nonbasic variables may be outside their
bounds by as much as the Minor feasibility tolerance,
and there may be some nonbasics for which xs(j) lies
strictly between its bounds. 


If nInf > 0, some basic and superbasic variables may be outside
their bounds by an arbitrary amount (bounded by sInf if scaling was
not used). 

xs 
Solution vector (n+m by 1) with n decision variable values
together with the m slack variables. 

pi 
The vector of dual variables π (a set of Lagrange
multipliers for the general constraints). (m x 1 vector). 

rc 
Vector of reduced costs, g − ( A −I )^{T}π, where
g is the gradient of the objective if xs is feasible (or
the gradient of the Phase1 objective otherwise).
The last m entries are π.
The vector is n+m. If nInf=0, last m == pi. 

Inform 
Result of SNOPT run. 


Finished successfully 

1 optimality conditions satisfied 

2 feasible point found 

3 requested accuracy could not be
achieved 


The problem appears to be infeasible 

11 infeasible linear constraints 

12 infeasible linear equalities 

13 nonlinear infeasibilities minimized 

14 infeasibilities minimized 


The problem appears to be unbounded 

21 unbounded objective 

22 constraint violation limit reached 


Resource limit error 

31 iteration limit reached 

32 major iteration limit reached 

33 the superbasics limit is too small 


Terminated after numerical difficulties 

41 current point cannot be improved 

42 singular basis 

43 cannot satisfy the general constraints 

44 illconditioned nullspace basis 


Error in the usersupplied functions 

51 incorrect objective derivatives 

52 incorrect constraint derivatives 


Undefined usersupplied functions 

61 undefined function at the first feasible point 

62 undefined function at the initial point 

63 unable to proceed into undefined
region 


User requested termination 

72 terminated during constraint evaluation 

73 terminated during objective evaluation 

74 terminated from monitor routine 


Insufficient storage allocated 

81 work arrays must have at least 500 elements 

82 not enough character storage 

83 not enough integer storage 

84 not enough real storage 


Input arguments out of range 

91 invalid input argument 

92 basis file dimensions do not match this
problem 


System error 

141 wrong number of basic variables 

142 error in basis package 

nS 
The final number of superbasic variables. 

nInf 
Gives the number and the sum (next parameter) of the infeasibilities
of constraints that lie outside their bounds by more than the
Feasibility tolerance. 


If the linear constraints are infeasible, xs
minimizes the sum of the infeasibilities of the linear
constraints subject to the upper and lower bounds being
satisfied. In this case nInf gives the number of
components of A_{ L} x lying outside their upper or lower
bounds. The nonlinear constraints are not evaluated. 


Otherwise, xs minimizes the sum of the infeasibilities of
the nonlinear constraints subject to the linear
constraints and upper and lower bounds being satisfied. In
this case nInf gives the number of components of f(x)
lying outside their upper or lower bounds. 

sInf 
Sum of infeasibilities. See nInf above. 

Obj 
Objective function value at optimum. 

iwCount 
Number of iterations minor (iwCount(1)) and major (iwCount(2)),
function (iwCount(3:6)) and constraint (iwCount(7:10)) calls. 

gObj 
Gradient of the nonlinear objective. 

fCon 
Nonlinear constraint vector. 

gCon 
Gradient vector (nonzeros) of the nonlinear constraint
vector. 

3.9.2 Using TOMLAB
Purpose
snoptTL solves nonlinear optimization
problems defined as


f(x) 


s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 
c_{L} 
≤ 
c(x) 
≤ 
c_{U} 


(22) 
where
x,
x_{L},
x_{U} R^{n},
f(
x)
R,
A
R^{m1 × n},
b_{L},
b_{U} R^{m1}
and
c_{L},
c(
x),
c_{U} R^{m2}.
Calling Syntax
Using the driver routine
tomRun:
Prob = ◇Assign( ... );
Result = tomRun('snopt', Prob ... );
Description of Inputs
Prob, The following fields are used: 

x_L, x_U 
Bounds on variables. 

b_L, b_U 
Bounds on linear constraints. 

c_L, c_U 
Bounds on nonlinear constraints. 

A 
Linear constraint matrix. 

QP.c 
Linear coefficients in objective function. 

PriLevOpt 
Print level. 

WarmStart 
If true, use warm start, otherwise cold
start. 

SOL.xs 
Solution and slacks from previous run. 

SOL.hs 
State for solution and slacks from previous
run. 

SOL.nS 
Number of superbasics from previous run. 

SOL.hElastic 
Defines which variables are elastic in elastic mode.
hElastic(j): 

0 = variable j is nonelastic and cannot be
infeasible. 

1 = variable j can violate its lower bound. 

2 = variable j can violate its upper bound. 

3 = variable j can violate either its lower or upper
bound. 

SOL.moremem 
Add more memory if SNOPT stops with not enough storage message. 

SOL.SpecsFile 
Name of user defined SPECS file, read BEFORE optPar() is used. 

SOL.PrintFile 
Name of SOL Print file. Amount and type of printing determined
by SPECS parameters or optPar parameters. 

SOL.SummFile 
Name of SOL Summary File. 

SOL.optPar 
Elements > 999 takes precedence over corresponding TOMLAB
params. 

Description of Outputs
Result, The following fields are used: 


Result 
The structure with results (see ResultDef.m). 
f_k 
Function value at optimum. 
x_k 
Solution vector. 
x_0 
Initial solution vector. 
g_k 
Gradient of the function. 
c_k 
Nonlinear constraint residuals. 

cJac 
Nonlinear constraint gradients. 

xState 
State of variables. Free == 0; On lower == 1; On upper == 2; Fixed == 3; 
bState 
State of linear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 
cState 
State of nonlinear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 

v_k 
Lagrangian multipliers (for bounds + dual solution
vector). 

ExitFlag 
Exit status from snoptTL.m (similar to
TOMLAB). 
Inform 
Result of SNOPT run. 


Finished successfully 

1 optimality conditions satisfied 

2 feasible point found 

3 requested accuracy could not be
achieved 


The problem appears to be infeasible 

11 infeasible linear constraints 

12 infeasible linear equalities 

13 nonlinear infeasibilities minimized 

14 infeasibilities minimized 


The problem appears to be unbounded 

21 unbounded objective 

22 constraint violation limit reached 


Resource limit error 

31 iteration limit reached 

32 major iteration limit reached 

33 the superbasics limit is too small 


Terminated after numerical difficulties 

41 current point cannot be improved 

42 singular basis 

43 cannot satisfy the general constraints 

44 illconditioned nullspace basis 


Error in the usersupplied functions 

51 incorrect objective derivatives 

52 incorrect constraint derivatives 


Undefined usersupplied functions 

61 undefined function at the first feasible point 

62 undefined function at the initial point 

63 unable to proceed into undefined
region 


User requested termination 

72 terminated during constraint evaluation 

73 terminated during objective evaluation 

74 terminated from monitor routine 


Insufficient storage allocated 

81 work arrays must have at least 500 elements 

82 not enough character storage 

83 not enough integer storage 

84 not enough real storage 


Input arguments out of range 

91 invalid input argument 

92 basis file dimensions do not match this
problem 


System error 

141 wrong number of basic variables 

142 error in basis package 

rc 
Vector of reduced costs, g − ( A −I )^{T}π, where
g is the gradient of the objective if xs is feasible (or
the gradient of the Phase1 objective otherwise).
The last m entries are π.
The vector is n+m. If nInf=0, last m == pi. 

Iter 
Number of iterations. 
FuncEv 
Number of function evaluations. 
GradEv 
Number of gradient evaluations. 
ConstrEv 
Number of constraint evaluations. 

QP.B 
Basis vector in TOMLAB QP standard. 

MinorIter 
Number of minor iterations. 

Solver 
Name of the solver (snopt). 
SolverAlgorithm 
Description of the solver. 

SOL.xs 
Solution vector (n+m by 1) with n decision variable values
together with the m slack variables. 

SOL.hs 
Basis status of variables + constraints (n+m x 1
vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu), 2=superbasic (between bounds), 3=basic (between bounds). 


Basic and superbasic variables may be outside their bounds by
as much as the Minor feasibility tolerance.
Note that if scaling is specified, the feasibility tolerance
applies to the variables of the scaled problem.
In this case, the variables of the
original problem may be as much as 0.1 outside their bounds,
but this is unlikely unless the problem is very badly scaled. 


Very occasionally some nonbasic variables may be outside their
bounds by as much as the Minor feasibility tolerance,
and there may be some nonbasics for which xs(j) lies
strictly between its bounds. 


If nInf > 0, some basic and superbasic variables may be outside
their bounds by an arbitrary amount (bounded by sInf if scaling was
not used). 

SOL.nS 
The final number of superbasic variables. 

SOL.nInf 
Gives the number and the sum (next parameter) of the infeasibilities
of constraints that lie outside their bounds by more than the
Feasibility tolerance. 


If the linear constraints are infeasible, xs
minimizes the sum of the infeasibilities of the linear
constraints subject to the upper and lower bounds being
satisfied. In this case nInf gives the number of
components of A_{ L} x lying outside their upper or lower
bounds. The nonlinear constraints are not evaluated. 


Otherwise, xs minimizes the sum of the infeasibilities of
the nonlinear constraints subject to the linear
constraints and upper and lower bounds being satisfied. In
this case nInf gives the number of components of f(x)
lying outside their upper or lower bounds. 

SOL.sInf 
Sum of infeasibilities. See nInf above. 

Description
Use missing value (999 or less), when no change of parameter
setting is wanted. The default value will then be used by SNOPT, if
not the value is altered in the SPECS file (input SpecsFile).
Definition: nnL = max(nnObj,nnJac))  Used in #38 and #47.
Description of Inputs
The following fields are used: 

# 
SPECS keyword text 
Lower 
Default 
Upper 
Comment 



The SQP method I  Printing 
1. 
MAJOR PRINT LEVEL 
0 
1 
11111 

QP subproblems I  Printing 
2. 
MINOR PRINT LEVEL 
0 
1 
10 
0, 1 or 10 

Frequencies I 
5. 
PRINT FREQUENCY 
0 
100 
6. 
SUMMARY FREQUENCY 
0 
100 
7. 
SOLUTION YES/NO 
0 
1 
1 
1 = YES; 0 =
NO 
8. 
SUPPRESS OPTIONS LISTING 
0 
0 
1 
1 =
True 

Also called SUPPRESS PARAMETERS 

The SQP Method II  Convergence Tolerances 
9. 
MAJOR FEASIBILITY TOLERANCE 
>0 
1E6 

Nonlinear constraints I 
10. 
MAJOR OPTIMALITY TOLERANCE 
>0 
max(2E−6,(10eps_{R})^{0.5}) =
1.73E6 

eps_R == optPar(41), Default relative function precision eps_R gives (10*eps_{R})^{0}.5=1.73E−6. 

QP subproblems II  Convergence Tolerances 
11. 
MINOR FEASIBILITY TOLERANCE 
>0 
1E6 

Feasibility tolerance on linear constraints . 
12. 
MINOR OPTIMALITY TOLERANCE 
>0 
1E6 

Derivative checking 
13. 
VERIFY LEVEL 
1 
1 
3 
1,0,1,2,3 
14. 
START OBJECTIVE CHECK AT COL 
0 
1 
nnObj 
15. 
STOP OBJECTIVE CHECK AT COL 
0 
nnObj 
nnObj 
16. 
START CONSTRAINT CHECK AT COL 
0 
1 
nnJac 
17. 
STOP CONSTRAINT CHECK AT COL 
0 
nnJac 
nnJac 

QP subproblems III 
18. 
SCALE OPTION 
0 
0 or 2 
2 
2 if LP,0 if
NLP 
19. 
SCALE TOLERANCE 
>0 
0.9 
<1 
20. 
SCALE PRINT 
0 
0 
1 
1 =
True 
21. 
CRASH TOLERANCE 
0 
0.1 
<1 

The SQP Method III 
22. 
LINESEARCH TOLERANCE 
>0 
0.9 
<1 

LU I 
23. 
LU FACTORIZATION TOLERANCE 
1 
100/3.99 

100 if LP 
24. 
LU UPDATE TOLERANCE 
1 
10/3.99 

10 if LP 
25. 
LU SWAP TOLERANCE 
>0 
1.22E4 

eps^{(}1/4) 
26. 
LU SINGULARITY TOLERANCE 
>0 
3.25E11 

eps^{0.67} 

QP subproblems IV 
27. 
PIVOT TOLERANCE 
>0 
3.25E11 

eps^{(}0.67) 
28. 
CRASH OPTION 
0 
3 
3 
0,1,2,3 
29. 
ELASTIC WEIGHT 
0 
10000.0 
30. 
ITERATIONS LIMIT 
0 
10000 

or 20m, if more 

Maximal sum of minor iterations 
31. 
PARTIAL PRICE 
0 
10 or 1 

10 for LP 

The SQP Method IV 
32. 
MAXIMIZE 
0 
0 
1 
1=maximize 
33. 
FEASIBLE POINT 
0 
0 
1 
1=feasible pnt 

Nonlinear constraints I 
34. 
VIOLATION LIMIT 
>0 
1e6 

The SQP Method V 
35. 
MAJOR ITERATIONS LIMIT 
>0 
max(1000,3*max(n,m)) 

Maximal number of major iterations 
36. 
MINOR ITERATIONS LIMIT 
>0 
500 

Maximal number of minor iterations, i.e. in the solution of QP or simplex 
37. 
MAJOR STEP LIMIT 
>0 
2 

Hessian Approximation I 
38. 
HESSIAN FREQUENCY 
>0 
99999999 

The SQP Method VI 
39. 
DERIVATIVE LEVEL 
0 
3 
3 
0,1,2,3 
40. 
DERIVATIVE LINESEARCH 
0 
1 
1 
0=NONDERIVATIVE 

0 is quadratic  gives quadratic, without gradient values 

1 is cubic  gives cubic, always using gradient values 

Default: 0 if numerical derivatives, otherwise 1 
41. 
FUNCTION PRECISION 
>0 
3.0E13 

eps^{0.8}=eps_{R} 
42. 
DIFFERENCE INTERVAL 
>0 
5.48E7 

eps^{0.4} 
43. 
CENTRAL DIFFERENCE INTERVAL 
>0 
6.70E5 

eps^{0.8/3} 
44. 
PROXIMAL POINT METHOD 
1 
1 
2 
1,2 

Minimize the 1norm (or 2norm) of (x−x_{0}) to find an initial point 

that is feasible subject to simple bounds and linear constraints. 
45. 
UNBOUNDED STEP SIZE 
>0 
1E20 
46. 
UNBOUNDED OBJECTIVE 
>0 
1E15 

Hessian Approximation II 
47. 
HESSIAN FULL MEMORY 
0 
1 
1 
=1 if nnL <= 75 

or HESSIAN LIMITED MEMORY 
=0 if nnL > 75 

The SQP Method VII 
48. 
SUPERBASICS LIMIT 
>0 
max(500,n+1) 

TOMLAB extension (to avoid termination with Superbasics Limit too small): 

Set =n+1 if n−size(A,1)−length(c_{L}) > 450 and n <= 5000 

If n > 5000: max(500,n−size(A,1)−length(c_{L})) 

Avoid setting REDUCED HESSIAN (number of columns in reduced Hessian). 

It will then be set to the same value as the SUPERBASICS LIMIT by SNOPT. 

Hessian Approximation III 
49. 
HESSIAN UPDATES 
>0 
20 

Maximum number of QN (QuasiNewton) updates. 

If HESSIAN FULL MEMORY, default is 99999999, otherwise 20. 
50. 
HESSIAN FLUSH 
>0 
99999999 

Frequencies II 
51. 
CHECK FREQUENCY 
>0 
60 
52. 
EXPAND FREQUENCY 
>0 
10000 
53. 
FACTORIZATION FREQUENCY 
>0 
50 

LU II 
63. 
LU PARTIAL PIVOTING 
0 
0 
3 
0=partial 

or LU COMPLETE PIVOTING 



1=complete 

or LU ROOK PIVOTING 



2=rook 

or LU DIAGONAL PIVOTING 



3=diagonal 

The SQP Method VIII 
64. 
PENALTY PARAMETER 
>=0 
0.0 

Initial penalty parameter. 

QP subproblems V 
65. 
NEW SUPERBASICS 
>0 
99 

Also MINOR SUPERBASICS. Maximal number of new superbasics per major iteration. 
66. 
QPSOLVER CHOLESKY 
0 
0 
2 
0=Cholesky 

or QPSOLVER CG 



1=CG 

or QPSOLVER QN 



2=QuasiNewton CG 

ConjugateGradient QP solver 
67. 
CG TOLERANCE 
>0 
1e−2 
68. 
CG ITERATIONS 
>0 
100 

Max number of CG iters 
69. 
QPSOLVER CHOLESKY 
0 
0 
1 
QN preconditioned CG 

also called QG PRECONDITIONING. Default 1 if QPSOLVER QN. 
70. 
SUBSPACE 
0 
0.1 
1 
Subspace tolerance 

QuasiNewton QP rg tolerance. 

The SQP Method IX 
71. 
HESSIAN DIMENSION 
>0 
min(2000,nnL+1) 

=1 if LP problem (n upper limit) 

also called REDUCED HESSIAN. Number of columns in Reduced Hessian. 

3.10.1 Direct Solver Call
A direct solver call is not recommended unless the user is 100 %
sure that no other solvers will be used for the problem. Please
refer to Section
3.10.2 for information on how to use SQOPT
with TOMLAB.
Purpose
sqopt solves dense quadratic optimization
problems defined as


f(x) = 

x^{T} F x + c^{T} x + d^{T} x 



s/t 


(23) 
where
c,
x R^{n},
F R^{n × n},
A R^{m1 × n}, and
b_{L},
b_{U}
R^{n+m1}.
Calling Syntax
The full input matrix A has two parts A = [A; d']; The position of
the row d' is iObj. iObj=0 means no linear part in A.
NOTE: There are two ways to give the linear objective: either
explicit as vector c or as part of the sparse matrix A, as d (or
both ways).
[xs, hs, pi, rc, Inform, nS, nInf, sInf, Obj, iwCount] = sqopt( A,
bl, bu, H, c, hElast, iObj, optPar, Warm, hs, xs, nS, SpecsFile,
PrintFile, SummFile, ObjAdd, moremem, ProbName, Prob );
Description of Inputs
The following fields are used: 

A 
Constraint matrix, m x n (SPARSE). 

bl 
Lower bounds on (x,Ax,d'). 

bu 
Upper bounds on (x,Ax,d'). 

H 
Quadratic matrix, n x n, SPARSE or DENSE, empty if LP
problem. If H is a string, H should be the name of a function
routine, e.g if H = 'HxComp' then the function routine: 


function Hx = HxComp(x, nState, Prob) 


should compute H * x. The user must define this routine.
nState == 1 if calling for the first time, otherwise 0.
Third argument, the Prob structure, should only be used if
calling SQOPT with the additional input parameter Prob, see
below. 


Tomlab implements this callback to the predefined Matlab function
HxFunc.m, using the call if Prob.SOL.callback == 1. 

c 
Linear objective. 

hElast 
Defines which bounds are elastic in elastic mode. hElast(j): 


0 = variable j cannot be infeasible. 

1 = variable j can violate its lower bound. 

2 = variable j can violate its upper bound. 

3 = variable j can violate either its lower or upper bound. 

iObj 
Says which row of A is a free row containing a
linear objective vector d. If there is no such vector, iObj = 0. 

optPar 
Vector with optimization parameters overriding
defaults and the optionally specified SPECS file. Set empty if only using default parameters. 

Warm 
Flag, if true: warm start. Default cold start (if empty). If 'Warm Start' xS, nS and hs must be supplied with correct values. 

hs 
Basis status of variables + constraints (n+m x 1
vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu), 2=superbasic (between bounds), 3=basic (between bounds). 

xs 
Initial x vector (nx1), optionally including m slacks
at the end. If Warm start, full n+m vector xs must be supplied. 

nS 
# of superbasics. Used if a Warm Start, otherwise set to 0. 

SpecsFile 
Name of the SPECS input parameter file. 

PrintFile 
Name of the Print file. Name includes the path, maximal number of characters = 500. 

SummFile 
Name of the Summary file. Name includes the path,
maximal number of characters = 500. 

ObjAdd 
Constant added to the objective for printing purposes, typically 0. 

moremem 
Add extra memory for the sparse LU, might speed up
the optimization. If empty, set to 0. 

ProbName 
Name of the problem. <=100 characters are used in
the MEX interface. In the SQOPT solver the first 8 characters are
used in the printed solution and in some routines that output BASIS files. Blank is OK. 

Prob 
Sending the Prob structure is optional, only of use
if sending H as a function string, see input H. 

Description of Outputs
The following fields are used: 


xs 
Solution vector (n+m by 1) with n decision
variable values together with the m slack variables. 

hs 
Basis status of variables + constraints (n+m x 1
vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu), 2=superbasic (between bounds), 3=basic (between bounds). 


Basic and superbasic variables may be outside their bounds by
as much as the value of the optional parameter Feasibility
tolerance. Note that if scaling is specified, the
Feasibility tolerance applies to the variables of the
scaled problem. In this case, the variables of the
original problem may be as much as 0.1 outside their bounds,
but this is unlikely unless the problem is very badly scaled.
Check the “Primal infeasibility" printed after the EXIT
message. 


Very occasionally some nonbasic variables may be outside their
bounds by as much as the Feasibility tolerance, and there
may be some nonbasics for which xs(j) lies strictly
between its bounds. 


If nInf > 0, some basic and superbasic variables may be
outside their bounds by an arbitrary amount (bounded by sInf
if scaling was not used). 

pi 
Lagrangian multipliers (dual solution vector) (m x 1 vector). 

rc 
A vector of reduced costs, g − ( A −I )^{T}π,
where g is the gradient of the objective if xs is feasible (or
the gradient of the Phase1 objective otherwise).
The last m entries are π. 

Inform 
Result of SQOPT run. 


0 finished successfully 

1 optimality conditions satisfied 

2 feasible point found 

4 weak QP minimizer 


10 the problem appears to be infeasible 

11 infeasible linear constraints 

12 infeasible linear equalities 

14 infeasibilities minimized 


20 the problem appears to be unbounded 

21 unbounded objective 


30 resource limit error 

31 iteration limit reached 

33 the superbasics limit is too small 


40 terminated after numerical difficulties 

42 singular basis 

43 cannot satisfy the general constraints 

44 illconditioned nullspace basis 


50 error in the usersupplied functions 

53 the QP Hessian is indefinite 


70 user requested termination 

73 terminated during QP objective evaluation 

74 terminated from monitor routine 


80 insufficient storage allocated 

81 work arrays must have at least 500 elements 

82 not enough character storage 

83 not enough integer storage 

84 not enough real storage 


90 input arguments out of range 

91 invalid input argument 

92 basis file dimensions do not match this problem 

93 the QP Hessian is indefinite 


140 system error 

141 wrong number of basic variables 

142 error in basis package 

nS 
# of superbasics. 

nInf 
Number of infeasibilities. 

sInf 
Sum of infeasibilities. 

Obj 
Objective function value at optimum. 

iwCount 
Number of QP iterations in iwCount(1), number of Hx products. 

3.10.2 Using TOMLAB
Purpose
sqoptTL solves nonlinear optimization
problems defined as


f(x) = 

x^{T} F x + c^{T} x 



s/t 
x_{L} 
≤ 
x 
≤ 
x_{U}, 
b_{L} 
≤ 
A x 
≤ 
b_{U} 


(24) 
where
c,
x,
x_{L},
x_{U} R^{n},
F R^{n
× n},
A R^{m1 × n}, and
b_{L},
b_{U}
R^{m1}.
Calling Syntax
Using the driver routine
tomRun:
Prob = ◇Assign( ... );
Result = tomRun('sqopt', Prob ... );
or
Prob = ProbCheck( ... );
Result = sqoptTL(Prob);
Call Prob = ◇Assign( ... ) or Prob=ProbDef; to define the
Prob for the second option.
Description of Inputs
Prob, The following fields are used: 

x_L, x_U 
Bounds on variables. 

b_L, b_U 
Bounds on linear constraints. 

A 
Linear constraint matrix. 

QP.c 
Linear coefficients in objective function. 

QP.F 
Quadratic matrix of size nnObj x nnObj. nnObj < n is OK. 

PriLevOpt 
Print level. 

WarmStart 
If true, use warm start, otherwise cold
start. 

SOL.callback 
If 1, use a callback to Matlab to compute QP.F * x for different x.
Faster when F is very large and almost dense, avoiding
copying of F from Matlab to MEX. 

SOL.xs 
Solution and slacks from previous run. 

SOL.hs 
State for solution and slacks from previous
run. 

SOL.nS 
Number of superbasics from previous run. 

SOL.hElastic 
Defines which variables are elastic in elastic mode.
hElastic(j): 

0 = variable j is nonelastic and cannot be
infeasible. 

1 = variable j can violate its lower bound. 

2 = variable j can violate its upper bound. 

3 = variable j can violate either its lower or upper
bound. 

SOL.moremem 
Add more memory if SQOPT stops with not enough storage message. 

SOL.SpecsFile 
Name of user defined SPECS file, read BEFORE optPar() is used. 

SOL.PrintFile 
Name of SOL Print file. Amount and type of printing determined
by SPECS parameters or optPar parameters. 

SOL.SummFile 
Name of SOL Summary File. 

SOL.optPar 
Elements > 999 takes precedence over corresponding TOMLAB
params. 

Description of Outputs
Result, The following fields are used: 


Result 
The structure with results (see ResultDef.m). 
f_k 
Function value at optimum. 
x_k 
Solution vector. 
x_0 
Initial solution vector. 
g_k 
Gradient of the function. 

xState 
State of variables. Free == 0; On lower == 1; On upper == 2; Fixed == 3; 
bState 
State of linear constraints. Free == 0; Lower == 1; Upper == 2; Equality == 3; 

v_k 
Lagrangian multipliers (for bounds + dual solution
vector). 

ExitFlag 
Exit status from sqopt.m (similar to
TOMLAB). 

Inform 
Result of SQOPT run. 


0 finished successfully 

1 optimality conditions satisfied 

2 feasible point found 

4 weak QP minimizer 


10 the problem appears to be infeasible 

11 infeasible linear constraints 

12 infeasible linear equalities 

14 infeasibilities minimized 


20 the problem appears to be unbounded 

21 unbounded objective 


30 resource limit error 

31 iteration limit reached 

33 the superbasics limit is too small 


40 terminated after numerical difficulties 

42 singular basis 

43 cannot satisfy the general constraints 

44 illconditioned nullspace basis 


50 error in the usersupplied functions 

53 the QP Hessian is indefinite 


70 user requested termination 

73 terminated during QP objective evaluation 

74 terminated from monitor routine 


80 insufficient storage allocated 

81 work arrays must have at least 500 elements 

82 not enough character storage 

83 not enough integer storage 

84 not enough real storage 


90 input arguments out of range 

91 invalid input argument 

92 basis file dimensions do not match this problem 

93 the QP Hessian is indefinite 


140 system error 

141 wrong number of basic variables 

142 error in basis package 

rc 
A vector of reduced costs, g − ( A −I )^{T}π,
where g is the gradient of the objective if xs is feasible (or
the gradient of the Phase1 objective otherwise).
The last m entries are π. 

Iter 
Number of iterations. 
FuncEv 
Number of function evaluations. Set to Iter. 
GradEv 
Number of gradient evaluations. Set to Iter. 
ConstrEv 
Number of constraint evaluations. Set to 0. 

QP.B 
Basis vector in TOMLAB QP standard. 

Solver 
Name of the solver (sqopt). 
SolverAlgorithm 
Description of the solver. 

SOL.hs 
Basis status of variables + constraints (n+m x
1 vector). State of variables: 0=nonbasic (on bl), 1=nonbasic (on
bu), 2=superbasic (between bounds), 3=basic (between bounds). 


Basic and superbasic variables may be outside their bounds by
as much as the value of the optional parameter Feasibility
tolerance. Note that if scaling is specified, the
Feasibility tolerance applies to the variables of the
scaled problem. In this case, the variables of the
original problem may be as much as 0.1 outside their bounds,
but this is unlikely unless the problem is very badly scaled.
Check the “Primal infeasibility" printed after the EXIT
message. 


Very occasionally some nonbasic variables may be outside their
bounds by as much as the Feasibility tolerance, and there
may be some nonbasics for which xs(j) lies strictly
between its bounds. 


If nInf > 0, some basic and superbasic variables may be
outside their bounds by an arbitrary amount (bounded by sInf
if scaling was not used). 

SOL.hs 
State for variables and slacks in xs. 

SOL.nS 
# of superbasics. 

SOL.nInf 
# of infeasibilities. 

SOL.sInf 
Sum of infeasibilities. 

Description
Use missing value (999 or less), when no change of parameter
setting is wanted. The default value will then be used by SQOPT,
unless the value is altered in the SPECS file (input SpecsFile).
See TOMLAB User's Guide for the SPECS keywords and description.
Description of Inputs
The following fields are used: 

# 
SPECS keyword text 
Lower 
Default 
Upper 
Comment 



LP/QP Parameters I  Printing 
2. 
PRINT LEVEL 
0 
0 
10 
0, 1 or 10 

Frequencies I 
5. 
PRINT FREQUENCY 
0 
100 
6. 
SUMMARY FREQUENCY 
0 
100 
7. 
SOLUTION YES/NO 
0 
1 
1 
1 = YES; 0 = NO 
8. 
SUPPRESS PARAMETERS 
0 
0 
1 
1 = True 

LP/QP Parameters II  Convergence Tolerances 
11. 
FEASIBILITY TOLERANCE 
>0 
1E6 
12. 
OPTIMALITY TOLERANCE 
>0 
1E6 

Scaling 
18. 
SCALE OPTION 
0 
2 
2 
19. 
SCALE TOLERANCE 
>0 
0.9 
<1 
20. 
SCALE PRINT 
0 
0 
1 
1 = True 
21. 
CRASH TOLERANCE 
0 
0.1 
<1 

LU I 
23. 
LU FACTOR TOLERANCE 
1 
100 
24. 
LU UPDATE TOLERANCE 
1 
10 
25. 
LU SWAP TOLERANCE 
>0 
1.22E4 

eps^{1/4} 
26. 
LU SINGULARITY TOLERANCE 
>0 
3.25E11 

eps^{0.67} 

LP/QP Parameters III 
27. 
PIVOT TOLERANCE 
>0 
3.25E11 

eps^{0.67} 
28. 
CRASH OPTION 
0 
0 
3 
0,1,2,3 
29. 
ELASTIC WEIGHT 
0 
1 
30. 
ITERATIONS LIMIT 
0 
10000 
31. 
PARTIAL PRICE 
1 
10 
32. 
MAXIMIZE 
0 
0 
1 
1=maximize 

QP Objective 
45. 
UNBOUNDED STEP SIZE 
>0 
1E20 
48. 
SUPERBASICS LIMIT 
>0 
min(500,1+nnObj) 

LP/QP Parameters IV 
49. 
ELASTIC MODE 
0 
1 

0,1,2 
50. 
ELASTIC OBJECTIVE 
0 
2 

0,1,2 

Frequencies II 
51. 
CHECK FREQUENCY 
>0 
60 
52. 
EXPAND FREQUENCY 
>0 
10000 
53. 
FACTORIZATION FREQUENCY 
>0 
50 

LU II 
63. 
LU COMPLETE PIVOTING or LU PARTIAL PIVOTING 
0 
0 
1 
1=complete, 0=partial 

« Previous « Start » Next »