/* nag_ip_mps_read (h02buc) Example Program. * * Copyright 1998 Numerical Algorithms Group. * * Mark 5, 1998. * * Mark 6 revised, 2000. * Mark 8 revised, 2004. */ #include #include #include #include #include #include int main(void) { const char *optionsfile = "h02buce.opt"; Integer exit_status = 0; Nag_Boolean *intvar; Integer m, n; Nag_H02_Opt options; double *a, *bl, *bu, *c, objf, *x; NagError fail; INIT_FAIL(fail); printf("nag_ip_mps_read (h02buc) Example Program Results\n"); /* Initialise options structure and read option settings. */ /* nag_ip_init (h02xxc). * Initialize option structure to null values */ nag_ip_init(&options); /* nag_ip_read (h02xyc). * Read optional parameter values from a file */ fflush(stdout); nag_ip_read("h02buc", optionsfile, &options, (Nag_Boolean) Nag_TRUE, "stdout", &fail); if (fail.code != NE_NOERROR) { printf("Error from nag_ip_read (h02xyc).\n%s\n", fail.message); exit_status = 1; goto END; } /* Read MPSX data */ /* nag_ip_mps_read (h02buc), see above. */ nag_ip_mps_read( 0, Nag_TRUE, &n, &m, &a, &bl, &bu, &intvar, &c, &x, &options, &fail); if (fail.code != NE_NOERROR) { printf("Error from nag_ip_mps_read (h02buc).\n%s\n", fail.message); exit_status = 1; goto END; } /* Solve IP problem defined by data */ options.list = Nag_TRUE; /* nag_ip_bb (h02bbc). * Solves integer programming problems using a branch and * bound method */ nag_ip_bb(n, m, a, n, bl, bu, intvar, c, (double *) 0, 0, NULLFN, x, &objf, &options, NAGCOMM_NULL, &fail); if (fail.code != NE_NOERROR) { printf("Error from nag_ip_bb (h02bbc).\n%s\n", fail.message); exit_status = 1; goto END; } /* Free memory allocated by nag_ip_mps_read (h02buc) */ /* nag_ip_mps_free (h02bvc), see above. */ nag_ip_mps_free(&a, &bl, &bu, &intvar, &c, &x); /* Free options memory */ /* nag_ip_free (h02xzc). * Free NAG allocated memory from option structures */ nag_ip_free(&options, "all", &fail); if (fail.code != NE_NOERROR) { printf("Error from nag_ip_free (h02xzc).\n%s\n", fail.message); exit_status = 1; goto END; } END: return exit_status; }