Hi there.
I’m dealing with gams syntax, But having trouble with it.
I’d like to use summation function as below.
sum(T, Y(T,D)) = Bd * Cd
but T is from Sd to Sd + Bd -1
where Sd and Bd is paramete.
How can I deal with it?
FYI, explanatory data will be given as below.
- Formulation
- GAMS coding
Set
T ‘time balocks’ /1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12/
D ‘demands’ /d1, d2, d3/;
Parameter
cars(D) ‘How many cars it needs’ /d1 3, d2 4, d3 5/
earl(D) ‘When is the earliest departure time’ /d1 1, d2 3, d3 5/
late(D) ‘When is the latest departure time’ /d1 3, d2 5, d3 6/
betw(D) ‘How long it will occupy’ /d1 3, d2 4, d3 2/;
Integer variables
start(D);
Scalar
v ‘cars available’ /10/;
Binary Variables
x(T,D);
Positive variables
Y(T,D) ‘Binary x(T,D) and card(D)’;
Y.up(T,D) = cars(D) * x.up(T,D);
Positive variables
mean;
Free variable
obj;
Equations
meanf, objf, demandff, capa, asrA, asrB, asrC, BR;
meanf…
mean =e= sum((T,D), Y(T,D)) / card(t);
objf(t)…
obj =e= sqr(mean - sum(D, Y(T,D))) ;
capa(t)…
sum(D, Y(T,D)) =l= v;
asrA(D)…
start(D) =g= earl(D);
asrB(D)…
start(D) =l= late(D);
asrC(D,T)$(start(D) <= T <= start(D)+betw(D)-1)…
sum(T, Y(T,D)) =e= betw(D)*cars(D);
Model Carpoor /all/;
Solve Carpoor minimizing obj using minlp;
Thank you in advance!