Search found 118 matches

by Manassaldi
3 years ago
Forum: Syntax
Topic: If Condition Over Binary Variables
Replies: 1
Views: 3854

Re: If Condition Over Binary Variables

Hi, you can try a bigM decomposition. You must define a new binary variable y(t). I assume that Z(p,q,t) and n(a,t) are binary variables. if y(t)=1 then sum((p,q), Z(p,q,t) <126 (that is, less than or equal to 125) and if y(t)=0 then sum((p,q), Z(p,q,t) is not <126 (that is, greater than or equal to...
by Manassaldi
4 years ago
Forum: Archive Google Group
Topic: trigonometric functions
Replies: 8
Views: 13309

Re: trigonometric functions

That is not a GAMS valid sentence. Maybe you are confused in the way "GAMS" works. I think i can't help you
Best
by Manassaldi
4 years ago
Forum: Archive Google Group
Topic: trigonometric functions
Replies: 8
Views: 13309

Re: trigonometric functions

GAMS supports trigonometric functions.
What are the functions you have problems with?
Extrinsic functions are to implements your own functions.

Best
by Manassaldi
4 years ago
Forum: Modeling
Topic: linearization of a logarithmic function (log) defined over a variable
Replies: 0
Views: 1857

Re: linearization of a logarithmic function (log) defined over a variable

Hi, the logarithmic function is a concave function so you can overestimate the function with first order Taylor approximations in domain points or underestimate using a piecewise linear approximation.
by Manassaldi
4 years ago
Forum: Syntax
Topic: How to write this constraint in GAMS Code?
Replies: 3
Views: 4728

Re: How to write this constraint in GAMS Code?

Hi, I guess you have to define the set, subset and alias.

for example:

Code: Select all

sets
i /i1*i10/
v /v1*v10/
N0(i) /i1,i3,i4,i5/
;
alias(i,j);
eq(i,v)$N0(i).. sum(j$(N0(j) and ord(j) ne ord(i)),x(i,j,v)) =e= sum(j$(N0(j) and ord(j) ne ord(i)),x(j,i,v))
by Manassaldi
5 years ago
Forum: Syntax
Topic: Loop
Replies: 2
Views: 2662

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: 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)...
by Manassaldi
5 years ago
Forum: Syntax
Topic: logical equations & binary variables
Replies: 15
Views: 15406

Re: logical equations & binary variables

Hi, in the previous answer I wrote this code and I saved it as a draft. I hope this can help you. Bye! set i intervals /i1*i6/ n your nset /n1*n2/ l limits /l,u/ ; parameter p(n) /n1 1, n2 3/ intervals(n,i,l) anvalue(i) /i1 0 i2 0.2 i3 0.4 i4 0.6 i5 0.8 i6 1/ evalue /1e-6/ ; intervals(n,'i1','l')=0;...
by Manassaldi
5 years ago
Forum: Syntax
Topic: logical equations & binary variables
Replies: 15
Views: 15406

Re: logical equations & binary variables

Hi, if p (n) is a parameter, I think it is better to reformulate the intervals definition: if th >= p(n) then a(n) =0; else if th < p(n) and th >= p(n) * 10^-.5 then a(n) = .2; else if th < p(n)*10^-.5 and th >= p(n) * 10^-1 then a(n) = .4; else if th < p(n)*10^-1 and th >= p(n) * 10^-1.5 then a(n) ...
by Manassaldi
5 years ago
Forum: Tools
Topic: Generate an array of random numbers
Replies: 6
Views: 6966

Re: Generate an array of random numbers

I did not know the shuffle option. Thanks for sharing dirkse!
by Manassaldi
5 years ago
Forum: Tools
Topic: Generate an array of random numbers
Replies: 6
Views: 6966

Re: Generate an array of random numbers

Hi dirkse, i like your compact implementation.
I tested your code but sometimes I got less than seven items with a value of 1 and sometimes more.
i'm right?