On Wed, 2018-07-11 at 08:33 +0100, Miguel wrote: > Good morning, > > I copy-pasted your code into the attached text files (test.mod and > test.csv), ran it, and got another error, which I do not understand: > > > glpsol --math -m test.mod -d test.csv > GLPSOL: GLPK LP/MIP Solver, v4.65 > Parameter(s) specified in the command line: > --math -m test.mod -d test.csv > Reading model section from test.mod... > test.mod:9: warning: data section ignored > 9 lines were read > Reading data section from test.csv... > test.csv:1: syntax error in data section > Context: FROM > MathProg model processing error > > So I cannot the difference between your code and mine that is giving > me this error.
You should *not* specify "-d test.csv", because test.csv is *not* a data section--it is a data table: GLPSOL: GLPK LP/MIP Solver, v4.65 Parameter(s) specified in the command line: -m test.mod --check Reading model section from test.mod... Reading data section from test.mod... 13 lines were read Reading data... Display statement at line 7 d[Seattle,New-York] = 2.5 d[Seattle,Chicago] = 1.7 d[Seattle,Topeka] = 1.8 d[San-Diego,New-York] = 2.5 d[San-Diego,Chicago] = 1.8 d[San-Diego,Topeka] = 1.4 Model has been successfully generated --- Problem Characteristics --- Number of rows = 0 Number of columns = 0 Number of non-zeros (matrix) = 0 Number of non-zeros (objrow) = 0 > Therefore I also attach the linear program where I first found this > bug in lp.mod with three dummy data files, two files that depend on > one set each and one file that depends on both sets. The model throws > this error: > > > glpsol --math -m lp.mod > GLPSOL: GLPK LP/MIP Solver, v4.65 > Parameter(s) specified in the command line: > --math -m lp.mod > Reading model section from lp.mod... > lp.mod:20: delimiter <- missing where expected > Context: ..., u in unicodes } >= 0 ; table data IN '...' '...' : words ~ > MathProg model processing error > > If I comment version 1 in lines 19-20 and uncomment version 2 in lines 25-27, > it all works. > > Finally, could I suggest adding a line in pages 42-44 of the Modeling > Language GNU MathProg Language Reference to the effect of > "Before asking for a table OUT, make sure that you solve the model with > `solve;`. Otherwise the solve command will be invoked at the end of the > model, GLPK will try to write the table before solving the model and you may > get an error such as > Assertion failed: out != out > Error detected in file mpl/mpl3.c at line 5072 > Abort trap: 6" > > You can see this error if you comment version 1, uncomment version 2, and > uncomment line 43. I spent a few hours yesterday grappling with this issue, > found no references to it on the internet, then solved it and posted it here: > https://stackoverflow.com/questions/51274858/getting-a-table-out-of-a-glpk-solution-throws-error-assertion-failed-out-ou > > Regards, > > Miguel Morin > > > > > On Jul 10, 2018, at 11:23 PM, Andrew Makhorin <m...@gnu.org> wrote: > > > > On Tue, 2018-07-10 at 16:15 +0100, Miguel wrote: > >> Good morning, > >> > >> I have been using GLPK with great satisfaction and success. > >> Congratulations on the good job! > >> > >> I found a bug in GNU MathProg and read in one of the documents that this > >> is the email to report it to. Page 42 of the GNU MathProg reference > >> mentions > >> > >> "set is the name of an optional simple set called control set. It can be > >> omitted along with the delimiter <-;" > >> > >> It turns out that this set and the delimiter are mandatory, otherwise I > >> get the error: > >> delimiter <- missing where expected > >> > >> I posted on StackOverflow and no one answered, so I assume few people came > >> across this issue: > >> https://stackoverflow.com/questions/51231741/how-to-read-in-table-that-depends-on-two-sets-previously-defined/51268717#51268717 > >> > >> I found a workaround, so fixing this bug is not urgent. > >> > >> Regards, > >> > >> Miguel Morin > >> > >> > >> > >> > > > > Thank you for your bug report. > > > > However I see no bug. The following example works for me: > > > > ---test.mod--- > > set V; > > > > param d{V, V}; > > > > table data IN "CSV" "test.csv": [FROM, TO], d~DISTANCE; > > > > display d; > > > > data; > > > > set V := Seattle San-Diego New-York Chicago Topeka; > > > > end; > > > > ---test.csv--- > > FROM,TO,DISTANCE,COST > > Seattle,New-York,2.5,0.12 > > Seattle,Chicago,1.7,0.08 > > Seattle,Topeka,1.8,0.09 > > San-Diego,New-York,2.5,0.15 > > San-Diego,Chicago,1.8,0.10 > > San-Diego,Topeka,1.4,0.07 > > > > > > > > Andrew Makhorin > > > > > _______________________________________________ Bug-glpk mailing list Bug-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/bug-glpk