[Top][All Lists]

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

Re: [Help-glpk] GLPK for Java - problem - exception thrown for glp_find_

From: Heinrich Schuchardt
Subject: Re: [Help-glpk] GLPK for Java - problem - exception thrown for glp_find_col
Date: Sat, 27 Apr 2013 22:55:27 +0200 (CEST)

please, update the documentation to clearly point out that an error is thrown in glp_find_col
and glp_find row if not preceded by a call to glp_create_index.
Wouldn't it be a good idea to let these functions implicitly call glp_create_index, if the
index is missing?
The documentation leaves it unmentioned that the index is updated when a new column or row
is added after calling glp_create_index.
Why is the index not always created when creating a new problem? The
overhead of the index seems to be negligible.
Hello András,
GLPK for Java is a wrapper around the GLPK library. This is the C code of glp_find_col:
int glp_find_col(glp_prob *lp, const char *name)
{     AVLNODE *node;
      int j = 0;
      if (lp->c_tree == NULL)
         xerror("glp_find_col: column name index does not exist\n");
      if (!(name == NULL || name[0] == '\0' || strlen(name) > 255))
      {  node = avl_find_node(lp->c_tree, name);
         if (node != NULL)
            j = ((GLPCOL *)avl_get_node_link(node))->j;
      return j;
An exception will be created, if you have not initialized the column index using
function glp_create_index before calling glp_find_col. Please, read the corresponding
chapter 2.5 Row and column searching routines in glpk-4.49/doc/glpk.pdf.
If you use the presolver this creates a transformed problem which has no column names.
f you want to use column names in the callback routine, please, switch off the presolver.
Best regards
Heinrich Schuchardt
Gesendet: Samstag, 27. April 2013 um 11:10 Uhr
Betreff: GLPK for Java - problem

I have downloaded your Java API for the MIP solver GLPK and there seems to be
a problem with one of the methods. The method GLPK.glp_find_col(glp_prob P,
String name) should return the column number for a given name but instead it
just throws an exception even when I am pretty sure, that the column with the
given name exists.
It would be quite useful for me, because I am trying to add some lazy
constraints on a callback method and I can not get the columns with their
number, because it seems that after presolving the problem its structure had
changed and there are fewer columns as before.
I am quite new to linear programming so I hope you understand what is my
problem. I would really appreciate any help.

With best regards,
András Ürge

reply via email to

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