Hello everyone,
I'm bigginer on GAMS, and i'm trying to use if for a modeling problem, nevertheless, i can't make the true syntax for the following loop,
Can sameone help me doing it, thank you in advance,
Loop
-
- User
- Posts: 118
- Joined: 7 years ago
- Location: Rosario - Argentina
Re: Loop
Hi, do you need the loop to define a parameter or is it an equation?
No loops are used to define equations.
anyway, you don't need a loop for this definition.
as a equation:
as a parameter:
I think this is fine but, I suggest you check it.
bye
No loops are used to define equations.
anyway, you don't need a loop for this definition.
as a equation:
Code: Select all
set
i /1*13/
;
alias(i,j,k)
eq(i).. log(gamma(i)) =e= - A*power(z(i),2) + 2*sum(j$(ord(j) ne ord(i)),m(j)*(B_0(i,j) + B_1(i,j)/(2*I)))
+ power(z(i),2)*sum((j,k)$(ord(j) ne ord(i) and ord(k) ne ord(i) and ord(j) ne ord(k)),m(j)*m(k)*B_1(j,k)/(4*power(I,2)));
as a parameter:
Code: Select all
gamma(i) = exp(- A*power(z(i),2) + 2*sum(j$(ord(j) ne ord(i)),m(j)*(B_0(i,j) + B_1(i,j)/(2*I)))
+ power(z(i),2)*sum((j,k)$(ord(j) ne ord(i) and ord(k) ne ord(i) and ord(j) ne ord(k)),m(j)*m(k)*B_1(j,k)/(4*power(I,2))));
bye
-
- User
- Posts: 4
- Joined: 5 years ago
Re: Loop
O thank you very much, I thaught that i had to use a loop,
I use your expression in in my code and it works very good,
Thank you again,
I use your expression in in my code and it works very good,
Thank you again,