Page 1 of 1

about error 066

Posted: Mon Oct 08, 2018 10:32 am
by kankanertan
The symbol shown has not been defined or assigned
A wild shot:You may have spurious commas in the explanatory text of a declaration.
Check symbol reference list.


the error is in this sentence :'Solve GenUnitCom using lp minimizing z;'

but I have defined the symbol 'z', why the error is still there?

Thank you very much!

Re: about error 066

Posted: Mon Oct 08, 2018 10:46 am
by Renger
Hi
Well, then as Gams tells you, you might have forgotten a semicolon, or your 'z' is not defined as a variable, or not used in an equation.
Please send your code if this doesn't solve the issue.
Cheers
Renger

Re: about error 066

Posted: Mon Oct 08, 2018 10:50 am
by kankanertan
I have defined 'z' as a variable and use it in an equation

this is some of my code


variable z;

.
.
.

Cost.. z =e= sum( (i,t) , a(i) * p(i,t) );

I dont konw how to send all my code or send an image to you.I am sorry.

Re: about error 066

Posted: Mon Oct 08, 2018 10:52 am
by Renger
As Gams tells you there might be a semicolon forgotten somewhere in your code. I can't tell you where from the (correct) piece of code. Helpful would be to attach the whole model.
Cheers
Renger

Re: about error 066

Posted: Mon Oct 08, 2018 10:59 am
by kankanertan
This is all my code, I have checked it many times, Thank you very much for check it again!


set n /
$include NodeSet.inc
/;

set i /
$include GenSet.inc
/;


set j /
$include WindGenSet.inc
/;


set k /
$include LineSet.inc
/;


set l /
$include LoadSet.inc
/;


set t /
t1*t24
/;


set c /
c1*c5
/;




parameter KG(n, i) /
$include KG.inc
/;


parameter KWG(n, j) /
$include KWG.inc
/;


parameter KD(l, n) /
$include KD.inc
/;


parameter KL(k, n) /
$include KL.inc
/;

parameter KLT(k,n) /
$include KLT.inc
/;


parameter pMax(i) /
$include GenPMax.inc
/;


parameter pMin(i) /
$include GenPMin.inc
/;


parameter a(i) /
$include A.inc
/;


parameter injecto(j,t,c) /
$include inject.inc
/;


parameter X(k) /
$include X.inc
/;

parameter LMax(k) /
$include LMax.inc
/;


parameter LMin(k) /
$include LMin.inc
/;


parameter PrMIN(t) /
$include PrMIN.inc
/;


parameter PrMAX(t) /
$include PrMAX.inc
/;

parameter SU(i) /
$include SU.inc
/;


parameter SD(i) /
$include SD.inc
/;


parameter D(l,t) /
$include D.inc
/;

parameter p_0(i)
/1 100
2 200
3 100/ ;

parameter p0(i,t) ;

parameter inject(j,t);

parameter hdeta(i) /
$include hdeta.inc
/;

parameter ldeta(i) /
$include ldeta.inc
/;


parameter MaxdetaP(i)
/1 20
2 20
3 30/;

parameter MindetaP(i)
/1 -20
2 -20
3 -30/;

parameter pf(i,t,c);



variable p(i,t), Theta(n,t), f(k,t);

variable r(i,t);

Theta.fx('1',t) = 0;

variable z;

equations Cost, FlowEQ(n,t), LinePowerFlow(k,t);

equations MaxFlowO(k,t), MinFlowO(k,t);

equations Start(i,t),Stop(i,t),Start0(i,t),Stop0(i,t);

equations PPMAX(i,t), PPMIN(i,t);

equations PPRMIN(t), PPRMAX(i,t);

equations pcmax(i,t), pcmin(i,t);





Cost.. z =e= sum( (i,t) , a(i) * p(i,t) );

FlowEQ(n,t).. sum(i, KG(n, i) * p(i,t)) + sum(j, KWG(n,j) * inject(j,t)) =e= sum(k, KLT(k, n) * f(k,t)) + sum(l, KD(l,n) * D(l,t));

LinePowerFlow(k,t).. f(k,t) =e= X(k) * sum(n, KLT(k, n) * Theta(n,t));



PPMAX(i,t).. p(i,t) =l= pMax(i);

PPMIN(i,t).. p(i,t) =g= pMin(i);



MaxFlowO(k,t).. f(k,t) =l= LMax(k);

MinFlowO(k,t).. f(k,t) =g= LMin(k);



PPRMAX(i,t).. p(i,t)+ r(i,t) =l= pMax(i);

PPRMIN(t).. sum (i,r(i,t)) =g= PrMIN(t);


pcmax(i,t)..p(i,t) - p0(i,t) =l= MaxdetaP(i);
pcmin(i,t)..p(i,t) - p0(i,t) =g= MindetaP(i);




Start(i,t)$(ord(t)>1).. p(i,t) - p(i,t-1) =l= SU(i);
Start0(i,t)$(ord(t)=1).. p(i,t) - p_0(i) =l= SU(i);

Stop(i,t)$(ord(t)>1).. p(i,t-1) - p(i,t) =l= SD(i);
Stop0(i,t)$(ord(t)=1).. p_0(i) - p(i,t) =l= SD(i);


Model GenUnitCom /all/ ;

option lp=cplex;

option LimRow=1000;



loop
(
c,
inject(j,t) = injecto(j,t,c);

Solve GenUnitCom using lp minimizing z;

p0(i,t) = p.l(i,t);

pf(i,t,c) = p.l(i,t);
);

display Theta.l;



$title BMatrix(n, n)$Linen(k, n, n) = 1 / LineX(k);

Re: about error 066

Posted: Mon Oct 08, 2018 11:31 am
by Renger
There migt be a problem with one of the include files.
Try the following: put a $exit after the equation with z, remove the inclusion of a and define it manually e.g. a(i) = random(0,10);
If the problem still exists, do the same for the other include files.
Cheers
Renger

Re: about error 066

Posted: Mon Oct 08, 2018 12:07 pm
by kankanertan
Thank you very much, I'll try!