subroutine mxdata( P, maxm, maxn, maxne, inform, $ m, n, ne, nnCon, nnObj, nnJac, $ a, ha, ka, bl, bu, x, pi, hs ) implicit double precision (a-h,o-z) integer P integer ha(maxne), hs(maxm+maxn) integer ka(maxn+1) double precision a(maxne) double precision bl(maxm+maxn), bu(maxm+maxn), x(maxm+maxn) double precision pi(maxm) * ------------------------------------------------------------------ * mxdata generates data for the test problems maxi. * The constraints take the form * f(x) + A*x - s = 0, * where the Jacobian for f(x) + Ax is stored in a(*), and any * terms coming from f(x) are in the TOP LEFT-HAND CORNER of a(*), * with dimensions nnCon x nnJac. * Note that the right-hand side is zero. * s is a set of slack variables whose bounds contain any constants * that might have formed a right-hand side. * * The objective function is * f(x) + c'x * where c is row iobj of A (but there is no f(x) in this example). * * On entry, * P is the number of time circles. * maxm, maxn, maxne are upper limits on m, n, ne. * * On exit, * inform is 0 if there is enough storage, 1 otherwise. * m is the number of nonlinear and linear constraints. * n is the number of variables. * ne is the number of nonzeros in a(*). * nnCon is the number of nonlinear constraints (they come first). * nnObj is the number of nonlinear objective variables. * nnJac is the number of nonlinear Jacobian variables. * a is the constraint matrix (Jacobian), stored column-wise. * ha is the list of row indices for each nonzero in a(*). * ka is a set of pointers to the beginning of each column of a. * bl is the lower bounds on x and s. * bu is the upper bounds on x and s. * x (1:n) is a set of initial values for x. * hs(1:n) is a set of initial states for each x (0,1,2,3,4,5). * * 28 Aug 1992: First version, based on t4data. * ------------------------------------------------------------------ parameter ( zero = 0.0d+0, one = 1.0d+0, $ dummy = 0.1d+0, $ bplus = 1.0d+20, bminus = - bplus ) * P defines the dimension of the problem. m = (P - 1)*P / 2 + 1 n = 2*P + 1 nb = n + m nnCon = m - 1 nnObj = 0 nnJac = n - 1 ne = 2*(P - 1)*P + m * Check if there is enough storage. inform = 0 if (m .gt. maxm ) inform = 1 if (n .gt. maxn ) inform = 1 if (ne .gt. maxne) inform = 1 if (inform .gt. 0 ) return * ------------------------------------------------------------------ * The variables are P pairs (x(p),y(p)) and d2. * The x's come first, then the y's. * For P = 5, the sparsity pattern of the Jacobian is * a z a z -1 * b z b z -1 * b z b z -1 * c z c z -1 * c z c z -1 * c z c z -1 * d z d z -1 * d z d z -1 * d z d z -1 * d z d z -1 * 1 * where in general, a, b, c, d,... indicate P-1 diagonal matrices, * and there is a set of consecutive z's in each column. * The first P columns have the same structure as the next P. * The last column corresponds to the linear variable d2, * and the last row corresponds to the objective "maximize d2". * We put in dummy numerical values of 0.1 for a, b, c, d and z. * Real values for the gradients are computed by funcon. * ------------------------------------------------------------------ * Generate the structure of the first P columns of the Jacobian. ne = 0 ! total number of Jacobian elements iz = 0 ! row index of each z element in current column id = 0 ! row index of first diagonal element a or b or c... realP = P do 100 k = 1, P ka(k) = ne + 1 * Column k has k-1 "z" entries. do 20 l = 1, k-1 ne = ne + 1 iz = iz + 1 ha(ne) = iz a(ne) = dummy 20 continue * Column k has P-k entries from the diagonal matrices. id = iz + k do 30 l = k, P-1 ne = ne + 1 ha(ne) = id a(ne) = dummy id = id + l 30 continue * Set bounds and initial value and state. bl(k) = zero bu(k) = one x(k) = k / (realP + one) hs(k) = 0 100 continue * The next P columns look exactly the same. call dcopy ( ne, a , 1, a (ne+1), 1 ) call icopy ( ne, ha, 1, ha(ne+1), 1 ) do 120 k = 1, P ka(P+k) = ka(k) + ne 120 continue call dcopy ( P, bl, 1, bl( P+1), 1 ) call dcopy ( P, bu, 1, bu( P+1), 1 ) call dcopy ( P, x , 1, x( P+1), 1 ) call icopy ( P, hs, 1, hs( P+1), 1 ) ne = 2*ne ka(n) = ne + 1 * The last column is the linear variable d2. * It is -1 in all rows except the objective (the last row). * The last nonzero is 1 for the linear objective. do 200 i = 1, m ne = ne + 1 ha(ne) = i a(ne) = - one 200 continue a(ne) = one ka(n+1) = ne + 1 * ------------------------------------------------------------------ * Set bounds for d2 (variable n) and for each slack. * The last (objective) slack is a free variable. * * d2min is an obvious lower bound on d2, corresponding to * all circles centered along one edge of the square. * We initialize d2 = d2min * and set the lower bound to be half this * just so d2 is away from the lower bound. * ------------------------------------------------------------------ d2min = (2.0d+0 / (realP - one))**2 x(n) = d2min bl(n) = d2min * 0.5d+0 bu(n) = bplus do 300 j = n+1, nb bl(j) = zero bu(j) = bplus 300 continue bl(nb) = bminus call dload ( nnCon, zero, pi, 1 ) * end of mxdata end