On Tue, 2021-01-26 at 16:12 +0100, Domingo Alvarez Duarte wrote: > Where is GLPK 6.0 available ?
Sorry, I meant 5.0 :) > > It's the first time I hear of it, and it's not available at > https://ftp.gnu.org/gnu/glpk/ . > > On 26/1/21 15:57, Andrew Makhorin wrote: > > On Tue, 2021-01-26 at 13:33 +0100, Domingo Alvarez Duarte wrote: > > > It seems to be a cplex OPL format. > > > After manually convert it to GMPL (see bellow) I'm getting a > > > segfault > > > > This bug has been fixed in glpk 6.0. > > > > FYI: https://lists.gnu.org/archive/html/bug-glpk/2020-07/msg00009.ht > > ml > > > > > > > > > > > with ubuntu 18.04 glpk distribution: > > > ==== > > > glpsol -m cplex2mpl.mod > > > GLPSOL: GLPK LP/MIP Solver, v4.65 > > > Parameter(s) specified in the command line: > > > -m cplex2mpl.mod > > > Reading model section from cplex2mpl.mod... > > > Reading data section from cplex2mpl.mod... > > > 73 lines were read > > > Generating result... > > > Generating cstTemps... > > > Generating cstPlanches... > > > Model has been successfully generated > > > GLPK Integer Optimizer, v4.65 > > > 3 rows, 5 columns, 15 non-zeros > > > 5 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 = 1.491000000e+02 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 > > > Aborted (core dumped) > > > ==== > > > But with my fork at https://github.com/mingodad/GLPK it seems to > > > work: > > > ==== > > > glpsol5 -m cplex2mpl.mod > > > GLPSOL: GLPK LP/MIP Solver, v4.65, glp_double size 8 > > > Parameter(s) specified in the command line: > > > -m cplex2mpl.mod > > > Reading model section from cplex2mpl.mod... > > > 73 lines were read > > > 73 lines were read > > > Generating result... > > > Generating cstTemps... > > > Generating cstPlanches... > > > Model has been successfully generated > > > GLPK Integer Optimizer, v4.65 > > > 3 rows, 5 columns, 15 non-zeros > > > 5 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 = 1.491000000e+02 infeas = 0.000e+00 > > > OPTIMAL SOLUTION FOUND > > > Integer optimization begins... > > > Long-step dual simplex will be used > > > + 0: mip = not found yet <= +inf (1; > > > 0) > > > + 0: >>>>> 1.491000000e+02 <= 1.491000000e+02 0.0% (1; > > > 0) > > > + 0: mip = 1.491000000e+02 <= tree is empty 0.0% (0; > > > 1) > > > INTEGER OPTIMAL SOLUTION FOUND > > > Time used: 0.0 secs > > > Memory used: 0.1 Mb (118279 bytes) > > > Il faut fabriquer : > > > 1.000000 objet(s) 1 > > > 1.000000 objet(s) 2 > > > 1.000000 objet(s) 3 > > > 1.000000 objet(s) 4 > > > 1.000000 objet(s) 5 > > > Il faut fabriquer :149.100000 > > > Model has been successfully processed > > > ==== > > > Manually converting to GMPL could be something like this: > > > ==== > > > param N integer; > > > param D; > > > param dureeJournee integer; > > > param planchesJournee integer; > > > set objets := {1..N}; > > > param planches{objets} integer; > > > param duree{i in objets} := planches[i] / D; > > > param profit{objets}; > > > > > > var aFabriquer{objets} , >= 1, integer; > > > > > > maximize result: sum{o in objets} profit[o]*aFabriquer[o]; > > > > > > s.t. cstTemps: sum{o in objets} duree[o]*aFabriquer[o] <= > > > dureeJournee; > > > cstPlanches: sum{o in objets} planches[o]*aFabriquer[o] <= > > > planchesJournee; > > > # une contrainte en plus: chaque objet est au moins fabriqu´e en 1 > > > exemplaire > > > #auMoins1: forall(o in objets) aFabriquer[o] >= 1; > > > > > > solve; > > > > > > #display duree, planches, profit; > > > printf "Il faut fabriquer :\n"; > > > printf{i in objets} "%f objet(s) %d\n", aFabriquer[i], i; > > > printf "Il faut fabriquer :%f\n", result; > > > > > > data; > > > > > > param N := 5; > > > param D := 3.4; > > > param dureeJournee := 8; > > > param planchesJournee := 40; > > > param planches := 1 4, 2 5, 3 8, 4 3, 5 7; > > > param profit := 1 12.6, 2 45.0, 3 8.0, 4 76.0, 5 7.5; > > > > > > end; > > > ==== > > > On 26/1/21 12:00, Andrew Makhorin wrote: > > > > -------- Forwarded Message -------- > > > > From: Alexandre Garreau <galex-...@galex-713.eu> > > > > To: help-glpk@gnu.org > > > > Subject: What is this format? > > > > Date: Tue, 26 Jan 2021 11:46:03 +0100 > > > > > > > > Hello, > > > > > > > > In my university, they use cplex for teaching linear > > > > programming, > > > > and > > > > I’d > > > > like not to install anything proprietary on my computer, but I > > > > have > > > > to > > > > figure out how to deal with the files given while only doc for > > > > cplex, > > > > which > > > > I don’t have and never used… Do you know what format this is? > > > > it > > > > uses > > > > “.mod” as an extension, apparently that’s what glpk uses for its > > > > own > > > > format… but in this case, it’s not isn’t it? I thought maybe > > > > free > > > > mps, > > > > but > > > > reading it with --freemps doesn’t work either. Here I attach a > > > > sample > > > > file, with the various errors I get: > > > > > > > > $ glpsol --freemps charpentier1.mod > > > > GLPSOL: GLPK LP/MIP Solver, v4.65 > > > > Parameter(s) specified in the command line: > > > > --freemps charpentier1.mod > > > > Reading problem data from 'charpentier1.mod'... > > > > charpentier1.mod:1: invalid indicator record > > > > MPS file processing error > > > > $ glpsol --glp charpentier1.mod > > > > GLPSOL: GLPK LP/MIP Solver, v4.65 > > > > Parameter(s) specified in the command line: > > > > --glp charpentier1.mod > > > > Reading problem data from 'charpentier1.mod'... > > > > charpentier1.mod:1: error: line designator missing or invalid > > > > GLPK LP/MIP file processing error > > > > $ glpsol --math charpentier1.mod > > > > GLPSOL: GLPK LP/MIP Solver, v4.65 > > > > Parameter(s) specified in the command line: > > > > --math charpentier1.mod > > > > Reading model section from charpentier1.mod... > > > > charpentier1.mod:1: syntax error in model section > > > > Context: > > > > / > > > > MathProg model processing error > > > > $ glpsol --lp charpentier1.mod > > > > GLPSOL: GLPK LP/MIP Solver, v4.65 > > > > Parameter(s) specified in the command line: > > > > --lp charpentier1.mod > > > > Reading problem data from 'charpentier1.mod'... > > > > charpentier1.mod:1: 'minimize' or 'maximize' keyword missing > > > > CPLEX LP file processing error > > > > $ glpsol --freemps -m charpentier1.mod > > > > GLPSOL: GLPK LP/MIP Solver, v4.65 > > > > Parameter(s) specified in the command line: > > > > --freemps -m charpentier1.mod > > > > Reading model section from charpentier1.mod... > > > > charpentier1.mod:1: syntax error in model section > > > > Context: > > > > / > > > > MathProg model processing error > > > > $ glpsol --glp -m charpentier1.mod > > > > GLPSOL: GLPK LP/MIP Solver, v4.65 > > > > Parameter(s) specified in the command line: > > > > --glp -m charpentier1.mod > > > > Reading model section from charpentier1.mod... > > > > charpentier1.mod:1: syntax error in model section > > > > Context: > > > > / > > > > MathProg model processing error > > > > $ glpsol --math -m charpentier1.mod > > > > GLPSOL: GLPK LP/MIP Solver, v4.65 > > > > Parameter(s) specified in the command line: > > > > --math -m charpentier1.mod > > > > Reading model section from charpentier1.mod... > > > > charpentier1.mod:1: syntax error in model section > > > > Context: > > > > / > > > > MathProg model processing error > > > > $ glpsol --lp -m charpentier1.mod > > > > GLPSOL: GLPK LP/MIP Solver, v4.65 > > > > Parameter(s) specified in the command line: > > > > --lp -m charpentier1.mod > > > > Reading model section from charpentier1.mod... > > > > charpentier1.mod:1: syntax error in model section > > > > Context: > > > > / > > > > MathProg model processing error > >