Download User's Guide for SQOPT Version 7: Software for Large
Transcript
1. 1.6. Introduction 5 Getting started For a given value of n, suppose that we wish to find the n-vector x that is closest in Euclidean norm to a given vector x0 . The complication is that not only must x lie in the set S= x: n X xj = 1, x ≥ 0, , j=1 but also its components must be nonincreasing: xj ≤ xj+1 . This problem may be written as a quadratic program Pn 1 2 minimize j=1 (xj − (x0 )j ) 2 x1 ,x2 subject to xj − xj+1 ≤ 0, Pn j=1 xj = 1, j = 1, 2, . . . , n − 1, (1.2) x ≥ 0. The objective function to be minimized can be written in the form 1 2 (x − x0 )T (x − x0 ) = 21 xT0 x0 − xT0 x + 12 xTx, which is the quadratic φ + cTx + 12 xTHx with φ = 12 xT0 x0 , c = −x0 , and H = I. The constraints xj ≤ xj+1 are written in the form −∞ ≤ xj − xj+1 ≤ 0. These n − 1 constraints, together with the restriction that the variables must sum to one, define m socalled “range constraints” of the form lA ≤ Ax ≤ uA , with m = n in this case. When n = 3, −∞ −1 1 0 0 1 , and uA = 0 . lA = −∞ , A = 0 −1 1 1 1 1 1 These quantities define the general constraints of the problem. Similarly the nonnegativity constraints on the components of x may be written as n simple bounds lx ≤ x ≤ ux , where 0 +∞ lx = 0 and ux = +∞ . 0 +∞ Internally sqOpt converts the general constraints to equalities by introducing a set of slack variables s = (s1 , s2 , . . . , sm )T . For example, the first linear constraint −∞ ≤ x1 − x2 ≤ 0 is replaced by x1 − x2 − s1 = 0 together with the bounded slack −∞ ≤ s1 ≤ 0. Problem LQP can therefore be rewritten in the following equivalent form: x minimize q(x) subject to Ax − s = 0, l ≤ ≤ u. s x,s The slack variables s are subject to the same bounds as the components of Ax. They allow us to think of the bounds on x and Ax as bounds on the combined vector (x, s). Now we must provide sqOpt the following information: 1. A subroutine qpHx that computes Hx, the product of H with a vector x. For this simple example, H is the identity matrix and the qpHx output vector Hx is defined using the simple assignments: Hx(1) = Hx(2) = Hx(3) = x(1) x(2) x(3)