Contents Previous Next Subchapters

Linear Least Squares With Box Constraints
Syntax linlsqb(Arepsxinixlowxup
linlsqb(
Arepsxinixlowxupactive)
See Also linlsq , dnlsqb

Description
Returns a vector that solves the problem
     minimize  |A x - r|^2 with respect to x 
     such that xlow(i<  x(i< xup(i)
where the matrix A is real or double-precision, the column vector r has the same type and row dimension as A, and the scalar eps is such that singular values of A that are less than eps are replaced by 0 in the minimization problem. The column vector xini specifies the initial point at which to start the minimization. It must have the same number of rows as A has columns, and it must have the same type as A. The column vectors xlow and xup must have the same type and dimension as xini. The return vector has the same type and dimension as xini.

If more than one solution exists, the solution of minimum norm is returned: the solution that minimizes |x| over the set of solutions.

If the argument active is present, its input value does not matter and its output value is an integer row vector with the same length as xini that specifies which constraints are active at the solution. If the output value of active(i) is -1, the constraint xlow(i< x(i) is active. If the output value of active(i) is +1, the constraint x(i< xup(i) is active. If neither of these constraints are active, the output value of active(i) is 0.

Example
The following example solves the problem
     minimize   (x(1) - 4)^2 + (10 * x(2) - 30)^2 + (100 * x(3) - 200)^2
     subject to -3 < x(1) < +3 
                -2 < x(2) < +2 
                -1 < x(3) < +1 
The solution to this problem is x equals to the transpose of (3, 2, 1). If you enter
     A = diag([1., 10., 100.])  
     r = {4., 30., 200.}
     eps = 1e-7  
     xini = {0., 0., 0.}
     xlow = {-3., -2., -1.} 
     xup = {3., 2., 1.} 
     linlsqb(A, r, eps, xini, xlow, xup)
O-Matrix will respond
     {
     3
     2
     1
     }

Restrictions
Every element of the upper limit xup must be strictly greater than the corresponding element of the lower limit xlow.