Hello all,
I have recently write a very very simple code in Gams. it works but it produces the zero answer.
I have atttached my code and the related ecxcel data! I enter my input data from excel. this code has to minimiza the cost ( P(j,h)*price(j,h)) in ordet to satisfy the L(i,h)=c(i,j,h)*P(j,h)
Would you please tell me whre is the rpblem actually this is a part of bigger program. i want to run this and then I can complete it.
PLEASE HELP!
I have also bring my code to the following:
set m demand/
$call =xls2gms r=sheet1!b1:c1 i=net_hub.xlsx s=“,” o=“setm.inc”
$include setm.inc
/;
set h hour/
$call =xls2gms r=sheet1!a2:a25 i=net_hub.xlsx o=“seth.inc”
$include seth.inc
/;
set i shomarande/1*2/;
set j shomarande/1*4/;
PARAMETERS
demand1_elec(h) electric demand
/
$call =xls2gms r=sheet1!a2:b25 i=net_hub.xlsx o=“pard1.inc”
$include pard1.inc
/ ;
PARAMETERS
demand1_heat(h) heat demand
/
$call =xls2gms r=sheet6!a2:b25 i=net_hub.xlsx o=“pard6.inc”
$include pard6.inc
/ ;
PARAMETERS
table demand2(h,m) demand
$call =xls2gms r=sheet2!a1:c25 i=net_hub.xlsx o=“pard2.inc”
$include pard2.inc
;
PARAMETERS
price_elec(h) electric demand
/
$call =xls2gms r=sheet3!a2:b25 i=net_hub.xlsx o=“pard3.inc”
$include pard3.inc
/ ;
PARAMETERS
price_gas(h) heat demand
/
$call =xls2gms r=sheet4!a2:b25 i=net_hub.xlsx o=“pard4.inc”
$include pard4.inc
/ ;
PARAMETERS
price_heat(h) heat demand
/
$call =xls2gms r=sheet5!a2:b25 i=net_hub.xlsx o=“pard5.inc”
$include pard5.inc
/ ;
PARAMETERS
price_sell_elec(h) heat demand
/
$call =xls2gms r=sheet7!a2:b25 i=net_hub.xlsx o=“pard7.inc”
$include pard7.inc
/ ;
parameter
L1(i,h) " demand be surate matrix"
;
L1(‘1’,h)= demand1_elec(h) ;
L1(‘2’,h)= demand1_heat(h) ;
parameter
price(j,h) " demand be surate matrix"
;
price(‘1’,h)= price_elec(h) ;
price(‘2’,h)= price_gas(h) ;
price(‘3’,h)= price_heat(h) ;
parameter
price_sell(i,h) " demand be surate matrix"
;
price_sell(‘1’,h)= price_sell_elec(h) ;
price_sell(‘2’,h)= price_heat(h) ;
table
c1(i,j) " etaa haye marbut be technlogy"
1 2 3
1 0.9 .1 0
2 0 0.85 0.7
;
Parameters
p_max(j) /1 5
2 7
3 4
/
p_min(j) /1 0
2 0
3 0
/ ;
display p_max
display p_min
VARIABLES
Z energy cost
;
Positive VARIABLES
cost_f(h)
*income(h)
p1(j,h)
tech(i,j,h)
L(i,h)
;
EQUATIONS
COST “total cost”
Load(i,h) " demand"
technology(i,j,h)
cost_flow(h)
;
cost… z=e=sum(h, cost_f(h));
cost_flow(h)… cost_f(h)=e=sum(j,p1(j,h)*price(j,h)) ;
Load(i,h)… L(i,h)=e= sum(j,c1(i,j)*P1(j,h));
technology(i,j,h)… c1(i,j)*P1(j,h)=e=tech(i,j,h);
tech.up(i,j,h)=p_max(j);
tech.lo(i,j,h)=p_min(j) ;
MODEL thesis4 /ALL/;
SOLVE thesis4 using lp minimizing z ;
display z.l;
display c1
display p1.l
–
net_hub.xlsx (15.6 KB)
Untitled_31.gms (2.55 KB)