help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] piecewise linear function


From: Giovanni Di Stasi
Subject: [Help-glpk] piecewise linear function
Date: Thu, 15 Feb 2018 21:10:23 +0100

I am trying to use such functions but I get a syntax error. 
In particular, this is my program, taken by the following book chapter:

https://ampl.com/BOOK/CHAPTERS/20-piecewise.pdf

set ORIG; # origins
set DEST; # destinations
param supply {ORIG} >= 0; # amounts available at origins
param demand {DEST} >= 0; # amounts required at destinations
check: sum {i in ORIG} supply[i] = sum {j in DEST} demand[j];
param rate1 {i in ORIG, j in DEST} >= 0;
param rate2 {i in ORIG, j in DEST} >= rate1[i,j];
param rate3 {i in ORIG, j in DEST} >= rate2[i,j];
param limit1 {i in ORIG, j in DEST} > 0;
param limit2 {i in ORIG, j in DEST} > limit1[i,j];
var Trans {ORIG,DEST} >= 0; # units to be shipped
minimize Total_Cost: sum {i in ORIG, j in DEST}
<<limit1[i,j], limit2[i,j];
rate1[i,j], rate2[i,j], rate3[i,j]>> Trans[i,j];
subject to Supply {i in ORIG}:
sum {j in DEST} Trans[i,j] = supply[i];
subject to Demand {j in DEST}:
sum {i in ORIG} Trans[i,j] = demand[j];


When I try to make glpk parse it, I get the following error:

glpsol --model glpk/Test --data /tmp/DATAg5ZQ0L -w /tmp/OUTXlm0ST
GLPSOL: GLPK LP/MIP Solver, v4.61
Parameter(s) specified in the command line:
 --model glpk/Test --data /tmp/DATAg5ZQ0L -w /tmp/OUTXlm0ST
Reading model section from glpk/Test...
glpk/Test:14: syntax error in _expression_
Context: ...>= 0 ; minimize Total_Cost : sum { i in ORIG , j in DEST } <
MathProg model processing error


I really have no clue as of now.

Thanks



reply via email to

[Prev in Thread] Current Thread [Next in Thread]