Thanks a lot Xypron! actually I hacked a bit the code in glptsp.c and I use it as a c function to create a csv file from a TSPLIB file and then I called your .mod file to solve TSPs from the same c program (and produce also a graphical output).
However, the solutions I get from your model are not feasible tours ... well, maybe I did something wrong, but are you sure that your model works to enforce the creation of feasible tours? i didn't have time to go into the details of your model actually. I also used the model proposed in: http://archive.ite.journal.informs.org/Vol7No1/LeeRaffensperger/ and it seems to work (well, I tested it for small instances, less tan 100 cities) Best regards, ikarus xypron wrote: > > Hi, > > tsp_read_data() is not part of the documented API (see doc/glpk.pdf). > > For teaching purposes a good idea would be to provide the example as a CSV > file > and read it with command "table IN" inside a gmpl model (see > doc/tables.pdf). > > Only a few changes to examples/tsp.mod are needed: > http://www.nabble.com/file/p25670352/tsp.zip tsp.zip > > How to output a SVG graphic from glpsol is shown in > http://www.nabble.com/file/p21151721/tsp_svg.tar.gz tsp_svg.tar.gz > > Best regards, > > Xypron > > > ikarus wrote: >> >> Hi, >> I saw that glpk's distribution includes glptsp.c and glptsp.h (that look >> undocumented, by the way). These files seem to provide only routines to >> read data from a TSPLIB file and to compute the distance between two >> cities. How can I use these in combination with the other functions >> included in glpk to actually solve a tsp instance? >> >> I would like to do something like: >> >> TSP *tsp = tsp_read_data("berlin52.tsp"); >> glp_intopt(tsp, some_params); >> >> but clearly glp_intopt needs another type of data as problem descriptor >> ... >> Is there any way to do something similar? >> ... or a script to convert the TSPLIB format in GMLP? >> (by the way, I know that glpk is not a good option to solve large TSP >> instances, but I need it for teaching purposes) >> >> Thanks! >> > > -- View this message in context: http://www.nabble.com/How-can-I-use-functions-in-glptsp.c-to-solve-TSPs-using-glpk--tp25666405p25673312.html Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com. _______________________________________________ Help-glpk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-glpk
