数学建模社区-数学中国
标题:
关于GAMS的问题,小弟询问咯??请大侠释义…………
[打印本页]
作者:
随墨枫飞
时间:
2013-5-30 13:16
标题:
关于GAMS的问题,小弟询问咯??请大侠释义…………
非常感谢亲!!请各位一定帮帮忙!!学期作业啊!!!
' w1 e$ U! t3 c- u* V! I0 [# q' u
我把程序贴在这,
/ K; b1 A! c K5 p9 k7 m; J
$Title A Investment Problem
* q4 P( P9 g& q5 ~$ Q# ]1 W$ q7 t! W
$ontext
# a. \% q+ Z! X( Y
this problem finds a optimized investment that meets
" ^8 ?8 B- {* e7 p7 J5 X5 X
requirements in the city
& s }1 y' v2 I& E7 ^' C5 K
$offtext
( J, r3 Z/ ?; s6 {; ]" n
Sets
( W& T. _9 w- |: F! j
i power plants /plant-1, plant-2, plant-3, plant-4/
2 H7 [" \1 t$ y5 B/ n8 \
j operating mode /mode-1, mode-2, mode-3/;
7 M' c6 t: w4 R; r: Q
Parameters
* Y' N) P0 u# W4 f7 S" ]% v
c(i) the unit installed capacity of power plant i in cases
4 F) @- U; a! F- y6 J- F8 T4 q5 g8 x
/plant-1 10
7 L" J1 W; z3 P7 P
plant-2 7
- B6 p1 _7 G- ^
plant-3 16
7 Y6 x p; Y4 d6 Y: D$ b) D4 B
plant-4 6/
2 I2 @3 \7 B! N( h& k
d(j) the electricity demand for power plant i in cases
; Q: W) G1 T, S
/mode-1 3
# Y% h4 X7 O7 D) @
mode-2 3
' S. I- ]8 r1 g
mode-3 2/;
: V4 k1 x* k0 Y5 Y2 I$ j
Table f(i,j) the unit operating cost of each power plant
# C. i5 m7 N* i* H
mode-1 mode-2 mode-3
4 C$ C' s, k; k* d" w- D5 P
plant-1 0.4 0.24 0.04
" I& U% H- [0 y# n! A
plant-2 0.45 0.27 0.045
' Z# @+ w/ c, X0 s
plant-3 0.32 0.192 0.032
- Y8 S: f; ?; ]6 g7 Q6 ^
plant-4 0.55 0.33 0.055;
" w9 H6 o# f5 P$ D6 j& m6 _
Scalar m the minimum total installed capacity of the four power plant /12/
0 ?6 C% i: ]. s" r# y$ ~- \, \
b the minimum tatal investment budget of the four power plant /120/;
1 C* X6 d, X# X( P' \
Variables
|( M" E1 \4 r& ?! L8 ~! E
x(i) the installed capacity of the i power plant in cases
% P) A r8 j6 m- V3 @& B
y(i,j) the operating lever of the i power plant under the j operating mode
0 m. P7 }8 e2 q0 K! x% }9 i u' O
z the total cost of the four power plant;
- s# T0 P4 U/ k; K
Positive Variable x;
' N3 i& e' n0 O
Equations
( K- L) N( I1 r" j( b0 u# w: y) Q2 m
cost define objective function
$ \- t2 {, A0 m/ ~
capacity1(i) observe total capacity linmit at plant i
/ O2 _3 A( o- {) }
budget(i) observe total investment budget limit at plant i
& k9 d: o; q. d
capacity2(i) observe installed capacity for each power plant
% n! p r3 ?4 } f) s4 t
demand(i) satisfy the electricity demand under each operating mode;
( b0 w; t1 e5 t' {3 ~& B6 i7 e! `
cost.. z =e= sum(i,c(i)*x(i))+sum((i,j),f(i,j)*y(i,j));
. u6 I ?5 g _8 ?2 e" ]
capacity1(i).. sum(i,x(i)) =g= m;
' V% E- x7 e$ A# V" g# @5 H: ]0 c
budget(i).. sum(i,c(i)*x(i)) =l= b;
; d+ H1 b6 u) t, n0 V
capacity2(j).. sum(j,y(i,j)) =l= x(i);
e/ P0 y1 q1 @( U' e
demand(i).. sum(i,y(i,j)) =g= d(j);
1 Q0 O! ?7 i+ N4 D- Z h
Model investment /all/;
7 Y4 x$ J' O* o- ^+ G; V9 S
Solve investment using lp minimizing z;
! L; U; ]3 }5 y2 e2 b5 A7 m
Display y.l, y.m;
! b% w j, g% \4 R5 v
1 R) k! o- Y: \9 M3 B! B" j
运行出错的,但是不知道怎么解决,请亲给处理一下哦!!!
欢迎光临 数学建模社区-数学中国 (http://www.madio.net/)
Powered by Discuz! X2.5