lemon-project-template-glpk

comparison deps/glpk/examples/mplsamp1.c @ 9:33de93886c88

Import GLPK 4.47
author Alpar Juttner <alpar@cs.elte.hu>
date Sun, 06 Nov 2011 20:59:10 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:2531c99a95cb
1 /* mplsamp1.c */
2
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <glpk.h>
6
7 int main(void)
8 { glp_prob *lp;
9 glp_tran *tran;
10 int ret;
11 lp = glp_create_prob();
12 tran = glp_mpl_alloc_wksp();
13 ret = glp_mpl_read_model(tran, "egypt.mod", 0);
14 if (ret != 0)
15 { fprintf(stderr, "Error on translating model\n");
16 goto skip;
17 }
18 ret = glp_mpl_generate(tran, NULL);
19 if (ret != 0)
20 { fprintf(stderr, "Error on generating model\n");
21 goto skip;
22 }
23 glp_mpl_build_prob(tran, lp);
24 ret = glp_write_mps(lp, GLP_MPS_FILE, NULL, "egypt.mps");
25 if (ret != 0)
26 fprintf(stderr, "Error on writing MPS file\n");
27 skip: glp_mpl_free_wksp(tran);
28 glp_delete_prob(lp);
29 return 0;
30 }
31
32 /* eof */