1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/mplsamp2.c Mon Dec 06 13:09:21 2010 +0100
1.3 @@ -0,0 +1,39 @@
1.4 +/* mplsamp2.c */
1.5 +
1.6 +#include <stdio.h>
1.7 +#include <stdlib.h>
1.8 +#include <glpk.h>
1.9 +
1.10 +int main(void)
1.11 +{ glp_prob *mip;
1.12 + glp_tran *tran;
1.13 + int ret;
1.14 + mip = glp_create_prob();
1.15 + tran = glp_mpl_alloc_wksp();
1.16 + ret = glp_mpl_read_model(tran, "sudoku.mod", 1);
1.17 + if (ret != 0)
1.18 + { fprintf(stderr, "Error on translating model\n");
1.19 + goto skip;
1.20 + }
1.21 + ret = glp_mpl_read_data(tran, "sudoku.dat");
1.22 + if (ret != 0)
1.23 + { fprintf(stderr, "Error on translating data\n");
1.24 + goto skip;
1.25 + }
1.26 + ret = glp_mpl_generate(tran, NULL);
1.27 + if (ret != 0)
1.28 + { fprintf(stderr, "Error on generating model\n");
1.29 + goto skip;
1.30 + }
1.31 + glp_mpl_build_prob(tran, mip);
1.32 + glp_simplex(mip, NULL);
1.33 + glp_intopt(mip, NULL);
1.34 + ret = glp_mpl_postsolve(tran, mip, GLP_MIP);
1.35 + if (ret != 0)
1.36 + fprintf(stderr, "Error on postsolving model\n");
1.37 +skip: glp_mpl_free_wksp(tran);
1.38 + glp_delete_prob(mip);
1.39 + return 0;
1.40 +}
1.41 +
1.42 +/* eof */