initialize decision variables in GAMS in form of a set + equation gives errors

空扰寡人 提交于 2019-12-02 19:41:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!