Thank you for your bug report.
Running glpsol 4.65 with the command:
glpsol --glp s.lp
indicates the following error:
[...]
OPTIMAL SOLUTION FOUND
Integer optimization begins...
glp_add_cols: ncs = 0; invalid number of columns
Error detected in file src/api/prob1.c at line 362
SIGABRT signal raised, execution terminated
Call traceback
func __abend, file ../c.lib/src/xabend.c, line 45
func raise, file ../c.lib/src/raise.c, line 76
func abort, file ../c.lib/src/abort.c, line 51
func errfunc, file src/env/error.c, line 55
func glp_add_cols, file src/api/prob1.c, line 362
func _glp_ios_create_pool, file src/draft/glpios01.c, line 1395
func _glp_ios_create_tree, file src/draft/glpios01.c, line 129
func solve_mip, file src/draft/glpapi09.c, line 244
func preprocess_and_solve_mip, file src/draft/glpapi09.c, line 415
func glp_intopt, file src/draft/glpapi09.c, line 634
func main, file examples/glpsol.c, line 1423
func __c0, file ../c.lib/src/woe/c0.c, line 58
End of traceback
Program abnormally terminated
From the call traceback it is seen that the internal routine
ios_create_pool attempts to add 0 columns that causes the error.
To fix the bug please modify the routine ios_create_pool (file
src/draft/glpios01.c, lines 1391-1397) as follows:
IOSPOOL *ios_create_pool(glp_tree *tree)
{ /* create cut pool */
IOSPOOL *pool;
pool = glp_create_prob();
#if 1 /* 14/VII-2020 */
if (tree->mip->n)
#endif
glp_add_cols(pool, tree->mip->n);
return pool;
}
Once the bug has been fixed, glpsol runs successfully:
[...]
OPTIMAL SOLUTION FOUND
Integer optimization begins...
Long-step dual simplex will be used
+ 0: mip = not found yet >= -inf (1; 0)
+ 0: >>>>> 0.000000000e+00 >= 0.000000000e+00 0.0% (1; 0)
+ 0: mip = 0.000000000e+00 >= tree is empty 0.0% (0; 1)
INTEGER OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.1 Mb (60952 bytes)
On Mon, 2020-07-13 at 14:25 +0100, Peter Cawley wrote:
Hi all,
The enclosed s.lp is solvable by GLPK 4.61:
-----
$ glpk-4.61/examples/glpsol --glp s.lp
GLPSOL: GLPK LP/MIP Solver, v4.61
Parameter(s) specified in the command line:
--glp s.lp
Reading problem data from 's.lp'...
81 rows, 48 columns, 168 non-zeros
48 integer variables, none of which are binary
331 lines were read
GLPK Integer Optimizer, v4.61
81 rows, 48 columns, 168 non-zeros
48 integer variables, none of which are binary
Preprocessing...
1 row, 0 columns, 0 non-zeros
0 integer variables, none of which are binary
Scaling...
A: min|aij| = 1.000e+00 max|aij| = 1.000e+00 ratio = 1.000e+00
Problem data seem to be well scaled
Solving LP relaxation...
GLPK Simplex Optimizer, v4.61
1 row, 0 columns, 0 non-zeros
~ 0: obj = 0.000000000e+00 infeas = 0.000e+00
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+ 0: mip = not found yet >= -inf (1; 0)
+ 0: >>>>> 0.000000000e+00 >= 0.000000000e+00 0.0% (1; 0)
+ 0: mip = 0.000000000e+00 >= tree is empty 0.0% (0; 1)
INTEGER OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.1 Mb (80560 bytes)
-----
But causes an internal failure with GLPK 4.65:
-----
$ glpk-4.65/examples/glpsol --glp s.lp
GLPSOL: GLPK LP/MIP Solver, v4.65
Parameter(s) specified in the command line:
--glp s.lp
Reading problem data from 's.lp'...
81 rows, 48 columns, 168 non-zeros
48 integer variables, none of which are binary
331 lines were read
GLPK Integer Optimizer, v4.65
81 rows, 48 columns, 168 non-zeros
48 integer variables, none of which are binary
Preprocessing...
1 row, 0 columns, 0 non-zeros
0 integer variables, none of which are binary
Scaling...
A: min|aij| = 1.000e+00 max|aij| = 1.000e+00 ratio = 1.000e+00
Problem data seem to be well scaled
Solving LP relaxation...
GLPK Simplex Optimizer, v4.65
1 row, 0 columns, 0 non-zeros
~ 0: obj = 0.000000000e+00 infeas = 0.000e+00
OPTIMAL SOLUTION FOUND
Integer optimization begins...
glp_add_cols: ncs = 0; invalid number of columns
Error detected in file api/prob1.c at line 362
Abort trap: 6
-----
According to LLDB, the call stack at the point of failure is:
-----
* frame #0: 0x00007fff570acb66
libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff57277080 libsystem_pthread.dylib`pthread_kill
+ 333
frame #2: 0x00007fff570081ae libsystem_c.dylib`abort + 127
frame #3: 0x0000000100105a7d
libglpk.40.dylib`errfunc(fmt=<unavailable>) at error.c:55 [opt]
frame #4: 0x00000001000c03c9
libglpk.40.dylib`glp_add_cols(lp=0x0000000100401b10, ncs=0) at
prob1.c:362 [opt]
frame #5: 0x00000001000eab84
libglpk.40.dylib`_glp_ios_create_tree [inlined]
_glp_ios_create_pool(tree=<unavailable>) at glpios01.c:1395 [opt]
frame #6: 0x00000001000eab6a
libglpk.40.dylib`_glp_ios_create_tree(mip=<unavailable>,
parm=0x00007ffeefbff608) at glpios01.c:129 [opt]
frame #7: 0x00000001000e3eda
libglpk.40.dylib`solve_mip(P=0x0000000100400f60,
parm=0x00007ffeefbff608, P0=0x0000000100400310,
npp=0x0000000100400080) at glpapi09.c:244 [opt]
frame #8: 0x00000001000e3d2c libglpk.40.dylib`glp_intopt
[inlined] preprocess_and_solve_mip(P=<unavailable>) at glpapi09.c:415
[opt]
frame #9: 0x00000001000e391a
libglpk.40.dylib`glp_intopt(P=<unavailable>, parm=0x0000000000000000)
at glpapi09.c:634 [opt]
frame #10: 0x00000001000031d4 glpsol`main(argc=<unavailable>,
argv=0x42773482f5d96a00) at glpsol.c:1423 [opt]
-----
Based on a very superficial understanding of the code, guarding the
`glp_add_cols(pool, tree->mip->n);` call within `ios_create_pool`
with `if (tree->mip->n)` seems to sidestep the failure, but perhaps a
more involved fix is required.
Regards,
Peter