随墨枫飞 发表于 2013-5-30 13:16

关于GAMS的问题,小弟询问咯??请大侠释义…………

非常感谢亲!!请各位一定帮帮忙!!学期作业啊!!!
我把程序贴在这,
$Title A Investment Problem
$ontext
this problem finds a optimized investment that meets
requirements in the city
$offtext
Sets
    i  power plants  /plant-1, plant-2, plant-3, plant-4/
    j  operating mode  /mode-1, mode-2, mode-3/;
Parameters
    c(i)  the unit installed capacity of power plant i in cases
       /plant-1  10
        plant-2  7
        plant-3  16
        plant-4  6/
    d(j)  the electricity demand for power plant i in cases
       /mode-1  3
        mode-2  3
        mode-3  2/;
Table f(i,j) the unit operating cost of each power plant
                 mode-1   mode-2   mode-3
        plant-1   0.4      0.24     0.04
        plant-2   0.45     0.27     0.045
        plant-3   0.32     0.192    0.032
        plant-4   0.55     0.33     0.055;
Scalar m the minimum total installed capacity of the four power plant /12/
       b the minimum tatal investment budget of the four power plant /120/;
Variables
       x(i) the installed capacity of the i power plant in cases
       y(i,j) the operating lever of the i power plant under the j operating mode
       z the total cost of the four power plant;
Positive Variable x;
Equations
       cost           define objective function
       capacity1(i)   observe total capacity linmit at plant i
       budget(i)      observe total investment budget limit at plant i
       capacity2(i)   observe installed capacity for each power plant
       demand(i)      satisfy the electricity demand under each operating mode;
cost..            z =e= sum(i,c(i)*x(i))+sum((i,j),f(i,j)*y(i,j));
capacity1(i)..    sum(i,x(i)) =g= m;
budget(i)..       sum(i,c(i)*x(i)) =l= b;
capacity2(j)..    sum(j,y(i,j)) =l= x(i);
demand(i)..       sum(i,y(i,j)) =g= d(j);
Model investment /all/;
Solve investment using lp minimizing z;
Display y.l, y.m;

运行出错的,但是不知道怎么解决,请亲给处理一下哦!!!
页: [1]
查看完整版本: 关于GAMS的问题,小弟询问咯??请大侠释义…………