# SOL QPOPT

## 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 #Using TOMLAB for information on how to use QPOPT with TOMLAB.

### Purpose

qpopt solves dense quadratic optimization problems defined as

${\displaystyle {\begin{array}{ll}\min \limits _{x}&f(x)={\frac {1}{2}}x^{T}Fx+c^{T}x+d^{T}x\\&\\s/t&{\begin{array}{lcccl}&&x&&,\\b_{L}&\leq &Ax&\leq &b_{U}\\\end{array}}\end{array}}}$

where ${\displaystyle c,x\in \mathbb {R} ^{n}}$, ${\displaystyle F\in \mathbb {R} ^{n\times n}}$, ${\displaystyle A\in \mathbb {R} ^{m_{1}\times n}}$, and ${\displaystyle b_{L},b_{U}\in \mathbb {R} ^{n+m_{1}}}$.

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,  Summ- File, 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 char- acters = 500.
PriLev Print level in the qpopt MEX-interface.

= 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 dead-point was reached. This might occur if H is not sufficiently posi- tive 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 dead-point, the necessary conditions for optimality are satisfied (x is fea- sible, the reduced gradient is negligible, the Lagrange multipliers are optimal, and the reduced Hessian is positive semidefinite.) However, the reduced Hes- sian 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 NP-hard problem.

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).

## Using TOMLAB

### Purpose

qpoptTL solves quadratic optimization problems defined as

${\displaystyle {\begin{array}{ll}\min \limits _{x}&f(x)={\frac {1}{2}}x^{T}Fx+c^{T}x\\&\\s/t&{\begin{array}{lcccl}x_{L}&\leq &x&\leq &x_{U},\\b_{L}&\leq &Ax&\leq &b_{U}\\\end{array}}\end{array}}}$

where ${\displaystyle c,x,x_{L},x_{U}\in \mathbb {R} ^{n}}$, ${\displaystyle F\in \mathbb {R} ^{n\times n}}$, ${\displaystyle A\in \mathbb {R} ^{m_{1}\times n}}$, and ${\displaystyle b_{L},b_{U}\in \mathbb {R} ^{m_{1}}}$

### 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. See Table 50.

### 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 dead-point was reached. This might occur if H is not sufficiently posi- tive 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 dead-point, the necessary conditions for optimality are satisfied (x is fea- sible, the reduced gradient is negligible, the Lagrange multipliers are optimal, and the reduced Hessian is positive semidefinite.) However, the reduced Hes- sian 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 NP-hard 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.
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.

## optPar

### 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

#### Table: 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
In LPOPT/QPOPT: macheps = 2-53 ; eps in Matlab is = 2-52 ;
10. OPTIMALITY TOLERANCE > 0 1.05E-8 sqrt(macheps)
11. FEASIBILITY TOLERANCE > 0 1.05E-8 sqrt(macheps)
Other Tolerances
21. CRASH TOLERANCE 0 0.01 < 1
27. RANK TOLERANCE > 0 1.1E-14 100\*macheps
30. ITERATION LIMIT >0 max(2000,5(n+m))
33. MIN SUM YES (or NO)

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

0 0 1 1=min infeas.
36. FEASIBILITY PHASE ITERATIONS >0 max(2000,5(n+m))
45. INFINITE STEP SIZE >0 1E20
47. HESSIAN ROWS

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

0 n n 0 if FP or LP
48. MAX DEGREES OF FREEDOM

ONLY USED IF HESSIAN ROWS == N

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