[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Intermediate feasible "solutions" (suboptimal)

From: Xypron
Subject: Re: [Help-glpk] Intermediate feasible "solutions" (suboptimal)
Date: Sat, 03 Oct 2009 17:21:58 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20090823 SeaMonkey/1.1.18

Hello Anil,

I have had a look at file cvxopt-1.1.1/src/C/glpk.c. The functions (like lpx_simplex) used to interface to GLPK have not been in the official API for many releases. Please, contact the authors of cvxopt and ask them to update the glpk interface. You can download glpk including documentation form The API is documented in doc/glpk.pdf.

If you want to use GLPK from Python, you might consider using python-glpk available at <> which supports the complete current GLPK API.

If you want to trace the simplex solution process you will remark that the published API does not foresee this. You will have to dig into the C coding of GLPK.

For tracing the branch and bound solution of mixed integer linear programs you can use the callback functions provided.

Best regards


Anil N. Hirani wrote:
I am using GLPK in PYTHON via CVXOPT (which has an option to select solver as GLPK). I am using it to solve an LP. I'd like to print out the values of the variables in the problem as simplex progresses. In other words, I am interested in feasible but suboptimal intermediate "solutions".

Is there any way to achieve that without using the GLPK API in C. That is, is it possible to print the intermediate feasible "solutions" by passing some option to GLPK via CVXOPT ? I couldn't find anything relevant in the GLPK manual, CVXOPT manual or online.

I tried the following : I set the iteration limit. But such pre-optimal termination seems to be interpreted as a failure by GLPK. Here's what happens. The output of GLPK is :

0: obj = 0.000000000e+00 infeas = 3.500e+01 (0)
200: obj = 3.367050904e+00 infeas = 2.000e+01 (0)
* 294: obj = 8.833290070e+00 infeas = 0.000e+00 (0)
* 300: obj = 8.833290070e+00 infeas = 0.000e+00 (0)
glp_simplex: unable to recover undefined or non-optimal solution

Following the message printed by GLPK at the end (above), we find that it is coming from the function "simplex2" in file glpapi06.c of GLPK. The appropriate lines are :

if (glp_get_status(prob) != GLP_OPT)
{ if (parm->msg_lev >= GLP_MSG_ERR)
xprintf("glp_simplex: unable to recover undefined or non-op"
"timal solution\n");

I suppose I could start modifying my local copy of GLPK to get what I want. But I am hoping for an easier solution.


Help-glpk mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]