各位前辈好,我最近在研习GAMS软件。从GAMS官网上下载了GAMS windows64 24.2版本,然后根据几乎所有的GAMS教材入门使用的那个运输案例编码:
Sets
i canning plants / seattle, san-diego /
j markets / new-york, chicago, topeka / ;
Parameters
a(i) capacity of plant i in cases
/ seattle 350
san-diego 600 /
b(j) demand at market j in cases
/ new-york 325
chicago 300
topeka 275 / ;
Table d(i, j) distance in thousands of miles
new-york chicago topeka
seattle 2.5 1.7 1.8
san-diego 2.5 1.8 1.4 ;
Scalar f freight in dollars per case per thousand miles /90/ ;
Parameter c(i, j) transport cost in thousands of dollars per case ;
c(i, j) = f * d(i, j) / 1000 ;
Variables
x(i, j) shipment quantities in cases
z total transportation costs in thousands of dollars ;
Positive Variable x ;
Equations
cost define objective function
supply(i) observe supply limit at plant i
demand(j) satisfy demand at market j ;
cost.. z = e = sum((i, j), c(i, j)*x(i, j)) ;
supply(i).. sum(j, x(i, j)) = l = a(i) ;
demand(j).. sum(i, x(i, j)) = g = b(j) ;
Model transport /all/ ;
Solve transport using lp minimizing z ;
Display x. l, x. m ;
输入,但是得出的结果与书上不一样,显示“erro"具体内容为:
25 supply(i) observe supply limit at plant i
26 demand(j) satisfy demand at market j ;
27 cost.. z = e = sum((i, j), c(i, j)*x(i, j)) ;
**** $140,37,409
28 supply(i).. sum(j, x(i, j)) = l = a(i) ;
**** $140,37,409
29 demand(j).. sum(i, x(i, j)) = g = b(j) ;
**** $140,37,409
30 Model transport /all/ ;
31 Solve transport using lp minimizing z ;
**** $257
32 Display x. l, x. m ;
**** $342,329,141,409,342
GAMS 24.2.3 r46072 Released May 22, 2014 WEX-WEI x86_64/MS Windows 07/23/14 14:30:02 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Error Messages
37 '=l=' or '=e=' or '=g=' operator expected
140 Unknown symbol
141 Symbol neither initialized nor assigned
A wild shot: You may have spurious commas in the explanatory
text of a declaration. Check symbol reference list.
257 Solve statement not checked because of previous errors
329 Wrong suffix on variable reference - allowable are
l level (activity)
m marginal (reduced cost)
lo lower bound
up upper bound
scale variable scale
prior priority for MIP
slacklo,slackup,slack, slack values
infeas infeasibility
342 Illegal suffix syntax - has to start with a letter
409 Unrecognizable item - skip to find a new statement
looking for a ';' or a key word to get started again
**** 15 ERROR(S) 0 WARNING(S)
COMPILATION TIME = 0.125 SECONDS 3 MB 24.2.3 r46072 WEX-WEI
USER: GAMS Development Corporation, Washington, DC G871201/0000CA-ANY
Free Demo, 202-342-0180, sales@gams.com, www.gams.com DC0000
**** FILE SUMMARY
Input C:\Users\1\Documents\gamsdir\projdir\Untitled_2.gms
Output C:\Users\1\Documents\gamsdir\projdir\Untitled_2.lst
**** USER ERROR(S) ENCOUNTERED
我想请大家帮帮忙,帮我看看究竟是哪里出了问题?谢谢!


雷达卡




京公网安备 11010802022788号







