SOL LSSOL
This page is part of the SOL Manual. See SOL. |
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 LSSOL with TOMLAB.
Purpose
lssol solves least squares optimization problems defined as
where , , , , .
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.
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 upper-trapezoidal 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 MEX-interface..
= 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 solu- tion. 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. |
Using TOMLAB
Purpose
lssolTL solves least squares optimization problems defined as
where , , , , .
Calling Syntax
Using the driver routine tomRun :
Prob = ''o''Assign( ... ); Result = tomRun('lssol', Prob ... ); or Prob = ProbCheck( ... ); Result = lssolTL(Prob);
Call Prob = oAssign( ... ) 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. 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 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 solu- tion. 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. |
optPar
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
# | 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.1E-8 | sqrt(eps) | |
11. | FEASIBILITY TOLERANCE | > 0 | 1.1E-8 | sqrt(eps) | |
Other Tolerances | |||||
21. | CRASH TOLERANCE | > 0 | 0.01 | < 1 | |
27. | RANK TOLERANCE | > 0 | 1.1E-14 | 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 |