Hi, I have to indices
one from product p
an one productfamily f
and I want to implement a mathematical equation, where p is Indice from f and I don't declare f for the equation.
In the following picture you can see the wanted Equation.
How can I implement the f and p as indices in GAMS.
Thank you in advance.
Indice from Indice
Re: Indice from Indice
You do this via a mapping set: pf(p,f). You also need this for P_m:
The sum(pf(p,f), ...) is not a real sum since pf is a onetoone mapping, so it just selects the f for the active p.
Michael
Code: Select all
set m /m1*m3/, g /g1*g5/, p /p1*p5/, f /f1*f5/;
set pf(p,f) / #p:#f /, mp(m,p) / m1.(p1,p2,p3), m2.(p2,p3,p4), m3.(p3,p4,p5) /;
variable B(m,p,g), A(m,f,g);
equation e(p,m,g);
e(p,m,g)$mp(m,p).. B(m,p,g) =l= sum(pf(p,f), A(m,f,g));
Michael
Re: Indice from Indice
Thank you very much for this fast answer.
This helps me alot.
This helps me alot.

 User
 Posts: 4
 Joined: 2 months ago
Re: Indice from Indice
bussieck wrote: ↑3 months agoYou do this via a mapping set: pf(p,f). You also need this for P_m:
The sum(pf(p,f), ...) is not a real sum since pf is a onetoone mapping, so it just selects the f for the active p.Code: Select all
set m /m1*m3/, g /g1*g5/, p /p1*p5/, f /f1*f5/; set pf(p,f) / #p:#f /, mp(m,p) / m1.(p1,p2,p3), m2.(p2,p3,p4), m3.(p3,p4,p5) /; variable B(m,p,g), A(m,f,g); equation e(p,m,g); e(p,m,g)$mp(m,p).. B(m,p,g) =l= sum(pf(p,f), A(m,f,g));
Michael
Hi Michael,
if we have the condition that is in photo how can we write the k in sum symbol. İs sum(k$M(j,k), x(i,j,k))=e=1; true. M is set of machines, k is indices of machines and j is indices of jobs.