Modeling Equations

Problems with modeling
Post Reply
PaluKing
User
User
Posts: 1
Joined: 3 years ago

Modeling Equations

Post by PaluKing »

Hello together,

I am currently trying to implement a model with the following restrictions, which I have not been able to formulate in GAMS:

Sets
i Products / P1*P3 /
m Microperiods / S1*S15 /
t Macroperiods / T1*T3 /

Mt(t,m) Set of Microperiods m within Macroperiod t / T1.S1*S5
T2.S6*S10
T3.S11*S15 /

Lt(t,m) Denoting the last Microperiod of a macroperiod t / T1.S5
T2.S10
T3.S15 /

Ltx(t,m) Without last Microperiod of a macroperiod t / T1.S1*S4
T2.S6*S9
T3.S11*S14 /;
alias(i,j);

alias(m,tau);
image.png
image.png (11.52 KiB) Viewed 1500 times
is that possible like this:

Relation(j,m) ..
SD(j,m) =g= Sum(tau$(ord(tau) <= (ord(m)-ommega(j))), R(j,tau)) - Sum(tau$(ord(tau) <= (ord(m)-1)), yR(j,tau)) - Sum(tau$(ord(tau) <= (ord(m)-1)), SD(j,tau));

ReworkEarly(j,m) ..
Sum(tau$(ord(tau) <= (ord(m)-1)), R(j,tau)) - Sum(tau$(ord(tau) <= (ord(m)-1)), yR(j,tau)) =g= yR(j,m);

secound issue:
image.png
image.png (7.45 KiB) Viewed 1500 times
how can I expres the condition to the Set without a "Uncontrol set entered as constant" error:

KapaRest(t)$(M(t,m)) ..
Sum((j,m)$(M(t,m)), (tb(j) * y(j,m) + tbR(j) * yR(j,m))) =l= b(t) - Sum((i,j,m)$(M(t,m) and (not sameas(i,j))), ts(i,j) * zz(i,j,m));

thirdly:
image.png
image.png (8.59 KiB) Viewed 1500 times
can I expres this lines like this? or is there a logical mistake from my side?:

MinLotsize(j,t,m)$(Ltx(t,m)) ..
y(j,m) + yR(j,m) =g= kt(j) * (x(j,m) - x(j,m-1)$(ord(m)>1));

Prodkont(j,t,m)$(Lt(t,m)) ..
y(j,m) + y(j,m+1) + yR(j,m) + yR(j,m+1) =g= kt(j) * (x(j,m) - x(j,m-1)$(ord(m)>1));

I would be very grateful for any help or discussion! :)
Attachments
image.png
image.png (11.52 KiB) Viewed 1500 times
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: Modeling Equations

Post by abhosekar »

As a general guideline, when posting a code fragment, please use code block.

Your first two equation seem logically correct (did not try the syntax) Relation and ReworkEarly

When you write KapaRest(t)$(Mt(t,m)), it is not clear what you mean? Do you mean if 'any' Mt(t, m) exists for a given t? In this case, the m in Mt(t, m) is not known. If you want to write this equation if any Mt(t, m) exists, you should create a set that contains only t elements of set Mt(t, m). You can do this as follows.

Code: Select all

set tsub(t);

option tsub < Mt(t, m);

Moreover, you have written $(M(t, m)) which I think is a typo (it should be Mt).

Minlotsize and Prodcont look reasonable (again without actually running your code so not sure about small missing parentheses).

- Atharv
Post Reply