/* Simplified example program for E04NFF C Version. NAG Copyright 1999. */ #include #include #include #define LWORK 10000 #define LIWORK 1000 #define N 7 #define NCLIN 7 main() { CONST int n = N, nclin = NCLIN, liwork=LIWORK, lwork=LWORK; int iter; double obj; /* The matrix A is stored in column major order */ double a[NCLIN][N] = {1.00, 0.15, 0.03, 0.02, 0.02, 0.70, 0.02, 1.00, 0.04, 0.05, 0.04, 0.03, 0.75, 0.06, 1.00, 0.02, 0.08, 0.01, 0.00, 0.80, 0.08, 1.00, 0.04, 0.02, 0.02, 0.00, 0.75, 0.12, 1.00, 0.02, 0.06, 0.02, 0.01, 0.80, 0.02, 1.00, 0.01, 0.01, 0.00, 0.00, 0.97, 0.01, 1.00, 0.03, 0.00, 0.00, 0.00, 0.00, 0.97}; double ax[NCLIN]; double bl[N+NCLIN] = {-0.01, -0.10, -0.01, -0.04, -0.10, -0.01, -0.01, -0.13, -1.0e25, -1.0e25, -1.0e25, -1.0e25, -9.92e-2, -3.0e-3}; double bu[N+NCLIN] = { 0.01, 0.15, 0.03, 0.02, 0.05, 1.0e25, 1.0e25, -0.13, -4.9e-3, -6.4e-3, -3.7e-3, -1.2e-3, 1.0e25, 2.0e-03}; double clamda[N+NCLIN]; double cvec[N] = {-0.02, -0.20, -0.20, -0.20, -0.20, 0.04, 0.04}; /* Matrix H is symmetrical */ double h[N][N] = { 2.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 2.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 2.00, 2.00, 0.00, 0.00, 0.00, 0.00, 0.00, 2.00, 2.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 2.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, -2.00, -2.00, 0.00, 0.00, 0.00, 0.00, 0.00, -2.00, -2.00}; double work[LWORK]; double x[N] = {-0.01, -0.03, 0.0, -0.01, -0.10, 0.02, 0.01}; int istate[N+NCLIN], iwork[LIWORK], ifail = -1; e04nff_(&n, &nclin, (double *) a, &nclin, bl, bu, cvec, (double *) h, &n, e04nfu_, istate, x, &iter, &obj, ax, clamda, iwork, &liwork, work, &lwork, &ifail); return 0; }