File glpk-4.52.1-add-glp_get_it_cnt.diff of Package glpk
--- src/glpk.h.orig 2013-07-28 04:00:00.000000000 -0400
+++ src/glpk.h 2013-10-22 11:43:42.645774808 -0400
@@ -400,20 +400,32 @@
int glp_get_num_nz(glp_prob *P);
/* retrieve number of constraint coefficients */
int glp_get_mat_row(glp_prob *P, int i, int ind[], double val[]);
/* retrieve row of the constraint matrix */
int glp_get_mat_col(glp_prob *P, int j, int ind[], double val[]);
/* retrieve column of the constraint matrix */
+#ifdef FEDORA_GLPK_ITCNT
+/*
+ * A similar function is defined in GLPK 4.48, shipped in F-19 and older.
+ * However, 4.52.1, shipped in F-20+, does not include a replacement. For now,
+ * Fedora packages can define FEDORA_GLPK_ITCNT before including glpk.h to work
+ * around the problem. In the future, GLPK intends to add the below function to
+ * a release, at which point this patch can be dropped.
+ */
+int glp_get_it_cnt(glp_prob *P);
+/* retrieve iteration count */
+#endif
+
void glp_create_index(glp_prob *P);
/* create the name index */
int glp_find_row(glp_prob *P, const char *name);
/* find row by its name */
int glp_find_col(glp_prob *P, const char *name);
/* find column by its name */
void glp_delete_index(glp_prob *P);
--- src/glpapi02.c.orig 2013-07-28 04:00:00.000000000 -0400
+++ src/glpapi02.c 2013-10-22 11:41:48.092715966 -0400
@@ -481,11 +481,32 @@
len = 0;
for (aij = lp->col[j]->ptr; aij != NULL; aij = aij->c_next)
{ len++;
if (ind != NULL) ind[len] = aij->row->i;
if (val != NULL) val[len] = aij->val;
}
xassert(len <= lp->m);
return len;
}
+/***********************************************************************
+* NAME
+*
+* glp_get_it_cnt - retrieve iteration count
+*
+* SYNOPSIS
+*
+* int glp_get_it_cnt(glp_prob *lp);
+*
+* DESCRIPTION
+*
+* The routine glp_get_it_count retrieves the iteration count set by a
+* solving routine.
+*
+* RETURNS
+*
+* The routine glp_get_it_count returns the iteration count. */
+
+int glp_get_it_cnt(glp_prob *lp)
+{ return lp->it_cnt;
+}
/* eof */