alpar@1: /* mplsamp2.c */ alpar@1: alpar@1: #include alpar@1: #include alpar@1: #include alpar@1: alpar@1: int main(void) alpar@1: { glp_prob *mip; alpar@1: glp_tran *tran; alpar@1: int ret; alpar@1: mip = glp_create_prob(); alpar@1: tran = glp_mpl_alloc_wksp(); alpar@1: ret = glp_mpl_read_model(tran, "sudoku.mod", 1); alpar@1: if (ret != 0) alpar@1: { fprintf(stderr, "Error on translating model\n"); alpar@1: goto skip; alpar@1: } alpar@1: ret = glp_mpl_read_data(tran, "sudoku.dat"); alpar@1: if (ret != 0) alpar@1: { fprintf(stderr, "Error on translating data\n"); alpar@1: goto skip; alpar@1: } alpar@1: ret = glp_mpl_generate(tran, NULL); alpar@1: if (ret != 0) alpar@1: { fprintf(stderr, "Error on generating model\n"); alpar@1: goto skip; alpar@1: } alpar@1: glp_mpl_build_prob(tran, mip); alpar@1: glp_simplex(mip, NULL); alpar@1: glp_intopt(mip, NULL); alpar@1: ret = glp_mpl_postsolve(tran, mip, GLP_MIP); alpar@1: if (ret != 0) alpar@1: fprintf(stderr, "Error on postsolving model\n"); alpar@1: skip: glp_mpl_free_wksp(tran); alpar@1: glp_delete_prob(mip); alpar@1: return 0; alpar@1: } alpar@1: alpar@1: /* eof */