## Search found 65 matches

2 weeks ago
Forum: Syntax
Topic: Binary Matrix
Replies: 2
Views: 62

### Re: Binary Matrix

Hi, you must specify that MM(i,k) is a binary variable.

Code: Select all

``````Binary Variable
MM(i,k) ;
``````
Bye
2 weeks ago
Topic: maximum number of repetitions
Replies: 2
Views: 177

### Re: maximum number of repetitions

Hi, I think this can work. Maybe it should be modified for a greater generality Bye! set i your set i /1*55/ n number of pattern /p1*p6/ j your set j /40,50,60/ pattern(n,j) pattern definition /p1.40,p2.50,p3.60,p4.40,p4.50,p5.40,p5.60,p6.50,p6.60/ ; table D(i,j) 40 50 60 1 40 50 2 60 3 40 9 50 17 5...
4 weeks ago
Forum: Syntax
Topic: controling equations with subsets
Replies: 3
Views: 138

### Re: controling equations with subsets

Hi, you must always reference to the original set (i, j) for example: set i /i1*i10/ j /j1*j15/ h /h1*h40/ technology(i,j) subset_of_tech(i,j) ; technology(i,j)= some set definition subset_of_tech(i,j)= some set definition constraint(i,j,h)\$(technology(i,j) and subset_of_tech(technology)).. var(i,j,...
1 month ago
Forum: Modeling
Topic: Linearization problem with three decision variables
Replies: 1
Views: 72

### Re: Linearization problem with three decision variables

Hello, do you need the product of three variables? If so, you can linearizing the product of two binary variables (Quality of production and Transportation area); this generate a new binary variable (suppose QT). Finally, you can linearizing the product of a binary and a continuous variable (QT and ...
1 month ago
Forum: Syntax
Topic: controling equations with subsets
Replies: 3
Views: 138

### Re: controling equations with subsets

Bye

constraint(technology)\$subset_of_tech(technology).. var(technology) =g= par(technology);
1 month ago
Forum: Modeling
Topic: To binary or not to binary...
Replies: 4
Views: 165

### Re: To binary or not to binary...

Hi, you can use a bounded continuous variable.
positive variable
T
;
T.lo=50;
T.up=150;

This works, except if you need that the variable take integer values.
Bye
2 months ago
Forum: Modeling
Topic: Xii >= Xij how to code in GAMS
Replies: 2
Views: 119

### Re: Xii >= Xij how to code in GAMS

Hi, it's simple

set i warehouse /1*3/;
alias(i,j);

eq(i,j)\$(ord(i) ne ord(j)).. X(i,i) =g= X(i,j);

Bye
3 months ago
Forum: Syntax
Topic: kind request: Setting two variables equal in GAMS
Replies: 1
Views: 132

### Re: kind request: Setting two variables equal in GAMS

Hi,
what is J, K, RJ and KR?
Can you explain what each set means?

An alternative can be:

eq(J,K,RJ,KR)\$(sameas(J,RJ) and sameas(K,KR)).. FlowMSAsMEN(J,K) =E= FlowMSAsREG(RJ,KR);

Bye
3 months ago
Forum: Syntax
Topic: logical equations & binary variables
Replies: 13
Views: 1068

### Re: logical equations & binary variables

Hi, I think you can try a simple big-M reformulation. I assume that "HS(j)" is continuous and positive. The new variable TWC_HS(j) correspond to TWC(j)*HS(j) x(j) is a binary variable: x(j)=1 if HS(j) >=1000. x(j)=0 if HS(j) < 1000 eq1(j).. HS(j) =g= 1000*x(j); eq2(j).. TWC_HS(j) =g= 3.21*HS(j) - 3....
5 months ago
Forum: Modeling
Topic: converting an integer variable into a binary variable
Replies: 2
Views: 323

### Re: converting an integer variable into a binary variable

Hi, try these equations:

eq.. X =l= M*Y
eq.. X =g= Y

M is a parameter and the upper bound of X

If Y =1
X =l= M
X =g= 1

if Y = 0
X =l= 0
X =g= 0

Bye!