COIN-OR::LEMON - Graph Library

source: glpk-cmake/examples/mplsamp1.c @ 1:c445c931472f

Last change on this file since 1:c445c931472f was 1:c445c931472f, checked in by Alpar Juttner <alpar@…>, 10 years ago

Import glpk-4.45

  • Generated files and doc/notes are removed
File size: 784 bytes
Line 
1/* mplsamp1.c */
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <glpk.h>
6
7int 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");
27skip: 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.