subpack-glpk
Line | |
---|
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 */ |
---|
Note: See
TracBrowser
for help on using the repository browser.