Re: glpsol will not handle example

2023-11-12 Thread Michael Hennebry

On Sun, 12 Nov 2023, Chris Matrakidis wrote:


You need --math instead of --glp.


Thanks.
I figured it would be a duh moment.
I'd mistaken GLPK format for GMPL format.

--
Michael   henne...@mail.cs.ndsu.nodak.edu
"I was just thinking about the life of a pumpkin.  Grow up in the sun,
happily entwined with others, and then someone comes along,
cuts you open, and rips your guts out."  --   Buffy



Re: glpsol will not handle example

2023-11-12 Thread Chris Matrakidis
You need --math instead of --glp.

Best Regards,

Chris Matrakidis


Virus-free.www.avg.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sun, 12 Nov 2023 at 21:08, Michael Hennebry
 wrote:
>
> From the glpk manual, I copied example E.1 to ex1.gmpl .
> glpsol did not like it:
> [hennebry@fedora triangle-free]$ glpsol --glp ex1.gmpl
> GLPSOL--GLPK LP/MIP Solver 5.0
> Parameter(s) specified in the command line:
>   --glp ex1.gmpl
> Reading problem data from 'ex1.gmpl'...
> ex1.gmpl:1: error: problem line missing or invalid
> GLPK LP/MIP file processing error
> [hennebry@fedora triangle-free]$
>
> Here is ex1.gmpl:
> # A TRANSPORTATION PROBLEM
> #
> # This problem finds a least cost shipping schedule that meets
> # requirements at markets and supplies at factories.
> #
> # References:
> #
> Dantzig G B, "Linear Programming and Extensions."
> #
> Princeton University Press, Princeton, New Jersey, 1963,
> #
> Chapter 3-3.
> set I;
> /* canning plants */
> set J;
> /* markets */
> param a{i in I};
> /* capacity of plant i in cases */
> param b{j in J};
> /* demand at market j in cases */
> param d{i in I, j in J};
> /* distance in thousands of miles */
>
> param f;
> /* freight in dollars per case per thousand miles */
> param c{i in I, j in J} := f * d[i,j] / 1000;
> /* transport cost in thousands of dollars per case */
> var x{i in I, j in J} >= 0;
> /* shipment quantities in cases */
> minimize cost: sum{i in I, j in J} c[i,j] * x[i,j];
> /* total transportation costs in thousands of dollars */
> s.t. supply{i in I}: sum{j in J} x[i,j] <= a[i];
> /* observe supply limit at plant i */
> s.t. demand{j in J}: sum{i in I} x[i,j] >= b[j];
> /* satisfy demand at market j */
> data;
>
> set I := Seattle San-Diego;
> set J := New-York Chicago Topeka;
> param a := Seattle
> San-Diego350
> 600;
> param b := New-York
> Chicago
> Topeka325
> 300
> 275;
> param d :New-York
> 2.5
> 2.5
> Seattle
> San-Diego
> Chicago
> 1.7
> 1.8
> param f := 90;
> end;
>
> What is going on and what can I do about it?
>
> --
> Michael   henne...@mail.cs.ndsu.nodak.edu
> "I was just thinking about the life of a pumpkin.  Grow up in the sun,
> happily entwined with others, and then someone comes along,
> cuts you open, and rips your guts out."  --   Buffy
>



glpsol will not handle example

2023-11-12 Thread Michael Hennebry

From the glpk manual, I copied example E.1 to ex1.gmpl .

glpsol did not like it:
[hennebry@fedora triangle-free]$ glpsol --glp ex1.gmpl
GLPSOL--GLPK LP/MIP Solver 5.0
Parameter(s) specified in the command line:
 --glp ex1.gmpl
Reading problem data from 'ex1.gmpl'...
ex1.gmpl:1: error: problem line missing or invalid
GLPK LP/MIP file processing error
[hennebry@fedora triangle-free]$

Here is ex1.gmpl:
# A TRANSPORTATION PROBLEM
#
# This problem finds a least cost shipping schedule that meets
# requirements at markets and supplies at factories.
#
# References:
#
Dantzig G B, "Linear Programming and Extensions."
#
Princeton University Press, Princeton, New Jersey, 1963,
#
Chapter 3-3.
set I;
/* canning plants */
set J;
/* markets */
param a{i in I};
/* capacity of plant i in cases */
param b{j in J};
/* demand at market j in cases */
param d{i in I, j in J};
/* distance in thousands of miles */

param f;
/* freight in dollars per case per thousand miles */
param c{i in I, j in J} := f * d[i,j] / 1000;
/* transport cost in thousands of dollars per case */
var x{i in I, j in J} >= 0;
/* shipment quantities in cases */
minimize cost: sum{i in I, j in J} c[i,j] * x[i,j];
/* total transportation costs in thousands of dollars */
s.t. supply{i in I}: sum{j in J} x[i,j] <= a[i];
/* observe supply limit at plant i */
s.t. demand{j in J}: sum{i in I} x[i,j] >= b[j];
/* satisfy demand at market j */
data;

set I := Seattle San-Diego;
set J := New-York Chicago Topeka;
param a := Seattle
San-Diego350
600;
param b := New-York
Chicago
Topeka325
300
275;
param d :New-York
2.5
2.5
Seattle
San-Diego
Chicago
1.7
1.8
param f := 90;
end;

What is going on and what can I do about it?

--
Michael   henne...@mail.cs.ndsu.nodak.edu
"I was just thinking about the life of a pumpkin.  Grow up in the sun,
happily entwined with others, and then someone comes along,
cuts you open, and rips your guts out."  --   Buffy