/* nag_ip_mps_read (h02buc) Example Program. * * Copyright 1998 Numerical Algorithms Group. * * Mark 5, 1998. * * Mark 6 revised, 2000. */ #include #include #include #include #include static void ex1(void); static void ex2(void); int main(void) { Vprintf("h02buc Example Program Results.\n"); ex1(); ex2(); return EXIT_SUCCESS; } static void ex1(void) { Integer n, m; double *a, *c, *bl, *bu, *x, objf; Boolean *intvar; static NagError fail; Vprintf("\nExample 1: default options used.\n"); fail.print = TRUE; /* Read MPSX data */ h02buc(0, TRUE, &n, &m, &a, &bl, &bu, &intvar, &c, &x, H02_DEFAULT, &fail); /* Solve IP problem defined by data as an LP problem */ e04mfc(n, m, a, n, bl, bu, c, x, &objf, E04_DEFAULT, NAGCOMM_NULL, &fail); /* Free memory allocated by h02buc */ h02bvc(&a, &bl, &bu, &intvar, &c, &x); } static void ex2(void) { Integer n, m; double *a, *c, *bl, *bu, *x, objf; Boolean *intvar; static NagError fail; Nag_H02_Opt options; Vprintf("\nExample 2: use of options structure.\n"); /* Initialise options structure and read option settings. */ h02xxc(&options); h02xyc("h02buc", "stdin", &options, (Boolean)TRUE, "stdout", NAGERR_DEFAULT); /* Read MPSX data */ fail.print = TRUE; h02buc(0, TRUE, &n, &m, &a, &bl, &bu, &intvar, &c, &x, &options, &fail); /* Solve IP problem defined by data */ options.list = TRUE; h02bbc(n, m, a, n, bl, bu, intvar, c, (double*)0, 0, NULLFN, x, &objf, &options, NAGCOMM_NULL, &fail); /* Free memory allocated by h02buc */ h02bvc(&a, &bl, &bu, &intvar, &c, &x); /* Free options memory */ h02xzc(&options, "all", NAGERR_DEFAULT); }