## How to write this subsets

Problems with modeling
tavocopy
User
Posts: 3
Joined: 2 months ago

### How to write this subsets

Hello, I´m trying to model a model with this sets,

Code: Select all

``````P  'producto' /1A,11A,12A/
In this way I tried to write it.
Thank you.
Attachments

Renger
Posts: 419
Joined: 3 years ago

### Re: How to write this subsets

Hi
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

tavocopy
User
Posts: 3
Joined: 2 months ago

### Re: How to write this subsets

Hi,
My original questions about is how to write the subset, TF(I,P), TL(p)
set
P index set of products /1A,11A/
L index set of production activities /1L/
TF(I,P) ⊆ P, index Set of product variants generated by applying production activity L to product P
TL(p) ⊆ L, index Set of production activities which can be applied to product P

I like to think the subsets are trying to say something like this
11A(1L,1A) ⊆ P
1L(1A)⊆ L
But I'm not sure if this way is correct

regards

Renger
Posts: 419
Joined: 3 years ago

### Re: How to write this subsets

Hi
Thanks for the clarification. I think you can use mappings. These are multidimensional sets that assign elements of one set to another set.
Afterwards you can use the mappings in your equations and assignments. Take a look here mappings.

Code: Select all

``````set
P index set of products /p1*p3
L index set of production activities /l1*l2/

mapPtoL(p,l) Mapping from products to production
/(p1,p3).l1,
p2.l2/
mapLtoP(l,p) Mapping from production to products
;
``````
Hope this helps
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

tavocopy
User
Posts: 3
Joined: 2 months ago

### Re: How to write this subsets

Thank so much, that really helps,

But, now i have another question about the same subsets but now in this equations

parameter
D(i,j)
sup(p,i,t)
Integer Variables
V(p,i,t)
X(p,p',i,l,t)
Z(p,i,j,t)
Equation

-sup(p,i,t)<= V(p,i,t)+Σ((j,i):(t-d(j,i)>=1), Z(p,i,j,t)+Σ(L∈TL(p'),p'∈P:p∈TF(l,p') X(p',p,i,l,t)- V(p,i,t)-Σ(i,j) Z(p,i,j,t)-Σ(L∈TL(p),p'∈TF(l,p) X(p,p',i,l,t)

For all p, i, t

In gams, I wrote it in this way

Code: Select all

``````set
P  'products' /1A,11A,12A/
L  'activities' /1L/
TF(p,l) 'Variables de productos' /11A.1l,12A.1L/
N 'localizaciones' /mont, tol, ZC1/

T'peridos' /0,1,2,3/
TR 'Tiempos reales' /1*3/;
A(i,j) 'links de transporte permitidos' /mont.tol, tol.zc1, mont.zc1/
alias (n,i,j),(p,df);
Parameter
D(i,j);
Integer variable