Here are some examples:

Code: Select all

`eq(i,j).. C(i,j) =e= sum(k,A(i,k)*B(k,j));`

Code: Select all

`eq(i,j).. C(i,j) =e= sum((k,m)$(ord(m) eq ord(k)), A(i,k)*B(m,j) );`

- 8 months ago
- Forum: Syntax
- Topic: Matrix multiplication in GAMS
- Replies:
**1** - Views:
**401**

hi, the matrix dimensions must be compatible to carry out the multiplication.

Here are some examples:

or
Bye!

Here are some examples:

Code: Select all

`eq(i,j).. C(i,j) =e= sum(k,A(i,k)*B(k,j));`

Code: Select all

`eq(i,j).. C(i,j) =e= sum((k,m)$(ord(m) eq ord(k)), A(i,k)*B(m,j) );`

- 9 months ago
- Forum: Syntax
- Topic: linearization of power function
- Replies:
**1** - Views:
**459**

I think you should linearize the 4 possibilities and then using a binary variable to select one.

four possibilities: y^1 (linear) y^2 (non linear and convex) y^3 (non linear and convex) and y^4 (non linear and convex)

bye

four possibilities: y^1 (linear) y^2 (non linear and convex) y^3 (non linear and convex) and y^4 (non linear and convex)

bye

- 10 months ago
- Forum: Syntax
- Topic: Syntax for sets
- Replies:
**2** - Views:
**382**

Is this code ok? This select the stream 4 for the mixer 2 and stream 7 for mixer 3. I hope it is useful to you Bye Set mxr number of mixers / 1*3 / Str process streams / 1*10 / imxr(mxr,str) mixer-stream (inlet) matches / 1.(1,2) , 2.(4,5), 3.(8,7) / smxr(mxr) mixer selected for linearization / 2,3 ...

- 10 months ago
- Forum: Syntax
- Topic: searching string in set
- Replies:
**11** - Views:
**1158**

In your code tac is a subset not a set... i think this is the problem

- 10 months ago
- Forum: Syntax
- Topic: searching string in set
- Replies:
**11** - Views:
**1158**

Or, if you need to use the set tid:

Code: Select all

```
set tid /2000*2014/;
alias(tid,tidp)
parameter
p
;
loop(tidp,
loop(tid$(ord(tid) eq card(tid) - (ord(tidp)-1)),
p=ord(tid);
display p;
););
```

- 10 months ago
- Forum: Syntax
- Topic: searching string in set
- Replies:
**11** - Views:
**1158**

I quickly think that it can be something like this:

set tid /2000*2014/;

parameter

p

;

loop(tid,

p=2014-(ord(tid) -1)

display p;

);

set tid /2000*2014/;

parameter

p

;

loop(tid,

p=2014-(ord(tid) -1)

display p;

);

- 10 months ago
- Forum: Syntax
- Topic: searching string in set
- Replies:
**11** - Views:
**1158**

Hi, I think that order doesn't matter when you defining an equation.

set tid /2000*2014/;

equationx(tid)$condition(tid).. "an equation"

set tid /2000*2014/;

equationx(tid)$condition(tid).. "an equation"

- 10 months ago
- Forum: Syntax
- Topic: searching string in set
- Replies:
**11** - Views:
**1158**

Hi, to be able to compare them I think they should be defined as parameters.

Another possibility is to use auxiliary parameters.

To search for a string in a set, I usually use the "sameas" command.

Bye!

Another possibility is to use auxiliary parameters.

To search for a string in a set, I usually use the "sameas" command.

Bye!

- 11 months ago
- Forum: Syntax
- Topic: Two Indexex [Maybe Alias problem]
- Replies:
**4** - Views:
**3530**

Hi, the problem is in set k at the end of the equation: ...V_NEG*dm(j,k)/sum(jj,dm(jj,k)); This is the equation exactly like the one in the image: eq_margen_1(j) .. sum(p,is(j,p))+ sum(i,th(j,i)*Y(i,j)) - sum(k,dm(j,k)) =G= sum(jj, sum(p,is(jj,p))+ sum(i,th(jj,i)*Y(i,jj)) - sum(k,dm(jj,k)))*V_NEG*dm...

- 1 year ago
- Forum: Syntax
- Topic: Binary Matrix
- Replies:
**2** - Views:
**529**

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

Bye

Code: Select all

```
Binary Variable
MM(i,k) ;
```