a set with changing upper bound
Posted: Wed Apr 12, 2017 3:28 am
Hi,
I am working on cutting stock problem and trying to model it is GAMS. In my formulation I have three main sets, i,j and k.
i=1,...,10;
j=1,...,10;
and k= 1,...,N(i);
It means my set k in going to have different upper bounds for each i in the problem. I do not know how to model it in GAMS. Hope you can help me. Thanks in Advance.
I am working on cutting stock problem and trying to model it is GAMS. In my formulation I have three main sets, i,j and k.
i=1,...,10;
j=1,...,10;
and k= 1,...,N(i);
It means my set k in going to have different upper bounds for each i in the problem. I do not know how to model it in GAMS. Hope you can help me. Thanks in Advance.
Code: Select all
Set
i raw types /1*10/
j final types /1*10/
k k th raw type ;
Parameter
q number of raw types /10/
p number of final types /10/
W(i) width of raw type i
/1 78
2 65
3 55
4 47
5 35
6 30
7 30
8 27
9 25
10 24 /
d(j) demand of final type j
/1 40
2 40
3 29
4 27
5 34
6 20
7 24
8 42
9 46
10 33 /
s(j) width of final type j
/1 17
2 17
3 16
4 16
5 13
6 6
7 5
8 4
9 2
10 2 /
N(i) number of type i
/1 9
2 7
3 13
4 7
5 14
6 10
7 13
8 13
9 6
10 14 / ;
positive Variable x(k,i,j) number of finals of length sj cut from the kth raw of type i
y(k,i) a binary varable- 1 if kth raw of type i is being used or not;
free variable z1 objective variable for minimizing raw usage
z2 objective variable for minimizing total waste ;
Equation obj1
obj2
equ1(j) demand
equ2(k,i) width ;
obj1..z1=e=sum(i,sum(k,y(k,i)));
obj2..z2=e=sum((i,k),W(i)*y(k,i))-sum((i,k,j),x(k,i,j)*s(j));
equ1(j)..sum((i,k),x(k,i,j))=e=d(j);
equ2(k,i).. sum(j,x(k,i,j)*s(j))=l=W(i)*y(k,i);
model cuttingstock1 /obj1,equ1,equ2/;
model cuttingstock2 /obj2,equ1,equ2/;
solve cuttingstock1 using LP minimizing z1;
solve cuttingstock2 using LP minimizing z2;