Hi,
My code calls glpk with an integer program to solve hundreds of
thousands of times.
I tried writing out the problematic problem with glp_write_prob but it
wouldn't read that back in. Using glp_write_lp or glp_write_mps followed
by the read function would create a problem that could be solved.
So I got the program to write out some code to reproduce it. See the
attached routine.
I am running this on Windows 10 x64. Compiled the library with VS 2015.
Stack looks like this:
glpk_4_57.dll!abort() Line 88 C
glpk_4_57.dll!errfunc(const char * fmt, ...) Line 55 C
glpk_4_57.dll!_glp_sgf_reduce_nuc(LUF * luf, int * k1_, int * k2_,
int * cnt, int * list) Line 185 C
glpk_4_57.dll!_glp_sgf_factorize(SGF * sgf, int singl) Line 1343 C
glpk_4_57.dll!_glp_lufint_factorize(LUFINT * fi, int n,
int(*)(void *, int, int *, double *) col, void * info) Line 146 C
glpk_4_57.dll!_glp_fhvint_factorize(FHVINT * fi, int n,
int(*)(void *, int, int *, double *) col, void * info) Line 52 C
glpk_4_57.dll!_glp_bfd_factorize(BFD * bfd, int m, int(*)(void *,
int, int *, double *) col1, void * info1) Line 218 C
glpk_4_57.dll!_glp_spx_factorize(SPXLP * lp) Line 56 C
glpk_4_57.dll!dual_simplex(csa * csa) Line 745 C
glpk_4_57.dll!_glp_spy_dual(glp_prob * P, const glp_smcp * parm)
Line 1158 C
glpk_4_57.dll!solve_lp(glp_prob * P, const glp_smcp * parm) Line
250 C
glpk_4_57.dll!glp_simplex(glp_prob * P, const glp_smcp * parm)
Line 459 C
glpk_4_57.dll!_glp_ios_solve_node(glp_tree * tree) Line 1359 C
glpk_4_57.dll!_glp_ios_driver(glp_tree * T) Line 1036 C
glpk_4_57.dll!solve_mip(glp_prob * P, const glp_iocp * parm,
glp_prob * P0, NPP * npp) Line 252 C
glpk_4_57.dll!preprocess_and_solve_mip(glp_prob * P, const
glp_iocp * parm) Line 411 C
glpk_4_57.dll!glp_intopt(glp_prob * P, const glp_iocp * parm) Line
630 C
split.exe!error() Line 1644 C
Thanks.
Neill.
On 1/6/2016 12:06 PM, Neill Clift wrote:
Is this likely a problem with my code or a bug in glpk? Looks to be
reproducible. I can dump more info if needed.
Assertion failed: tcol[csa->p] != 0.0
Error detected in file ..\src\simplex\spydual.c at line 999
/* FIXME: tcol[p] and trow[q] should be close to each other */
xassert(tcol[csa->p] != 0.0);
glpk_4_57.dll!abort() Line 88 C
glpk_4_57.dll!errfunc(const char * fmt, ...) Line 55 C
> glpk_4_57.dll!dual_simplex(csa * csa) Line 999 C
glpk_4_57.dll!_glp_spy_dual(glp_prob * P, const glp_smcp * parm)
Line 1158 C
glpk_4_57.dll!solve_lp(glp_prob * P, const glp_smcp * parm) Line
250 C
glpk_4_57.dll!glp_simplex(glp_prob * P, const glp_smcp * parm)
Line 459 C
glpk_4_57.dll!_glp_ios_solve_node(glp_tree * tree) Line 1359 C
glpk_4_57.dll!_glp_ios_driver(glp_tree * T) Line 1036 C
glpk_4_57.dll!solve_mip(glp_prob * P, const glp_iocp * parm,
glp_prob * P0, NPP * npp) Line 252 C
glpk_4_57.dll!glp_intopt(glp_prob * P, const glp_iocp * parm)
Line 627 C
split.exe!DoSimplex(_BLIST * List, unsigned long n, unsigned long
index, _OPERATION operation, unsigned long min, unsigned char *
Feasable) Line 1086 C
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk
void error(void)
{
int ia[] = {0, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14,
14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21,
21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35,
36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 40, 41, 41,
42, 42, 43, 43, 44, 44, 45 };
int ja[] = {0, 1, 1, 2, 7, 1, 2, 2, 3, 2, 3, 3, 4, 3, 4, 4, 5, 4, 5, 5,
6, 7, 5, 6, 6, 7, 21, 6, 7, 7, 8, 9, 7,
8, 8, 9, 24, 8, 9, 9, 10, 9, 10, 10, 11, 10, 11, 11, 12, 11,
12, 12, 13, 12, 13, 13, 14, 13, 14, 14, 15, 14, 15, 15,
16, 15, 16, 16, 17, 16, 17, 17, 18, 17, 18, 18, 19, 18, 19, 19,
20, 19, 20, 20, 22, 23, 20, 21, 21, 22, 22, 23, 23,
24, 24 };
double ar[] = {0.0, 1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -2.0, 1.0,
-1.0, 1.0, -2.0, 1.0, -1.0, 1.0, -2.0, 1.0,
-1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0,
1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0,
1.0, -2.0, 1.0, -1.0, 1.0, -2.0, 1.0, -1.0, 1.0, -2.0, 1.0,
-1.0, 1.0, -2.0, 1.0, -1.0, 1.0, -2.0, 1.0, -1.0, 1.0,
-2.0, 1.0, -1.0, 1.0, -2.0, 1.0, -1.0, 1.0, -2.0, 1.0, -1.0,
1.0, -2.0, 1.0, -1.0, 1.0, -2.0, 1.0, -1.0, 1.0, -2.0,
1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0,
1.0, -1.0, 1.0};
glp_prob *lp = glp_create_prob();
glp_set_prob_name(lp, "Addition Chain Bounds");
glp_set_obj_dir(lp, GLP_MIN);
glp_add_rows(lp, 45);
glp_add_cols(lp, 24);
glp_set_row_bnds(lp, 1, GLP_FX, 1000001.0, 1000001.000000);
glp_set_row_bnds(lp, 2, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 3, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 4, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 5, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 6, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 7, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 8, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 9, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 10, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 11, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 12, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 13, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 14, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 15, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 16, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 17, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 18, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 19, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 20, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 21, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 22, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 23, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 24, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 25, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 26, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 27, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 28, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 29, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 30, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 31, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 32, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 33, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 34, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 35, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 36, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 37, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 38, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 39, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 40, GLP_FX, 0.0, 0.0);
glp_set_row_bnds(lp, 41, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 42, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 43, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 44, GLP_LO, 1.0, 0.0);
glp_set_row_bnds(lp, 45, GLP_LO, 1.0, 0.0);
glp_set_col_bnds(lp, 1, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 1, GLP_IV);
glp_set_col_bnds(lp, 2, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 2, GLP_IV);
glp_set_col_bnds(lp, 3, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 3, GLP_IV);
glp_set_col_bnds(lp, 4, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 4, GLP_IV);
glp_set_col_bnds(lp, 5, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 5, GLP_IV);
glp_set_col_bnds(lp, 6, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 6, GLP_IV);
glp_set_col_bnds(lp, 7, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 7, GLP_IV);
glp_set_col_bnds(lp, 8, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 8, GLP_IV);
glp_set_col_bnds(lp, 9, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 9, GLP_IV);
glp_set_col_bnds(lp, 10, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 10, GLP_IV);
glp_set_col_bnds(lp, 11, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 11, GLP_IV);
glp_set_col_bnds(lp, 12, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 12, GLP_IV);
glp_set_col_bnds(lp, 13, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 13, GLP_IV);
glp_set_col_bnds(lp, 14, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 14, GLP_IV);
glp_set_col_bnds(lp, 15, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 15, GLP_IV);
glp_set_col_bnds(lp, 16, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 16, GLP_IV);
glp_set_col_bnds(lp, 17, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 17, GLP_IV);
glp_set_col_bnds(lp, 18, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 18, GLP_IV);
glp_set_col_bnds(lp, 19, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 19, GLP_IV);
glp_set_col_bnds(lp, 20, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 20, GLP_IV);
glp_set_col_bnds(lp, 21, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 21, GLP_IV);
glp_set_col_bnds(lp, 22, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 22, GLP_IV);
glp_set_col_bnds(lp, 23, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 23, GLP_IV);
glp_set_col_bnds(lp, 24, GLP_LO, 1.0, 0.0);
glp_set_col_kind(lp, 24, GLP_IV);
glp_set_obj_coef(lp, 21, 1.0);
glp_term_out(GLP_OFF);
int iai = sizeof(ia) / sizeof(ia[0]) - 1;
glp_load_matrix(lp, iai, ia, ja, ar);
glp_iocp param;
glp_init_iocp(¶m);
param.presolve = GLP_ON;
if (glp_intopt(lp, ¶m) == 0 && glp_mip_status(lp) == GLP_OPT) {
double z = glp_mip_obj_val(lp);
}
}_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk