How to write this subsets

Problems with modeling
Post Reply
tavocopy
User
User
Posts: 6
Joined: 4 years ago

How to write this subsets

Post by tavocopy »

Hello, I´m trying to model a model with this sets,
Image
Could someone please help me how to write the subsets TF(l,p) and TL(p)

Code: Select all

P  'producto' /1A,11A,12A/
L  'actividades diferenciadoras' /1L,1A/
TF(l,p) 'productos diferenciados al aplicar actividad L en producto P' /1l,11A/
TL(p) 'actividades diferenciadoras que pueden ser aplicadas en producto p'/1L/
In this way I tried to write it.
Thank you.
Attachments
image.png
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: How to write this subsets

Post by Renger »

Hi
Your first figure isn't displayed correctly, so it is hard to answer your question.
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
tavocopy
User
User
Posts: 6
Joined: 4 years ago

Re: How to write this subsets

Post by tavocopy »

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

P.s sorry my bad english

regards
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: How to write this subsets

Post by Renger »

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/
	TF(l,p) 'productos diferenciados al aplicar actividad L en producto P' /1l,11A/
	TL(p) 'actividades diferenciadoras que pueden ser aplicadas en producto p'/1L/;

        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
User
Posts: 6
Joined: 4 years ago

Re: How to write this subsets

Post by tavocopy »

Thank so much, that really helps,

But, now i have another question about the same subsets but now in this equations
Image
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/
TL(l,p) 'actividades diferenciadoras aplicadas' /1L.1A/
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
Z(p,i,j,t) producto enviado
x(p,df,i,l,t) cantidad de producto transformado
v(p,i,t) cantidad de inventario;
Flow1.. flu1(p,mn(i),f3(t)).. -sup(p,i,t)=g=V(p,i,t-1)
                      +sum(a(j,i)$(ord(t)-d(j,i)>1), Z(p,j,i,t-d(j,i)))
                      +sum((df,l), x(df,p,i,l,t))
                      -v(p,i,t)-sum(a(i,j),Z(p,i,j,t))
                      -sum((l,df),X(p,df,i,l,t))=g=-sup(p,i,t);
Could you help me if is the right way to write the Equation?
Thank you
Cheers
Post Reply