Paramter with defined values

Problems with modeling
Post Reply
Tilli95
User
User
Posts: 2
Joined: 3 years ago

Paramter with defined values

Post by Tilli95 »

Hello,
i have a problem with my GAMS script for a lot size problem.
I want to make sure that the variable Q (k, t) can only be certain values ​​wich are defined in a parameter.
For example:
The box for the product k1 is big enough for 50 pieces. So Q (k1, t1) can be 50 pieces, 100 pieces or 150 pieces. So half boxes are not allowed.
For example something like this:

Behaelterbeg(k,t)..

Q(k,t) =e= a(k);

Paramters
a(k) /k1 50 or 100 or 150, k2 60 or 120 or 180, k3......./;

Thank you and greetings from germany.

Code: Select all

$title CLSP
* Capacitated Lot Sizing Problem

* Modellformulierung

Sets
t        Perioden
k        Produkte
a        Mengen;
Parameter
hc(k)    Kosten der Lagerung einer Einheit von Produkt kueber eine Periode
ts(k)    Ruestzeit fuer Produkt k
tb(k)    Stueckbearbeitungszeit fuer Produkt k
sc(k)    Kosten eines R�stvorgangs fuer Produkt k
Y0(k)    Lageranfangsbestand von Produkt k
C(t)     Kapazitet der Ressource in Periode t
d(k,t)   Bedarf von Produkt k in Periode t


Positive Variables
Q(k,t)   Produktionsmenge von Produkt k in Periode t
Y(k,t)   Lagerbestand von Produkt k am Ende von Periode t ;

Binary Variables
gamma(k,t) binaere Ruestvariable von Produkt k in Periode t;


Variables
ZF       Zielfunktionswert;

Equations
ZFkt     Minimierung der Gesamtkosten
LBil(k,t) Lagerbilanzgleichung
KapRes(t) Kapazitaetsrestriktion
RuestBed(k,t) Ruestbedingung

;


ZFkt..
         ZF =e= SUM((k,t), hc(k) * Y(k,t) + sc(k) * gamma(k,t));

LBil(k,t)..
         Y0(k)$(ord(t)=1) + Y(k,t-1)$(ord(t)>1) + Q(k,t) - Y(k,t) =e= d(k,t);

KapRes(t)..
         SUM(k, ts(k) * gamma(k,t) + tb(k) * Q(k,t)) =l= C(t);

RuestBed(k,t)..
         tb(k) * Q(k,t) =l= C(t) * gamma(k,t);




* Daten der konkreten Instanz  
sets     t /t1*t6/
         k /k1*k6/;
         

   
parameter
         sc(k) /k1 20.0, k2 50.0, k3 40.0, k4 30.0, k5 50.0, k6 40.0/
         hc(k) /k1 3.0, k2 5.0, k3 6.0, k4 4.0, k5 3.0, k6 2.0/
         tb(k) /k1 1.0, k2 2.0, k3 1.0, k4 4.0, k5 2.0, k6 1.0/
         ts(k) /k1 30, k2 100, k3 50, k4 40, k5 40, k6 2.0/;



* Keine Anfangslagerbestaende
y0(k)= 0;

* Periodenkapazitaet konstant
C(t)=10000;
*C(t)=400;
*sc(k)=100*sc(k);

table d(k,t)
                 t1      t2      t3      t4      t5      t6
         k1      10      25      30      100             30
         k2              5       40              10      60
         k3      5       45      30              40      60
         k4              40      20      15      80
         k5      20              5       15      70      50
         k6      10              15       5      20      30;



Model CLSP / all /;
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: Paramter with defined values

Post by abhosekar »

Hi,

I don't completely understand your problem but I see that you would want one of your variables to be an integer multiple of 50 (or any other number for that matter).

You can define a general integer variable
integer y(k,t) that can take values from 0 to 3.
Then you can write
Q(k, t)=e= a(k)*y(k, t);

In the question you write parameter a(k) to be 50 or 100 and so on. However, I assume you know specifically if it is 50 or 100.

Set bounds on the integer variable.
y.lo(k, t)= 0; y.up(k ,t) = 3;

- Atharv
Tilli95
User
User
Posts: 2
Joined: 3 years ago

Re: Paramter with defined values

Post by Tilli95 »

Hi Atharv,
thank´s for helping me. The keyword u said is Integer Variables. I didn´t found it on the GAMS Documentation.
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: Paramter with defined values

Post by abhosekar »

Sure. You can find it here. https://www.gams.com/latest/docs/UG_Var ... 22_integer

There is not much about syntax instead of defining 'variable' or 'binary variable', you define 'integer variable'

- Atharv
Post Reply