int lpx_print_ips(LPX *lp, const char *fname) { /* write interior point solution in printable format */ return glp_print_ipt(lp, fname); }
static PyObject* LPX_write(LPXObject *self, PyObject *args, PyObject *keywds) { static char* kwlist[] = {"mps", "freemps", "prob", "sol", "sens_bnds", "ips", "mip", NULL}; char* fnames[] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL}; char* fname; const char* err_msg = "writer for '%s' failed to write to '%s'"; int rv; rv = PyArg_ParseTupleAndKeywords(args, keywds, "|sssssss", kwlist, fnames,fnames+1,fnames+2,fnames+3, fnames+4,fnames+5,fnames+6); if (!rv) return NULL; fname = fnames[0]; if (fname != NULL) { rv = glp_write_mps(LP, GLP_MPS_DECK, NULL, fname); if (rv != 0) { PyErr_Format(PyExc_RuntimeError, err_msg, kwlist[0], fname); return NULL; } } fname = fnames[1]; if (fname != NULL) { rv = glp_write_mps(LP, GLP_MPS_FILE, NULL, fname); if (rv != 0) { PyErr_Format(PyExc_RuntimeError, err_msg, kwlist[1], fname); return NULL; } } fname = fnames[2]; if (fname != NULL) { rv = glp_write_lp(LP, NULL, fname); if (rv != 0) { PyErr_Format(PyExc_RuntimeError, err_msg, kwlist[2], fname); return NULL; } } fname = fnames[3]; if (fname != NULL) { rv = glp_print_sol(LP, fname); if (rv != 0) { PyErr_Format(PyExc_RuntimeError, err_msg, kwlist[3], fname); return NULL; } } fname = fnames[4]; if (fname != NULL) { if (glp_get_status(LP) == GLP_OPT && !glp_bf_exists(LP)) glp_factorize(LP); rv = glp_print_ranges(LP, 0, NULL, 0, fname); if (rv != 0) { PyErr_Format(PyExc_RuntimeError, err_msg, kwlist[4], fname); return NULL; } } fname = fnames[5]; if (fname != NULL) { rv = glp_print_ipt(LP, fname); if (rv != 0) { PyErr_Format(PyExc_RuntimeError, err_msg, kwlist[5], fname); return NULL; } } fname = fnames[6]; if (fname != NULL) { glp_print_mip(LP, fname); if (rv != 0) { PyErr_Format(PyExc_RuntimeError, err_msg, kwlist[6], fname); return NULL; } } Py_RETURN_NONE; }