Dear All,
I am new to GAMS, and I am not sure how to overcome this problem, I
have searched a lot, and would be really appreciate any help:
What I am trying to do ultimately is to maximize mttfTest, where:
(this is not GAMS syntax)
mttfTest = sum [ from i = 1 to Nq , i * (Rq ** i) * (1 -
Rq) ] , in other words, i * (Rq ** i) * (1 - Rq) is
performed for index i which takes on values from 1 to Nq, and all
results are summed.
I wasn’t sure how to model the iterations from 1 to Nq so I attempted
to do it through creating a set J which has [1 to Nq] elements, and
iterated the equation over J (you can see this in the code below),
this is not working, as Nq is a variable which gets its value from an
equation, and I get this error → " Could not extract number in
- list" .
I am not sure if I have modeled the eMttf equation below (in code) to
match the logic of the equation above, I cannot seem to use the Nq
value to subsequently find the mttfTest
This is part of the code, if needed I can include the full code:
Thanks in advance,
Hamid
Variables
ms(s)
mp(s)
Rq
Eq
Nq
mttfTest ;
Binary variable ms(s);
Binary variable mp(s);
Equations eEq
eRq
eRqConstraint
eNq
eDisjoint
eMttf ;
eEq… Eq =e= sum(s, ep(s)*mp(s)) + sum(s, es(s)*ms(s)) +
ech;
eRq… Rq =e= (1 - prod(s, (1 - ms(s) + qfs(s)*ms(s)) )) * (1
- prod(s, (1 - mp(s) + qfp(s)*mp(s)) ));
eRqConstraint… rreq =l= Rq;
-
the Nq variable below is need for eMttf equation
eNq… Nq =e= ceil(hqeon/(hq*Eq + Ec/Tc)); -
line below produces error " Could not extract number in
-
list"
SET J / 1 * Nq/; -
This is the objective function, ord(J) is simply the i index which
spans from 1 to Nq
eMttf… mttfTest =e= sum{J, ord(J) * (Rq** ord(J))*(1-
Rq)};
eDisjoint… 0 =e= sum(s, mp(s)*ms(s));
mp.l(s) = 1;
ms.l(s) = 1;
Model energyCost /all/;
Solve energyCost using minlp maximizing mttfTest;
option decimals=8;
display ms.l, mp.l, Eq.l, Rq.l, Nq.l, mttfTest.l;
\