subroutine funcon( mode, m, n, neJac, x, f, g, nState, $ cw, lencw, iw, leniw, rw, lenrw ) implicit double precision(a-h,o-z) double precision x(n), f(m), g(neJac) character*8 cw(lencw) integer iw(leniw) double precision rw(lenrw) * ------------------------------------------------------------------ * This funcon defines nonlinear constraints and Jacobian entries * for problem maxi. See main program "maxi" and generator "mxdata". * * There are P = n/2 circles * and m = (P-1)*P/2 constraints of the form * (x(p) - x(q))**2 + (y(p) - y(q))**2 >= diameter. * For P = 4, the constraint functions are * * (x2 - x1)**2 + (y2 - y1)**2 * (x3 - x1)**2 + (y3 - y1)**2 * (x3 - x2)**2 + (y3 - y2)**2 * (x4 - x1)**2 + (y4 - y1)**2 * (x4 - x2)**2 + (y4 - y2)**2 * (x4 - x3)**2 + (y4 - y3)**2 * * and the first P columns of the Jacobian look like this: * * -2(x2 - x1) 2(x2 - x1) * -2(x3 - x1) 2(x3 - x1) * -2(x3 - x2) 2(x3 - x2) * -2(x4 - x1) 2(x4 - x1) * -2(x4 - x2) 2(x4 - x2) * -2(x4 - x3) 2(x4 - x3) * * The next P columns look the same in the y variables, * so we make use of the auxiliary routine funmax. * * 28 Aug 1992: First version. Boy, this is a lot tougher than AMPL. * ------------------------------------------------------------------ integer P parameter ( zero = 0.0d+0 ) P = n/2 neJacP = neJac/2 call dload ( m, zero, f, 1 ) call funmax( m, P, neJacP, x , f, g ) call funmax( m, P, neJacP, x(P+1), f, g(neJacP+1) ) * end of funcon end