piecewise linear function
Giovanni Di Stasi <[email protected]>
| Newsgroups | gmane.comp.gnu.glpk |
|---|---|
| Message-ID | <CAMeU5JonewzcYfa_mgnjgEdeB0rs+3XEj6spPm6uvH0eVyBP5A@mail.gmail.com> |
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
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk