问题
I am trying to model a problem using GAMS. I have 2 questions:
1) How to initialize the decesion value P? it supose to be in the following form
P(I)/
i1 25
i2 33 /
2) I am trying to calculate SINR as in
SINR(I) =e= hh(I)*P(I) / sqr(sigma)+sum(I,H(J,I)*P(I));
However, I got always an erro either the set is already controller or domain isssues. How can I solve this problem?
Part of the CODE
set
I number of users /i1,i2/
J users to interfer with /j1,j2/
iteration number of iterations /1/ ;
Parameters
CP(I) circuit power per user / i1 10 i2 10 / hh(I) channel quality / i1 48 i2 106 / Sigma Noise /0.0057/ tol tolerence value /0.01/ minRate minimum rate /0.1/ maxiter max number of iterations /3/ ;
Table H(J,I) interference value
> i1 i2
>
> j1 0 18.8030
>
> j2 8.9555 0
; >
Variables
P(I) F lambda SINR(I) b(I) a(I)
equations Objectivefun, SINRFUN, lambdaFUN, RateFUN, afun, bfun, nonlconfun;
SINRFUN(I).. SINR(I) =e= hh(I)*P(I) / sqr(sigma)+sum(I,H(J,I)*P(I));
Thank you in advance.
回答1:
The statement
SINRFUN(I).. SINR(I) =e= hh(I)*P(I) / sqr(sigma)+sum(I,H(J,I)*P(I));
has a problem we have an implicit loop over i
and then inside a sum over the same i
. This is mathematically not very well defined. So you could do something like:
alias(i,ii);
SINRFUN(I).. SINR(I) =e= hh(I)*P(I) / sqr(sigma)+sum(ii,H(J,ii)*P(ii));
You can initialize P(i)
with an assignment statement:
parameter initp(i) /i1 25, i2 33/;
p.L(i) = initp(i);
The .L
means we assign to the level values of the variables (other possibilities are things like.lo
, .up
, .m
: see the documentation for more information -- reading some docs may be beneficial in any case).
来源:https://stackoverflow.com/questions/37395407/initialize-decision-variables-in-gams-in-form-of-a-set-equation-gives-errors