Hello,
I think there is an issue with the way tspsol works: The rounding heuristic
of glp_intopt runs after row generation (when no row was added) and may
give an integer solution with subtours. The heuristic only checks that the
solution satisfies the original problem, so no subtour elimination
constraints are checked. Moreover, an appropriate constraint may not have
been added yet.
To avoid this, the rounding heuristic should be disabled. Unfortunately,
there is no control parameter for this in glp_iocp, so I'm attaching an
awful hack to disable it from the tspsol callback. This is only in case
anyone gets an "Assertion failed: kk <= n" error and wants to check if this
is the reason, I would advise against using it for any other reason.
Best Regards,
Chris Matrakidis
--- main.c.org 2015-10-15 10:00:00.000000000 +0300
+++ main.c 2015-10-19 00:46:37.500000000 +0300
@@ -417,12 +417,28 @@
* the branch-and-cut algorithm. */
void cb_func(glp_tree *T, void *info)
-{ xassert(info == info);
+{ static int j, k;
+ if (k == 0)
+ k = glp_get_num_cols(P);
+ xassert(info == info);
switch (glp_ios_reason(T))
{ case GLP_IROWGEN:
/* generate one violated subtour elimination constraint */
gen_subt(T);
break;
+ case GLP_IHEUR:
+ for (j = 1; j <= k; j++)
+ { if (glp_get_col_kind(P, j) == GLP_BV)
+ { glp_set_col_kind(P, j, GLP_CV);
+ break;
+ }
+ }
+ break;
+ case GLP_ICUTGEN:
+ if (j > 0 && j <= glp_get_num_cols(P))
+ glp_set_col_kind(P, j, GLP_BV);
+ j = 0;
+ break;
}
return;
}
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk