subroutine HexDat( Prob, maxm, maxn, maxne, inform, & m, n, ne, nnCon, nnObj, nnJac, iObj, ObjAdd, & a, ha, ka, bl, bu, hs, x, pi ) implicit double precision (a-h,o-z) character*8 Prob integer ha(maxne) , hs(maxn+maxm) integer ka(maxn+1) double precision a(maxne) , bl(maxn+maxm), bu(maxn+maxm), & x(maxn+maxm), pi(maxm) * ------------------------------------------------------------------ * HexDat generates data for the Hexagon problem. * The constraints take the form * c(x) + A*x - s = 0, * where the Jacobian for c(x) + Ax is stored in a(*), and any * terms coming from c(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) + d'x * where d would be row iobj of A (but there is no such row in * this example). f(x) involves only the FIRST nnObj variables. * * On entry, * 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. * hs(1:n) is a set of initial states for each x (0,1,2,3,4,5). * x (1:n) is a set of initial values for x. * pi(1:m) is a set of initial values for the dual variables pi. * * 24 Dec 1997: First version of HexDat. * ------------------------------------------------------------------ parameter (bplus = 1.0d+20) parameter (zero = 0.0d+0, one = 1.0d+0) * Give a name to the Problem. Prob = 'Hexagon ' ne = 52 n = 9 m = 18 nnCon = 14 nnJac = n nnObj = n * 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 * ------------------------------------- * Set up the list of row indices in ha. * ------------------------------------- * Column 1 * Nonlinear elements in rows (1, 2, 3, 4, 5) first. ka( 1) = 1 ha( 1) = 1 ha( 2) = 2 ha( 3) = 3 ha( 4) = 4 ha( 5) = 5 a( 1) = zero a( 2) = zero a( 3) = zero a( 4) = zero a( 5) = zero * Column 1. * Linear element in row 6 next. ha( 6) = 15 a( 6) = -one * Column 2. * Nonlinear elements in rows (2, 6, 7, 8, 9). ka( 2) = 7 ha( 7) = 2 ha( 8) = 6 ha( 9) = 7 ha(10) = 8 ha(11) = 9 a( 7) = zero a( 8) = zero a( 9) = zero a(10) = zero a(11) = zero * Column 2. * Linear elements in rows (15,16). ha(12) = 15 ha(13) = 16 a(12) = one a(13) = -one * Column 3. * Nonlinear elements in rows (3, 7, 10, 11). ka( 3) = 14 ha(14) = 3 ha(15) = 7 ha(16) = 10 ha(17) = 11 a(14) = zero a(15) = zero a(16) = zero a(17) = zero * Column 3. * Linear elements in rows (16, 17). ha(18) = 16 ha(19) = 17 a(18) = one a(19) = one * Column 4. * Nonlinear elements in rows (20, 21, 22, 23, 24). ka( 4) = 20 ha(20) = 4 ha(21) = 8 ha(22) = 10 ha(23) = 12 ha(24) = 13 a(20) = zero a(21) = zero a(22) = zero a(23) = zero a(24) = zero * Column 4. * Linear elements in rows (17, 18). ha(25) = 17 ha(26) = 18 a(25) = -one a(26) = one * Column 5. * Nonlinear elements in rows (5, 9, 11, 13, 14). ka( 5) = 27 ha(27) = 5 ha(28) = 9 ha(29) = 11 ha(30) = 13 ha(31) = 14 a(27) = zero a(28) = zero a(29) = zero a(30) = zero a(31) = zero * Column 5. * Linear element in row 18. ha(32) = 18 a(32) = -one * Column 6. * Nonlinear elements in rows (1, 2, 3, 4, 5, 6). ka(6) = 33 ha(33) = 1 ha(34) = 2 ha(35) = 3 ha(36) = 4 ha(37) = 5 a(33) = zero a(34) = zero a(35) = zero a(36) = zero a(37) = zero * Column 7. * Nonlinear elements in rows (2, 6, 7, 8, 9). ka(7) = 38 ha(38) = 2 ha(39) = 6 ha(40) = 7 ha(41) = 8 ha(42) = 9 a(38) = zero a(39) = zero a(40) = zero a(41) = zero a(42) = zero * Column 8. * Nonlinear elements in rows (4, 8, 10, 12, 13). ka(8) = 43 ha(43) = 4 ha(44) = 8 ha(45) = 10 ha(46) = 12 ha(47) = 13 a(43) = zero a(44) = zero a(45) = zero a(46) = zero a(47) = zero * Column 9. * Nonlinear elements in rows (5, 9, 11, 13, 14). ka(9) = 48 ha(48) = 5 ha(49) = 9 ha(50) = 11 ha(51) = 13 ha(52) = 14 a(48) = zero a(49) = zero a(50) = zero a(51) = zero a(52) = zero * Don't forget to finish off ka. * This is crucial. ka(10) = ne + 1 * ------------------------------------------------------------------ * Constraint ranges * ------------------------------------------------------------------ * Nonlinear constraints first. do 200, i = 1, nnCon bl(i+n) = -bplus bu(i+n) = one 200 continue * Followed by the linear constraints. do 210, i = nnCon+1, m bl(i+n) = zero bu(i+n) = bplus 210 continue * No linear objective term for this problem. iObj = 0 ObjAdd = zero * ------------------------------------------------------------------ * Variable ranges * ------------------------------------------------------------------ do 300, j = 1, n bl(j) = -bplus bu(j) = bplus 300 continue bl(1) = zero bl(3) = -one bl(5) = zero bl(6) = zero bl(7) = zero bu(3) = one bu(8) = zero bu(9) = zero * ------------------------------------------------------------------ * Initialize x, hs and pi. * Set the initial value and status of each variable. * For want of something better to do, make the variables x(1:n) * temporarily fixed at their current values. * The crash can set the rest. * ------------------------------------------------------------------ x(1) = .1d+0 x(2) = .125d+0 x(3) = .666666d+0 x(4) = .142857d+0 x(5) = .111111d+0 x(6) = .2d+0 x(7) = .25d+0 x(8) = -.2d+0 x(9) = -.25d+0 do 500, j = 1, n hs(j) = 0 500 continue do 600, i = 1, m pi(i) = zero 600 continue * end of HexDat end