From ef800d4ffafdbde7d7a172ad73bd984b1695c138 Mon Sep 17 00:00:00 2001 From: Pasha Date: Fri, 27 Jan 2023 00:54:07 +0000 Subject: simplex-glpk with modified glpk for fpga --- glpk-5.0/examples/mplsamp1.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 glpk-5.0/examples/mplsamp1.c (limited to 'glpk-5.0/examples/mplsamp1.c') diff --git a/glpk-5.0/examples/mplsamp1.c b/glpk-5.0/examples/mplsamp1.c new file mode 100644 index 0000000..7c5e47d --- /dev/null +++ b/glpk-5.0/examples/mplsamp1.c @@ -0,0 +1,32 @@ +/* mplsamp1.c */ + +#include +#include +#include + +int main(void) +{ glp_prob *lp; + glp_tran *tran; + int ret; + lp = glp_create_prob(); + tran = glp_mpl_alloc_wksp(); + ret = glp_mpl_read_model(tran, "egypt.mod", 0); + if (ret != 0) + { fprintf(stderr, "Error on translating model\n"); + goto skip; + } + ret = glp_mpl_generate(tran, NULL); + if (ret != 0) + { fprintf(stderr, "Error on generating model\n"); + goto skip; + } + glp_mpl_build_prob(tran, lp); + ret = glp_write_mps(lp, GLP_MPS_FILE, NULL, "egypt.mps"); + if (ret != 0) + fprintf(stderr, "Error on writing MPS file\n"); +skip: glp_mpl_free_wksp(tran); + glp_delete_prob(lp); + return 0; +} + +/* eof */ -- cgit v1.2.1