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;
}
int glp_find_row(glp_prob *lp, const char *name)
{   AVLNODE *node;
    int i = 0;
    if (lp->r_tree == NULL)
        xerror("glp_find_row: row name index does not exist\n");
    if (!(name == NULL || name[0] == '\0' || strlen(name) > 255))
    {   node = avl_find_node(lp->r_tree, name);
        if (node != NULL)
            i = ((GLPROW *)avl_get_node_link(node))->i;
    }
    return i;
}
Esempio n. 3
0
int glp_find_vertex(glp_graph *G, const char *name)
{   /* find vertex by its name */
    AVLNODE *node;
    int i = 0;
    if (G->index == NULL)
        xerror("glp_find_vertex: vertex name index does not exist\n");
    if (!(name == NULL || name[0] == '\0' || strlen(name) > 255))
    {   node = avl_find_node(G->index, name);
        if (node != NULL)
            i = ((glp_vertex *)avl_get_node_link(node))->i;
    }
    return i;
}